Esempio n. 1
0
 private void FiddlerApplication_AfterSessionComplete(Session oS)
 {
     if (oS.responseCode == 404 && oS.HostnameIs("cdn.wiiuusbhelper.com"))
     {
         string path     = oS.PathAndQuery;
         string fileName = Path.GetFileName(path);
         if (path.StartsWith("/res/emulators/") && !File.Exists(Path.Combine("\\emulators", fileName)))
         {
             string noExt = Path.GetFileNameWithoutExtension(fileName);
             EmulatorConfiguration.Emulator emulator;
             if (Enum.TryParse(noExt, out emulator))
             {
                 new Thread(() =>
                 {
                     // Get rid of the exception caused by not finding the file
                     int pid       = Program.GetHelperProcess().Id;
                     int lastCount = -1;
                     while (true)
                     {
                         int newCount = WinUtil.GetWindowCount(pid);
                         if (lastCount != -1 && lastCount != newCount)
                         {
                             break;
                         }
                         lastCount = newCount;
                         Thread.Sleep(30);
                     }
                     WinUtil.CloseWindow(WinUtil.GetForegroundWindow());
                     DialogResult result = MessageBox.Show("It appears you are trying to set-up a game with " + noExt + ", but it has not been downloaded yet.\nWould you like to download it?", "Emulator missing", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                     if (result == DialogResult.Yes)
                     {
                         EmulatorConfiguration config       = EmulatorConfiguration.GetConfiguration(emulator);
                         EmulatorConfigurationDialog dialog = new EmulatorConfigurationDialog(config);
                         Application.Run(dialog);
                     }
                 }).Start();
             }
         }
         else if (path == "/res/prerequisites/java.exe")
         {
             DialogResult result = MessageBox.Show("To download this game you need Java installed on your computer. Install now?\nCancel the download to prevent additional messages.", "Java required", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (result == DialogResult.Yes)
             {
                 Process.Start("https://www.java.com/en/download/");
             }
         }
     }
     else if (oS.HostnameIs("application.wiiuusbhelper.com") && oS.PathAndQuery == "/res/db/data.usb")
     {
         MessageBox.Show("You're using a legacy version of Wii U USB Helper.\nSupport for this version is limited which means some features may not work correctly.\nPlease update to a more recent version for better stability.", "Legacy version detected", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
     }
 }
Esempio n. 2
0
 private void FiddlerApplication_AfterSessionComplete(Session oS)
 {
     if (oS.responseCode == 404 && oS.HostnameIs("cdn.wiiuusbhelper.com"))
     {
         string path     = oS.PathAndQuery;
         string fileName = Path.GetFileName(path);
         if (path.StartsWith("/res/emulators/") && !File.Exists(Path.Combine("\\emulators", fileName)))
         {
             string noExt = Path.GetFileNameWithoutExtension(fileName);
             EmulatorConfiguration.Emulator emulator;
             if (Enum.TryParse(noExt, out emulator))
             {
                 new Thread(() =>
                 {
                     // Get rid of the exception caused by not finding the file
                     int pid       = Program.GetHelperProcess().Id;
                     int lastCount = -1;
                     while (true)
                     {
                         int newCount = WinUtil.GetWindowCount(pid);
                         if (lastCount != -1 && lastCount != newCount)
                         {
                             break;
                         }
                         lastCount = newCount;
                         Thread.Sleep(30);
                     }
                     WinUtil.CloseWindow(WinUtil.GetForegroundWindow());
                     DialogResult result = MessageBox.Show("It appears you are trying to set-up a game with " + noExt + ", but it has not been downloaded yet.\nWould you like to download it?", "Emulator missing", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                     if (result == DialogResult.Yes)
                     {
                         EmulatorConfiguration config       = EmulatorConfiguration.GetConfiguration(emulator);
                         EmulatorConfigurationDialog dialog = new EmulatorConfigurationDialog(config);
                         Application.Run(dialog);
                     }
                 }).Start();
             }
         }
     }
 }
Esempio n. 3
0
 private void FiddlerApplication_AfterSessionComplete(Session oS)
 {
     if (oS.responseBodyBytes.Length < Settings.SessionSizeLimit)
     {
         sessions.Add(oS);
     }
     if (oS.responseCode == 404 && oS.HostnameIs("cdn.wiiuusbhelper.com"))
     {
         string path     = oS.PathAndQuery;
         string fileName = Path.GetFileName(path);
         if (path.StartsWith("/res/emulators/") && !File.Exists(Path.Combine("\\emulators", fileName)))
         {
             string noExt = Path.GetFileNameWithoutExtension(fileName);
             if (Enum.TryParse(noExt, out EmulatorConfiguration.Emulator emulator))
             {
                 new Thread(() =>
                 {
                     // Get rid of the exception caused by not finding the file
                     int pid       = Program.GetHelperProcess().Id;
                     int lastCount = -1;
                     while (true)
                     {
                         int newCount = WinUtil.GetWindowCount(pid);
                         if (lastCount != -1 && lastCount != newCount)
                         {
                             break;
                         }
                         lastCount = newCount;
                         Thread.Sleep(30);
                     }
                     WinUtil.CloseWindow(WinUtil.GetForegroundWindow());
                     DialogResult result = MessageBox.Show("It appears you are trying to set-up a game with " + noExt + ", but it has not been downloaded yet.\nWould you like to download it?", "Emulator missing", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                     if (result == DialogResult.Yes)
                     {
                         EmulatorConfiguration config       = EmulatorConfiguration.GetConfiguration(emulator);
                         EmulatorConfigurationDialog dialog = new EmulatorConfigurationDialog(config);
                         Program.ShowChildDialog(dialog);
                     }
                 }).Start();
             }
         }
         else if (path == "/res/prerequisites/java.exe")
         {
             DialogResult result = MessageBox.Show("To download this game you need Java installed on your computer. Install now?\nCancel the download to prevent additional messages.", "Java required", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
             if (result == DialogResult.Yes)
             {
                 Process.Start("https://www.java.com/en/download/");
             }
         }
     }
     else if (oS.HostnameIs("application.wiiuusbhelper.com") && oS.PathAndQuery == "/res/db/data.usb")
     {
         MessageBox.Show("You're using a legacy version of Wii U USB Helper.\nSupport for this version is limited which means some features may not work correctly.\nPlease update to a more recent version for better stability.", "Legacy version detected", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
     }
     else if (oS.HostnameIs("cloud.wiiuusbhelper.com") && oS.PathAndQuery == "/saves/login.php" && Settings.ShowCloudWarning && !shownCloudWarning)
     {
         shownCloudWarning = true;
         var cloudWarning = new CheckboxDialog("The cloud save backup service is hosted by Willzor and is in no way affiliated to USBHelperLauncher. We cannot guarantee the continuity of these services and as such advise against relying on them.", "Do not show this again.", "Cloud service warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         new Thread(() => Program.ShowChildDialog(cloudWarning)).Start();
         Settings.ShowCloudWarning = !cloudWarning.Checked;
         Settings.Save();
     }
 }