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

Commit f700d59

Browse files
Add files via upload
1 parent 2c2007f commit f700d59

3 files changed

Lines changed: 166 additions & 81 deletions

File tree

C#/MainWindow.xaml.cs

Lines changed: 166 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ public partial class MainWindow : Window
2727
{
2828
int MajorV = 1;
2929
int MinorV = 0;
30-
int PatchV = 0;
30+
int PatchV = 1;
3131
Boolean Preview = false;
3232

33-
String IP = "192.168.2.103";
3433
Boolean draggable = true;
3534
String path = "";
3635
String exe = System.Reflection.Assembly.GetEntryAssembly().Location;
@@ -99,24 +98,7 @@ private void Choose(object sender, RoutedEventArgs e)
9998
if (fd.ShowDialog() == CommonFileDialogResult.Ok)
10099
{
101100
path = fd.FileName;
102-
test();
103-
//replace();
104-
}
105-
}
106-
107-
private void test()
108-
{
109-
WebClient client = new WebClient();
110-
client.UploadFile("http://" + IP + ":50000/host/beatsaber/upload?overwrite", path);
111-
txtbox.AppendText("finished");
112-
}
113-
114-
public void postChanges(String Config)
115-
{
116-
using (WebClient client = new WebClient())
117-
{
118-
client.QueryString.Add("foo", "foo");
119-
client.UploadValues("http://" + IP + ":50000/host/beatsaber/commitconfig", "POST", client.QueryString);
101+
replace();
120102
}
121103
}
122104

@@ -126,6 +108,7 @@ private void replace()
126108
int end = 0;
127109
String f = "";
128110
Boolean fail = true;
111+
Boolean old = true;
129112

130113
end = path.LastIndexOf("\\");
131114
f = path.Substring(end + 1, path.Length - end - 4);
@@ -146,102 +129,204 @@ private void replace()
146129
{
147130
continue;
148131
}
149-
150-
//delete old qsaber
151-
152-
String User = System.Environment.GetEnvironmentVariable("USERPROFILE");
153-
ProcessStartInfo s = new ProcessStartInfo();
154-
s.CreateNoWindow = false;
155-
s.UseShellExecute = false;
156-
s.FileName = "adb.exe";
157-
s.WindowStyle = ProcessWindowStyle.Minimized;
158-
s.Arguments = "shell rm -f /sdcard/Android/data/com.beatgames.beatsaber/files/sabers/testSaber.qsaber";
159-
try
132+
if(directories[i].EndsWith("bmbfmod.json"))
160133
{
161-
// Start the process with the info we specified.
162-
// Call WaitForExit and then the using statement will close.
163-
using (Process exeProcess = Process.Start(s))
134+
StreamReader reader = new StreamReader(directories[i]);
135+
String line;
136+
while ((line = reader.ReadLine()) != null)
164137
{
165-
exeProcess.WaitForExit();
166-
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + ".qsaber.");
167-
fail = false;
138+
if(line.Contains("1.11.1"))
139+
{
140+
old = false;
141+
}
168142
}
169143
}
170-
catch
171-
{
172144

173-
ProcessStartInfo se = new ProcessStartInfo();
174-
se.CreateNoWindow = false;
175-
se.UseShellExecute = false;
176-
se.FileName = User + "\\AppData\\Roaming\\SideQuest\\platform-tools\\adb.exe";
177-
se.WindowStyle = ProcessWindowStyle.Minimized;
178-
se.Arguments = "shell rm -f /sdcard/Android/data/com.beatgames.beatsaber/files/sabers/testSaber.qsaber";
145+
//delete old qsaber
146+
if (!old)
147+
{
148+
String User = System.Environment.GetEnvironmentVariable("USERPROFILE");
149+
ProcessStartInfo s = new ProcessStartInfo();
150+
s.CreateNoWindow = false;
151+
s.UseShellExecute = false;
152+
s.FileName = "adb.exe";
153+
s.WindowStyle = ProcessWindowStyle.Minimized;
154+
s.Arguments = "shell rm -f /sdcard/Android/data/com.beatgames.beatsaber/files/sabers/testSaber.qsaber";
179155
try
180156
{
181157
// Start the process with the info we specified.
182158
// Call WaitForExit and then the using statement will close.
183159
using (Process exeProcess = Process.Start(s))
184160
{
185161
exeProcess.WaitForExit();
186-
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + ".qsaber.");
187-
fail = false;
188162
}
189163
}
190164
catch
191165
{
192-
// Log error.
193-
txtbox.AppendText("\n\n\nAn Error Occured. Check following");
194-
txtbox.AppendText("\n\n- Your Quest is connected and USB Debugging enabled.");
195-
txtbox.AppendText("\n\n- You have adb installed.");
166+
167+
ProcessStartInfo se = new ProcessStartInfo();
168+
se.CreateNoWindow = false;
169+
se.UseShellExecute = false;
170+
se.FileName = User + "\\AppData\\Roaming\\SideQuest\\platform-tools\\adb.exe";
171+
se.WindowStyle = ProcessWindowStyle.Minimized;
172+
se.Arguments = "shell rm -f /sdcard/Android/data/com.beatgames.beatsaber/files/sabers/testSaber.qsaber";
173+
try
174+
{
175+
// Start the process with the info we specified.
176+
// Call WaitForExit and then the using statement will close.
177+
using (Process exeProcess = Process.Start(s))
178+
{
179+
exeProcess.WaitForExit();
180+
}
181+
}
182+
catch
183+
{
184+
// Log error.
185+
txtbox.AppendText("\n\n\nAn Error Occured. Check following");
186+
txtbox.AppendText("\n\n- Your Quest is connected and USB Debugging enabled.");
187+
txtbox.AppendText("\n\n- You have adb installed.");
188+
}
189+
196190
}
197191

198-
}
192+
ProcessStartInfo sm = new ProcessStartInfo();
193+
sm.CreateNoWindow = false;
194+
sm.UseShellExecute = false;
195+
sm.FileName = "adb.exe";
196+
sm.WindowStyle = ProcessWindowStyle.Minimized;
197+
sm.Arguments = "push \"" + directories[i] + "\" /sdcard/Qosmetics/sabers/testSaber.qsaber";
198+
try
199+
{
200+
// Start the process with the info we specified.
201+
// Call WaitForExit and then the using statement will close.
202+
using (Process exeProcess = Process.Start(sm))
203+
{
204+
exeProcess.WaitForExit();
205+
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + "qsaber.");
206+
fail = false;
207+
}
208+
}
209+
catch
210+
{
199211

200-
ProcessStartInfo sm = new ProcessStartInfo();
201-
sm.CreateNoWindow = false;
202-
sm.UseShellExecute = false;
203-
sm.FileName = "adb.exe";
204-
sm.WindowStyle = ProcessWindowStyle.Minimized;
205-
sm.Arguments = "push \"" + directories[i] + "\" /sdcard/Qosmetics/sabers/testSaber.qsaber";
206-
try
212+
ProcessStartInfo sme = new ProcessStartInfo();
213+
sme.CreateNoWindow = false;
214+
sme.UseShellExecute = false;
215+
sme.FileName = User + "\\AppData\\Roaming\\SideQuest\\platform-tools\\adb.exe";
216+
sme.WindowStyle = ProcessWindowStyle.Minimized;
217+
sme.Arguments = "push \"" + directories[i] + "\" /sdcard/Qosmetics/sabers/testSaber.qsaber";
218+
try
219+
{
220+
// Start the process with the info we specified.
221+
// Call WaitForExit and then the using statement will close.
222+
using (Process exeProcess = Process.Start(sme))
223+
{
224+
exeProcess.WaitForExit();
225+
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + "qsaber.");
226+
fail = false;
227+
}
228+
}
229+
catch
230+
{
231+
// Log error.
232+
txtbox.AppendText("\n\n\nAn Error Occured. Check following");
233+
txtbox.AppendText("\n\n- Your Quest is connected and USB Debugging enabled.");
234+
txtbox.AppendText("\n\n- You have adb installed.");
235+
}
236+
237+
}
238+
} else
207239
{
208-
// Start the process with the info we specified.
209-
// Call WaitForExit and then the using statement will close.
210-
using (Process exeProcess = Process.Start(sm))
240+
String User = System.Environment.GetEnvironmentVariable("USERPROFILE");
241+
ProcessStartInfo s = new ProcessStartInfo();
242+
s.CreateNoWindow = false;
243+
s.UseShellExecute = false;
244+
s.FileName = "adb.exe";
245+
s.WindowStyle = ProcessWindowStyle.Minimized;
246+
s.Arguments = "shell rm -f /sdcard/Qosmetics/sabers/testSaber.qsaber";
247+
try
211248
{
212-
exeProcess.WaitForExit();
213-
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + ".qsaber.");
214-
fail = false;
249+
// Start the process with the info we specified.
250+
// Call WaitForExit and then the using statement will close.
251+
using (Process exeProcess = Process.Start(s))
252+
{
253+
exeProcess.WaitForExit();
254+
}
255+
}
256+
catch
257+
{
258+
259+
ProcessStartInfo se = new ProcessStartInfo();
260+
se.CreateNoWindow = false;
261+
se.UseShellExecute = false;
262+
se.FileName = User + "\\AppData\\Roaming\\SideQuest\\platform-tools\\adb.exe";
263+
se.WindowStyle = ProcessWindowStyle.Minimized;
264+
se.Arguments = "shell rm -f /sdcard/Qosmetics/sabers/testSaber.qsaber";
265+
try
266+
{
267+
// Start the process with the info we specified.
268+
// Call WaitForExit and then the using statement will close.
269+
using (Process exeProcess = Process.Start(s))
270+
{
271+
exeProcess.WaitForExit();
272+
}
273+
}
274+
catch
275+
{
276+
// Log error.
277+
txtbox.AppendText("\n\n\nAn Error Occured. Check following");
278+
txtbox.AppendText("\n\n- Your Quest is connected and USB Debugging enabled.");
279+
txtbox.AppendText("\n\n- You have adb installed.");
280+
}
281+
215282
}
216-
}
217-
catch
218-
{
219283

220-
ProcessStartInfo sme = new ProcessStartInfo();
221-
sme.CreateNoWindow = false;
222-
sme.UseShellExecute = false;
223-
sme.FileName = User + "\\AppData\\Roaming\\SideQuest\\platform-tools\\adb.exe";
224-
sme.WindowStyle = ProcessWindowStyle.Minimized;
225-
sme.Arguments = "push \"" + directories[i] + "\" /sdcard/Qosmetics/sabers/testSaber.qsaber";
284+
ProcessStartInfo sm = new ProcessStartInfo();
285+
sm.CreateNoWindow = false;
286+
sm.UseShellExecute = false;
287+
sm.FileName = "adb.exe";
288+
sm.WindowStyle = ProcessWindowStyle.Minimized;
289+
sm.Arguments = "push \"" + directories[i] + "\" /sdcard/Android/data/com.beatgames.beatsaber/files/sabers/testSaber.qsaber";
226290
try
227291
{
228292
// Start the process with the info we specified.
229293
// Call WaitForExit and then the using statement will close.
230-
using (Process exeProcess = Process.Start(sme))
294+
using (Process exeProcess = Process.Start(sm))
231295
{
232296
exeProcess.WaitForExit();
233-
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + ".qsaber.");
297+
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + "qsaber.");
234298
fail = false;
235299
}
236300
}
237301
catch
238302
{
239-
// Log error.
240-
txtbox.AppendText("\n\n\nAn Error Occured. Check following");
241-
txtbox.AppendText("\n\n- Your Quest is connected and USB Debugging enabled.");
242-
txtbox.AppendText("\n\n- You have adb installed.");
243-
}
244303

304+
ProcessStartInfo sme = new ProcessStartInfo();
305+
sme.CreateNoWindow = false;
306+
sme.UseShellExecute = false;
307+
sme.FileName = User + "\\AppData\\Roaming\\SideQuest\\platform-tools\\adb.exe";
308+
sme.WindowStyle = ProcessWindowStyle.Minimized;
309+
sme.Arguments = "push \"" + directories[i] + "\" /sdcard/Android/data/com.beatgames.beatsaber/files/sabers/testSaber.qsaber";
310+
try
311+
{
312+
// Start the process with the info we specified.
313+
// Call WaitForExit and then the using statement will close.
314+
using (Process exeProcess = Process.Start(sme))
315+
{
316+
exeProcess.WaitForExit();
317+
txtbox.AppendText("\n\nReplaced Current QSaber with " + f + "qsaber.");
318+
fail = false;
319+
}
320+
}
321+
catch
322+
{
323+
// Log error.
324+
txtbox.AppendText("\n\n\nAn Error Occured. Check following");
325+
txtbox.AppendText("\n\n- Your Quest is connected and USB Debugging enabled.");
326+
txtbox.AppendText("\n\n- You have adb installed.");
327+
}
328+
329+
}
245330
}
246331
}
247332

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)