Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

Commit 3958063

Browse files
Add files via upload
1 parent c3948e4 commit 3958063

6 files changed

Lines changed: 143 additions & 17 deletions

File tree

C#/App6.png

594 KB
Loading

C#/BMBF BS Backup Utility.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,13 @@
103103
<None Include="App.config" />
104104
</ItemGroup>
105105
<ItemGroup>
106-
<Resource Include="App2.png" />
106+
<Resource Include="Logo.ico" />
107107
</ItemGroup>
108108
<ItemGroup>
109-
<Resource Include="Logo.ico" />
109+
<Resource Include="App5.png" />
110+
</ItemGroup>
111+
<ItemGroup>
112+
<Resource Include="App6.png" />
110113
</ItemGroup>
111114
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
112115
</Project>

C#/MainWindow.xaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
ResizeMode="CanMinimize"
99
WindowStyle="None"
1010
MouseMove="Drag"
11-
Title="BMBF and BS Backup Utility" Height="427" Width="510" Background="#FF282828" >
11+
Title="BMBF and BS Backup Utility" Height="457" Width="510" Background="#FF282828" >
1212
<Grid>
1313
<Grid.Background>
14-
<ImageBrush ImageSource="App2.png" Stretch="UniformToFill"/>
14+
<ImageBrush ImageSource="App6.png" Stretch="UniformToFill"/>
1515
</Grid.Background>
1616
<AccessText MouseEnter="noDrag" MouseLeave="doDrag" Opacity="0.8" HorizontalAlignment="Left" Height="24.6" VerticalAlignment="Top" Width="186.238" RenderTransformOrigin="0.5,0.5" Text="BMBF and BS Backup Utility" FontSize="14" Foreground="Black" Margin="36.2,3.843,0,0"/>
1717
<Button MouseEnter="noDrag" MouseLeave="doDrag" Click="Close" Content="X" HorizontalAlignment="Left" Margin="470,4,0,0" VerticalAlignment="Top" Width="31" Background="#00000000" BorderBrush="#FFCBCBCB"/>
@@ -27,16 +27,18 @@
2727
</Button>
2828
<Button Click="Start_Update" FontFamily="lucida console" MouseEnter="noDrag" MouseLeave="doDrag" x:Name="UpdateB" Content="Update" HorizontalAlignment="Left" Margin="290,29.6,0,0" VerticalAlignment="Top" Width="199.865" Height="33" Background="#FFFF3636" Foreground="#FFE7E7E7" FontWeight="Bold"/>
2929

30-
<ComboBox Opacity="0.8" MouseEnter="noDrag" MouseLeave="doDrag" x:Name="Backups" HorizontalAlignment="Left" Margin="289.865,347.038,0,0" VerticalAlignment="Top" Width="200" BorderBrush="#FFB94747" Background="#FF005654" Foreground="Black"/>
31-
<TextBox MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" Opacity="0.8" IsReadOnly="True" x:Name="txtbox" HorizontalAlignment="Left" Height="377.398" Margin="10,29.6,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="275" Background="#FF494949" Foreground="#FFA6A6A6" BorderBrush="#FFD30000"/>
30+
<ComboBox Opacity="0.8" MouseEnter="noDrag" MouseLeave="doDrag" x:Name="Backups" HorizontalAlignment="Left" Margin="290,393.001,0,0" VerticalAlignment="Top" Width="200" BorderBrush="#FFB94747" Background="#FF005654" Foreground="Black"/>
31+
<TextBox MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" Opacity="0.8" IsReadOnly="True" x:Name="txtbox" HorizontalAlignment="Left" Height="423.361" Margin="10,29.6,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="275" Background="#FF494949" Foreground="#FFA6A6A6" BorderBrush="#FFD30000"/>
3232
<Button MouseEnter="noDrag" MouseLeave="doDrag" x:Name="BackupB" FontFamily="lucida console" Opacity="0.9" Click="Backup" Content="Backup" HorizontalAlignment="Left" Margin="290,164.757,0,0" VerticalAlignment="Top" Width="200" Height="33" RenderTransformOrigin="-0.858,0.891" Background="#FF005654" Foreground="#FFF3F3F3" BorderBrush="#FFB94747"/>
3333
<TextBox LostFocus="QuestIPCheck" FontFamily="lucida console" GotFocus="ClearText" MouseEnter="noDrag" MouseLeave="doDrag" Opacity="0.8" x:Name="Quest" HorizontalAlignment="Left" Height="23" Margin="290,71.818,0,0" TextWrapping="Wrap" Text="Quest IP" VerticalAlignment="Top" Width="200" Background="#FF494949" BorderBrush="#FFD30000" Foreground="White"/>
3434
<TextBox LostFocus="BackupNameCheck" FontFamily="lucida console" GotFocus="ClearTextN" MouseEnter="noDrag" MouseLeave="doDrag" Opacity="0.8" x:Name="BName" HorizontalAlignment="Left" Height="23" Margin="290,126.357,0,0" TextWrapping="Wrap" Text="Backup Name" VerticalAlignment="Top" Width="200" Background="#FF494949" BorderBrush="#FFD30000" Foreground="White"/>
3535
<CheckBox Opacity="0.9" MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" x:Name="RSongs" Content="Restore Songs" HorizontalAlignment="Left" Margin="310.965,222.3,0,0" VerticalAlignment="Top" Background="#FF005654" BorderBrush="#FFB94747" Foreground="#FFF3F3F3"/>
3636
<CheckBox Opacity="0.9" MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" x:Name="RPlaylists" Content="Restore Playlists" HorizontalAlignment="Left" Margin="310.965,251.1,0,0" VerticalAlignment="Top" Background="#FF005654" BorderBrush="#FFB94747" Foreground="#FFF3F3F3"/>
3737
<CheckBox Opacity="0.9" MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" x:Name="RScores" Content="Restore Scores" HorizontalAlignment="Left" Margin="310.965,279.9,0,0" VerticalAlignment="Top" Background="#FF005654" BorderBrush="#FFB94747" Foreground="#FFF3F3F3"/>
3838
<CheckBox Opacity="0.9" MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" x:Name="RMods" Content="Restore Mods" HorizontalAlignment="Left" Margin="310.965,311.9,0,0" VerticalAlignment="Top" Background="#FF005654" BorderBrush="#FFB94747" Foreground="#FFF3F3F3"/>
39-
<Button MouseEnter="noDrag" MouseLeave="doDrag" x:Name="RestoreB" FontFamily="lucida console" Opacity="0.8" Click="Restore" Content="Restore" HorizontalAlignment="Left" Margin="290,373.998,0,0" VerticalAlignment="Top" Width="200" Height="33" RenderTransformOrigin="-0.858,0.891" Background="#FF005654" Foreground="#FFF3F3F3" BorderBrush="#FFB94747"/>
39+
<Button MouseEnter="noDrag" MouseLeave="doDrag" x:Name="RestoreB" FontFamily="lucida console" Opacity="0.8" Click="Restore" Content="Restore" HorizontalAlignment="Left" Margin="290,419.961,0,0" VerticalAlignment="Top" Width="200" Height="33" RenderTransformOrigin="-0.858,0.891" Background="#FF005654" Foreground="#FFF3F3F3" BorderBrush="#FFB94747"/>
40+
<CheckBox Opacity="0.9" MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" x:Name="RReplays" Content="Restore Replays" HorizontalAlignment="Left" Margin="310.965,339.1,0,0" VerticalAlignment="Top" Background="#FF005654" BorderBrush="#FFB94747" Foreground="#FFF3F3F3" Width="142.885"/>
41+
<CheckBox Opacity="0.9" MouseEnter="noDrag" MouseLeave="doDrag" FontFamily="lucida console" x:Name="RSounds" Content="Restore Sounds" HorizontalAlignment="Left" Margin="310.965,363.702,0,0" VerticalAlignment="Top" Background="#FF005654" BorderBrush="#FFB94747" Foreground="#FFF3F3F3" Width="142.885"/>
4042

4143
</Grid>
4244
</Window>

C#/MainWindow.xaml.cs

Lines changed: 131 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public partial class MainWindow : Window
3636

3737
String IP = "";
3838
Boolean draggable = true;
39+
Boolean running = false;
3940
String exe = System.Reflection.Assembly.GetEntryAssembly().Location;
4041
String Songs = "";
4142
String Playlists = "";
@@ -69,18 +70,34 @@ public MainWindow()
6970
}
7071
getBackups();
7172
Update();
73+
74+
RSongs.IsChecked = true;
75+
RPlaylists.IsChecked = true;
76+
RScores.IsChecked = true;
77+
RMods.IsChecked = true;
78+
RReplays.IsChecked = true;
79+
RSounds.IsChecked = true;
7280
}
7381

7482

7583
public void Backup(object sender, RoutedEventArgs e)
7684
{
85+
if(running)
86+
{
87+
return;
88+
}
89+
running = true;
90+
7791
//Create all Backup Folders
7892
BackupFSet();
7993

8094
//Scores
95+
txtbox.AppendText("\n\nBacking up scores");
8196
adb("pull /sdcard/Android/data/com.beatgames.beatsaber/files/LocalDailyLeaderboards.dat \"" + Scores + "\"");
8297
adb("pull /sdcard/Android/data/com.beatgames.beatsaber/files/LocalLeaderboards.dat \"" + Scores + "\"");
8398
adb("pull /sdcard/Android/data/com.beatgames.beatsaber/files/PlayerData.dat \"" + Scores + "\"");
99+
txtbox.AppendText("\nBacked up scores\n");
100+
txtbox.ScrollToEnd();
84101

85102
//Songs
86103

@@ -90,14 +107,39 @@ public void Backup(object sender, RoutedEventArgs e)
90107

91108
PlaylistB();
92109
adb("pull /sdcard/BMBFData/Playlists/ \"" + Playlists + "\"");
110+
txtbox.ScrollToEnd();
111+
112+
//Replays
113+
114+
txtbox.AppendText("\n\nBacking up replays");
115+
adb("pull /sdcard/Android/data/com.beatgames.beatsaber/files/replays \"" + BackupF + "\"");
116+
txtbox.AppendText("\nBacked up replays\n");
117+
txtbox.ScrollToEnd();
118+
119+
//Sounds
120+
121+
txtbox.AppendText("\n\nBacking up sounds");
122+
adb("pull /sdcard/Android/data/com.beatgames.beatsaber/files/sounds \"" + BackupF + "\"");
123+
txtbox.AppendText("\nBacked up sounds\n");
124+
txtbox.ScrollToEnd();
93125

94126
//Mods
95127

96128
ModsB();
129+
130+
txtbox.AppendText("\n\n\nBMBF and Beat Saber Backup has been made.");
131+
txtbox.ScrollToEnd();
132+
running = false;
97133
}
98134

99135
public void Restore(object sender, RoutedEventArgs e)
100136
{
137+
if (running)
138+
{
139+
return;
140+
}
141+
running = true;
142+
101143
if (Backups.SelectedIndex == 0)
102144
{
103145
txtbox.AppendText("\n\nSelect a valid Backup!");
@@ -107,39 +149,100 @@ public void Restore(object sender, RoutedEventArgs e)
107149
//Get Backup Folders
108150
BackupFGet();
109151

152+
//Check Quest IP
153+
Boolean good = CheckIP();
154+
if(!good)
155+
{
156+
txtbox.AppendText("\n\nChoose a valid IP!");
157+
return;
158+
}
159+
110160
//Scores
111161
if ((bool)RScores.IsChecked == true)
112162
{
113-
txtbox.AppendText("\nPushing Scores");
163+
txtbox.AppendText("\n\nPushing Scores");
114164
adb("push \"" + Scores + "\\LocalDailyLeaderboards.dat\" /sdcard/Android/data/com.beatgames.beatsaber/files/LocalDailyLeaderboards.dat");
115165
adb("push \"" + Scores + "\\LocalLeaderboards.dat\" /sdcard/Android/data/com.beatgames.beatsaber/files/LocalLeaderboards.dat");
116166
adb("push \"" + Scores + "\\PlayerData.dat\" /sdcard/Android/data/com.beatgames.beatsaber/files/PlayerData.dat");
117167
txtbox.AppendText("\nPushed Scores");
168+
txtbox.ScrollToEnd();
118169
}
119170

120171
//Playlists
121172
if ((bool)RPlaylists.IsChecked)
122173
{
123174
PlaylistsR();
124175
PushPNG(Playlists + "\\Playlists");
176+
txtbox.ScrollToEnd();
177+
}
178+
179+
//Replays
180+
if ((bool)RReplays.IsChecked)
181+
{
182+
txtbox.AppendText("\n\nPushing Replays");
183+
adb("push \"" + BackupF + "//replays\" /sdcard/Android/data/com.beatgames.beatsaber/files/");
184+
txtbox.AppendText("\nFinished Pushing Replays");
185+
txtbox.ScrollToEnd();
186+
}
187+
188+
//Sounds
189+
if ((bool)RSounds.IsChecked)
190+
{
191+
txtbox.AppendText("\n\nPushing Sounds");
192+
adb("push \"" + BackupF + "//sounds\" /sdcard/Android/data/com.beatgames.beatsaber/files/");
193+
txtbox.AppendText("\nFinished Pushing Sounds");
194+
txtbox.ScrollToEnd();
125195
}
126196

127197
//Songs
128198
if ((bool)RSongs.IsChecked)
129199
{
130-
txtbox.AppendText("\nUploading Songs");
200+
txtbox.AppendText("\n\nUploading Songs");
131201
Upload(Songs);
132202
txtbox.AppendText("\nUploaded Songs");
203+
txtbox.ScrollToEnd();
133204
}
134205

135206
//Mods
136207
if ((bool)RMods.IsChecked)
137208
{
138-
txtbox.AppendText("\nUploading Mods");
209+
txtbox.AppendText("\n\nUploading Mods");
139210
Upload(Mods);
140211
txtbox.AppendText("\nUploaded Mods");
212+
txtbox.ScrollToEnd();
141213
}
142-
214+
215+
txtbox.AppendText("\n\n\nBMBF and Beat Saber has been restored with the selected components.");
216+
txtbox.ScrollToEnd();
217+
running = false;
218+
}
219+
220+
public Boolean CheckIP()
221+
{
222+
getQuestIP();
223+
if(IP == "Quest IP")
224+
{
225+
return false;
226+
}
227+
IP.Replace(":50000", "");
228+
IP.Replace(":5000", "");
229+
IP.Replace(":500", "");
230+
IP.Replace(":500", "");
231+
IP.Replace(":50", "");
232+
IP.Replace(":5", "");
233+
int count = 0;
234+
for(int i = 0; i < IP.Length; i++)
235+
{
236+
if(IP.Substring(i, 1) == ".")
237+
{
238+
count++;
239+
}
240+
}
241+
if(count != 3)
242+
{
243+
return false;
244+
}
245+
return true;
143246
}
144247

145248
public void PushPNG(String Path)
@@ -164,6 +267,7 @@ public void PlaylistsR()
164267
try
165268
{
166269
getQuestIP();
270+
167271

168272
String PlaylistsX;
169273

@@ -244,22 +348,39 @@ public void postChanges(String Config)
244348
client.UploadValues("http://" + IP + ":50000/host/beatsaber/commitconfig", "POST", client.QueryString);
245349
}
246350
}
351+
public void Sync()
352+
{
353+
System.Threading.Thread.Sleep(2000);
354+
using (WebClient client = new WebClient())
355+
{
356+
client.QueryString.Add("foo", "foo");
357+
client.UploadValues("http://" + IP + ":50000/host/beatsaber/commitconfig", "POST", client.QueryString);
358+
}
359+
}
247360

248361
public void Upload(String Path)
249362
{
250363
getQuestIP();
251364
String[] directories = Directory.GetFiles(Path);
252365

253366

254-
255367
for (int i = 0; i < directories.Length; i++)
256368
{
257369
WebClient client = new WebClient();
258-
259-
txtbox.AppendText("\nUploading " + directories[i] + " to BMBF");
260-
client.UploadFile("http://" + IP + ":50000/host/beatsaber/upload?overwrite", directories[i]);
261-
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
370+
371+
txtbox.AppendText("\n\nUploading " + directories[i] + " to BMBF");
372+
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate {
373+
client.UploadFile("http://" + IP + ":50000/host/beatsaber/upload?overwrite", directories[i]);
374+
}));
375+
376+
if (i%20 == 0 && i != 0)
377+
{
378+
txtbox.AppendText("\n\nSyncing to Beat Saber");
379+
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { }));
380+
Sync();
381+
}
262382
}
383+
Sync();
263384
}
264385

265386
public void BackupFGet()
@@ -761,7 +882,7 @@ public void adb(String Argument)
761882
{
762883
// Start the process with the info we specified.
763884
// Call WaitForExit and then the using statement will close.
764-
using (Process exeProcess = Process.Start(s))
885+
using (Process exeProcess = Process.Start(se))
765886
{
766887
exeProcess.WaitForExit();
767888
}
936 KB
Binary file not shown.
2 KB
Binary file not shown.

0 commit comments

Comments
 (0)