@@ -31,13 +31,13 @@ public partial class MainWindow : Window
3131
3232 int MajorV = 1 ;
3333 int MinorV = 1 ;
34- int PatchV = 3 ;
34+ int PatchV = 4 ;
3535 Boolean Preview = false ;
3636
3737 String IP = "" ;
3838 Boolean draggable = true ;
3939 Boolean running = false ;
40- String exe = System . Reflection . Assembly . GetEntryAssembly ( ) . Location ;
40+ String exe = AppDomain . CurrentDomain . BaseDirectory . Substring ( 0 , AppDomain . CurrentDomain . BaseDirectory . Length - 1 ) ;
4141 String Songs = "" ;
4242 String Playlists = "" ;
4343 String Mods = "" ;
@@ -68,6 +68,7 @@ public MainWindow()
6868 }
6969 getBackups ( ) ;
7070 Update ( ) ;
71+ QuestIP ( ) ;
7172
7273 RSongs . IsChecked = true ;
7374 RPlaylists . IsChecked = true ;
@@ -118,8 +119,8 @@ public void Backup(object sender, RoutedEventArgs e)
118119
119120 //Songs
120121
121- // QSE(); Isn't used anymore but I keep it in in case I needed it.
122- adb ( "pull /sdcard/BMBFData/CustomSongs \" " + BackupF + "\" " ) ;
122+ QSE ( ) ;
123+ // adb("pull /sdcard/BMBFData/CustomSongs \"" + BackupF + "\"");
123124
124125 //Playlists
125126
@@ -196,14 +197,6 @@ public void Restore(object sender, RoutedEventArgs e)
196197 txtbox . ScrollToEnd ( ) ;
197198 }
198199
199- //Playlists
200- if ( ( bool ) RPlaylists . IsChecked )
201- {
202- PlaylistsR ( ) ;
203- PushPNG ( Playlists + "\\ Playlists" ) ;
204- txtbox . ScrollToEnd ( ) ;
205- }
206-
207200 //Replays
208201 if ( ( bool ) RReplays . IsChecked )
209202 {
@@ -239,6 +232,14 @@ public void Restore(object sender, RoutedEventArgs e)
239232 txtbox . ScrollToEnd ( ) ;
240233 }
241234
235+ //Playlists
236+ if ( ( bool ) RPlaylists . IsChecked )
237+ {
238+ PlaylistsR ( ) ;
239+ PushPNG ( Playlists + "\\ Playlists" ) ;
240+ txtbox . ScrollToEnd ( ) ;
241+ }
242+
242243 //Mods
243244 if ( ( bool ) RMods . IsChecked )
244245 {
@@ -261,6 +262,94 @@ public void Restore(object sender, RoutedEventArgs e)
261262 running = false ;
262263 }
263264
265+ public String adbS ( String Argument )
266+ {
267+ String User = System . Environment . GetEnvironmentVariable ( "USERPROFILE" ) ;
268+ ProcessStartInfo s = new ProcessStartInfo ( ) ;
269+ s . CreateNoWindow = false ;
270+ s . UseShellExecute = false ;
271+ s . FileName = "adb.exe" ;
272+ s . WindowStyle = ProcessWindowStyle . Minimized ;
273+ s . RedirectStandardOutput = true ;
274+ s . Arguments = Argument ;
275+ try
276+ {
277+ // Start the process with the info we specified.
278+ // Call WaitForExit and then the using statement will close.
279+ using ( Process exeProcess = Process . Start ( s ) )
280+ {
281+ String IPS = exeProcess . StandardOutput . ReadToEnd ( ) ;
282+ exeProcess . WaitForExit ( ) ;
283+ return IPS ;
284+ }
285+ }
286+ catch
287+ {
288+
289+ ProcessStartInfo se = new ProcessStartInfo ( ) ;
290+ se . CreateNoWindow = false ;
291+ se . UseShellExecute = false ;
292+ se . FileName = User + "\\ AppData\\ Roaming\\ SideQuest\\ platform-tools\\ adb.exe" ;
293+ se . WindowStyle = ProcessWindowStyle . Minimized ;
294+ se . RedirectStandardOutput = true ;
295+ se . Arguments = Argument ;
296+ try
297+ {
298+ // Start the process with the info we specified.
299+ // Call WaitForExit and then the using statement will close.
300+ using ( Process exeProcess = Process . Start ( se ) )
301+ {
302+ String IPS = exeProcess . StandardOutput . ReadToEnd ( ) ;
303+ exeProcess . WaitForExit ( ) ;
304+ return IPS ;
305+
306+ }
307+ }
308+ catch
309+ {
310+ // Log error.
311+ txtbox . AppendText ( "\n \n \n An error Occured (Code: ADB100). Check following" ) ;
312+ txtbox . AppendText ( "\n \n - Your Quest is connected and USB Debugging enabled." ) ;
313+ txtbox . AppendText ( "\n \n - You have adb installed." ) ;
314+ }
315+ }
316+ return "" ;
317+ }
318+
319+ public void QuestIP ( )
320+ {
321+ String IPS = adbS ( "shell ifconfig wlan0" ) ;
322+ int Index = IPS . IndexOf ( "inet addr:" ) ;
323+ Boolean space = false ;
324+ String FIP = "" ;
325+ for ( int i = 0 ; i < IPS . Length ; i ++ )
326+ {
327+ if ( i > ( Index + 9 ) && i < ( Index + 9 + 16 ) )
328+ {
329+ if ( IPS . Substring ( i , 1 ) == " " )
330+ {
331+ space = true ;
332+ }
333+ if ( ! space )
334+ {
335+ FIP = FIP + IPS . Substring ( i , 1 ) ;
336+ }
337+ }
338+ }
339+
340+ if ( FIP == "" )
341+ {
342+ return ;
343+ }
344+ IP = FIP ;
345+ Quest . Text = FIP ;
346+ if ( IP == "" )
347+ {
348+ Quest . Text = "Quest IP" ;
349+ }
350+
351+ }
352+
264353 public void StartBMBF ( )
265354 {
266355 Application . Current . Dispatcher . Invoke ( DispatcherPriority . Background , new Action ( delegate
@@ -637,13 +726,11 @@ public void PlaylistB()
637726 getBackups ( ) ;
638727 }
639728
640- /* Isn't used anymore
641729 public void QSE ( )
642730 {
643731 ArrayList list = new ArrayList ( ) ;
644732 ArrayList content = new ArrayList ( ) ;
645733 ArrayList over = new ArrayList ( ) ;
646- int overwritten = 0;
647734 int exported = 0 ;
648735 String Name = "" ;
649736 String Source = "" ;
@@ -767,7 +854,6 @@ public void QSE()
767854 }
768855 txtbox . ScrollToEnd ( ) ;
769856 }
770- */
771857
772858 public static void zip ( String src , String Output )
773859 {
0 commit comments