Beispiel #1
0
        private async void Download()
        {
            if (DarkMessageBoxHelper.ShowOKCancel(string.Format(Properties.Resources.AboutToDownload, Header, InputGestureText), Properties.Resources.Warning, Properties.Resources.OK, Properties.Resources.Cancel) == MessageBoxResult.OK)
            {
                Stopwatch downloadTimer = Stopwatch.StartNew();
                StatusBarVm.statusBarViewModel.Set($"{Properties.Resources.Downloading} {Header}", Properties.Resources.Waiting);

                string path = $"{Properties.Settings.Default.OutputPath}//Backups//{Header}";
                using var client        = new HttpClientDownloadWithProgress(DownloadUrl, path);
                client.ProgressChanged += (totalFileSize, totalBytesDownloaded, progressPercentage) =>
                {
                    StatusBarVm.statusBarViewModel.Set($"{Properties.Resources.Downloading} {Header}   🠞   {progressPercentage}%", Properties.Resources.Waiting);
                };

                await client.StartDownload().ConfigureAwait(false);

                downloadTimer.Stop();
                if (new FileInfo(path).Length > 0)
                {
                    DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[CDN]", $"Downloaded {Header} in {downloadTimer.ElapsedMilliseconds} ms");
                    StatusBarVm.statusBarViewModel.Set(string.Format(Properties.Resources.DownloadSuccess, Header), Properties.Resources.Success);
                    Globals.gNotifier.ShowCustomMessage(Properties.Resources.Success, string.Format(Properties.Resources.DownloadSuccess, Header), "/FModel;component/Resources/check-circle.ico", path);
                }
                else
                {
                    File.Delete(path);
                    DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[CDN]", $"Error while downloading {Header}, spent {downloadTimer.ElapsedMilliseconds} ms");
                    StatusBarVm.statusBarViewModel.Set(string.Format(Properties.Resources.DownloadError, Header), Properties.Resources.Error);
                    Globals.gNotifier.ShowCustomMessage(Properties.Resources.Error, string.Format(Properties.Resources.DownloadError, Header), "/FModel;component/Resources/alert.ico");
                }
            }
        }
Beispiel #2
0
        private async Task SaveAndExit()
        {
            if (_useDiscordRpc && !Properties.Settings.Default.UseDiscordRpc) // previously enabled
            {
                DiscordIntegration.Deinitialize();
            }

            if (Properties.Settings.Default.AssetsLanguage != Languages_CbBox.SelectedIndex)
            {
                Properties.Settings.Default.AssetsLanguage = Languages_CbBox.SelectedIndex;
                await Localizations.SetLocalization(Properties.Settings.Default.AssetsLanguage, true).ConfigureAwait(false);
            }


            if (!_inputPath.Equals(Properties.Settings.Default.PakPath) ||
                !_outputPath.Equals(Properties.Settings.Default.OutputPath) ||
                _useEnglish != Properties.Settings.Default.UseEnglish)
            {
                DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information);
                DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Path(s) changed");

                Properties.Settings.Default.Save();
                Process.Start(Process.GetCurrentProcess().MainModule.FileName);
                Application.Current.Shutdown();
            }
            else
            {
                Properties.Settings.Default.Save();
                DebugHelper.WriteUserSettings();
                DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Window]", "Closing General Settings");
            }
        }
Beispiel #3
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            var fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "//ProjectPlatoV2");

            Directory.Delete(fileName, true);
            DarkMessageBoxHelper.DMB("Done!", "Config has been reset!");
        }
Beispiel #4
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     richTextBox1.Text  = "";
     richTextBox1.Text += "LOG: Starting...\n";
     if (Settings.Default.tatcvt != true)
     {
         // Convert
         Utilities.Convert(Pos, Pos, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.pickaxeoffset);
         Utilities.Convert(Mat, Mat1, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Mat added!";
         DarkMessageBoxHelper.DMB("Swapping Update", "Done swapping!");
         Settings.Default.tatcvt = true;
         Settings.Default.Save();
         pictureBox1.BackgroundImage = Resources.RevertButton;
     }
     else
     {
         // Revert
         Utilities.Revert(Pos, Pos, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.pickaxeoffset);
         Utilities.Revert(Mat, Mat1, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Mat removed!";
         DarkMessageBoxHelper.DMB("Swapping Update", "Done swapping!");
         Settings.Default.tatcvt = false;
         Settings.Default.Save();
         pictureBox1.BackgroundImage = Resources.ConvertButton;
     }
 }
Beispiel #5
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     richTextBox1.Text  = "";
     richTextBox1.Text += "LOG: Starting...\n";
     if (Settings.Default.hazardcvt != true)
     {
         // Convert
         Utilities.Convert(Pos, Pos, Settings.Default.pakPath + "\\pakchunk10-WindowsClient.ucas", Settings.Default.backblinginvalidoffset);
         Utilities.Convert(Mat, Mat1, Settings.Default.pakPath + "\\pakchunk10-WindowsClient.ucas", Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Mat added!\n";
         DarkMessageBoxHelper.DMB("Swapping Update", "Done swapping!");
         Settings.Default.hazardcvt = true;
         Settings.Default.Save();
         pictureBox1.BackgroundImage = Resources.RevertButton;
     }
     else
     {
         // Revert
         Utilities.Revert(Pos, Pos, Settings.Default.pakPath + "\\pakchunk10-WindowsClient.ucas", Settings.Default.backblinginvalidoffset);
         Utilities.Revert(Mat, Mat1, Settings.Default.pakPath + "\\pakchunk10-WindowsClient.ucas", Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Mat removed!\n";
         DarkMessageBoxHelper.DMB("Swapping Update", "Done swapping!");
         Settings.Default.hazardcvt = false;
         Settings.Default.Save();
         pictureBox1.BackgroundImage = Resources.ConvertButton;
     }
 }
Beispiel #6
0
 private void OnDeleteSettings(object sender, RoutedEventArgs e)
 {
     Properties.Settings.Delete();
     DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information);
     DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Settings reset");
     Process.Start(Process.GetCurrentProcess().MainModule.FileName);
     Application.Current.Shutdown();
 }
Beispiel #7
0
        private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            string errorMessage = string.Format(FModel.Properties.Resources.UnhandledExceptionOccured, e.Exception.Message);

            DebugHelper.WriteException(e.Exception, "thrown in App.xaml.cs by OnDispatcherUnhandledException");
            DarkMessageBoxHelper.Show(errorMessage, FModel.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
            e.Handled = true;
        }
Beispiel #8
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     if (Settings.Default.paid == true)
     {
         TheOG popup = new TheOG();
         popup.Show();
     }
     else
     {
         DarkMessageBoxHelper.DMB("ERROR", "This skin is paid only at the moment, come back next update!");
     }
 }
Beispiel #9
0
        private static void CheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    MessageBoxResult dialogResult = DarkMessageBoxHelper.ShowYesNoCancel(
                        string.Format(Properties.Resources.UpdateAvailableConfirm, args.CurrentVersion, args.InstalledVersion),
                        Properties.Resources.UpdateAvailable,
                        Properties.Resources.YesShowChangelog, // Yes
                        Properties.Resources.MaybeLater,       // No
                        Properties.Resources.SkipThisVersion); // Cancel

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        Process.Start(new ProcessStartInfo {
                            FileName = args.ChangelogURL, UseShellExecute = true
                        });
                    }
                    // what i forgot: checking installed version to compare with saved version to skip
                    //if (dialogResult == MessageBoxResult.Cancel)
                    //{
                    //    Properties.Settings.Default.SkipVersion = true;
                    //    Properties.Settings.Default.Save();
                    //}

                    if (dialogResult == MessageBoxResult.Yes || dialogResult == MessageBoxResult.OK)
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                Application.Current.Shutdown();
                            }
                        }
                        catch (Exception exception)
                        {
                            DarkMessageBoxHelper.ShowOK(exception.Message, exception.GetType().ToString(), Properties.Resources.OK, MessageBoxImage.Error);
                        }
                    }
                }
            }
            else
            {
                DarkMessageBoxHelper.ShowOK(
                    Properties.Resources.UpdateReachServerProblem,
                    Properties.Resources.UpdateCheckFailed,
                    Properties.Resources.OK,
                    MessageBoxImage.Error);
            }
        }
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     richTextBox1.Text  = "";
     richTextBox1.Text += "LOG: Starting...\n";
     if (Settings.Default.renegadeblazecvt != true)
     {
         // Convert
         Utilities.Convert(Pos, Pos, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.femaleskinsoffset);
         Utilities.Convert(Mat, Mat1, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Mat added!\n";
         Utilities.Convert(FX, FX1, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: FX added!\n";
         Utilities.Convert(GPos, GPos, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.femalegenderoffset);
         Utilities.Convert(Gender, Gender1, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Gender added!\n";
         Utilities.Convert(HPos, HPos, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.femaleheadsoffset);
         Utilities.Convert(HMat, HMat1, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Head added!\n";
         Utilities.Convert(HatPos, HatPos, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.femaleheadsoffset);
         Utilities.Convert(HatMat, HatMat1, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Hat added!\n";
         DarkMessageBoxHelper.DMB("Swapping Update", "Done swapping!");
         Settings.Default.renegadeblazecvt = true;
         Settings.Default.Save();
         pictureBox1.BackgroundImage = Resources.RevertButton;
     }
     else
     {
         // Revert
         Utilities.Revert(Pos, Pos, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.femaleskinsoffset);
         Utilities.Revert(Mat, Mat1, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Mat removed!\n";
         Utilities.Revert(FX, FX1, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: FX removed!\n";
         Utilities.Revert(GPos, GPos, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.femalegenderoffset);
         Utilities.Revert(Gender, Gender1, Settings.Default.pakPath + Settings.Default.bodypak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Gender removed!\n";
         Utilities.Revert(HPos, HPos, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.femaleheadsoffset);
         Utilities.Revert(HMat, HMat1, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Head removed!\n";
         Utilities.Revert(HatPos, HatPos, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.femaleheadsoffset);
         Utilities.Revert(HatMat, HatMat1, Settings.Default.pakPath + Settings.Default.headpak, Settings.Default.current_offset);
         richTextBox1.Text += "LOG: Hat removed!\n";
         DarkMessageBoxHelper.DMB("Swapping Update", "Done swapping!");
         Settings.Default.renegadeblazecvt = false;
         Settings.Default.Save();
         pictureBox1.BackgroundImage = Resources.ConvertButton;
     }
 }
Beispiel #11
0
 public static void CreateDirectoryFromDirectoryPath(string directoryPath)
 {
     if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
     {
         try
         {
             Directory.CreateDirectory(directoryPath);
         }
         catch (Exception e)
         {
             DebugHelper.WriteException(e);
             DarkMessageBoxHelper.Show(Properties.Resources.CouldNotCreateDirectory + "\r\n\r\n" + e, "FModel - " + Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
Beispiel #12
0
        private void FModel_MI_Settings_ChangeGame_Click(object sender, RoutedEventArgs e)
        {
            var launcher = new FLauncher();

            if ((bool)launcher.ShowDialog())
            {
                Properties.Settings.Default.PakPath = launcher.Path;

                DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information);
                DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Path(s) changed");

                Properties.Settings.Default.Save();
                Process.Start(Process.GetCurrentProcess().MainModule.FileName);
                Application.Current.Shutdown();
            }
        }
Beispiel #13
0
        private static void CheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args != null)
            {
                if (args.IsUpdateAvailable)
                {
                    MessageBoxResult dialogResult = DarkMessageBoxHelper.ShowYesNoCancel(
                        string.Format(Properties.Resources.UpdateAvailableConfirm, args.CurrentVersion, args.InstalledVersion),
                        Properties.Resources.UpdateAvailable,
                        Properties.Resources.YesShowChangelog,
                        Properties.Resources.Yes,
                        Properties.Resources.No);

                    if (dialogResult == MessageBoxResult.Yes)
                    {
                        new ProcessStartInfo {
                            FileName = args.ChangelogURL, UseShellExecute = true
                        }
                    }
                    ;

                    if (dialogResult == MessageBoxResult.Yes || dialogResult == MessageBoxResult.No || dialogResult == MessageBoxResult.OK)
                    {
                        try
                        {
                            if (AutoUpdater.DownloadUpdate(args))
                            {
                                Application.Current.Shutdown();
                            }
                        }
                        catch (Exception exception)
                        {
                            DarkMessageBoxHelper.ShowOK(exception.Message, exception.GetType().ToString(), Properties.Resources.OK, MessageBoxImage.Error);
                        }
                    }
                }
            }
            else
            {
                DarkMessageBoxHelper.ShowOK(
                    Properties.Resources.UpdateReachServerProblem,
                    Properties.Resources.UpdateCheckFailed,
                    Properties.Resources.OK,
                    MessageBoxImage.Error);
            }
        }
    }
Beispiel #14
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            Settings.Default.KeyClicked = false;
            if (PassKey.Text == Settings.Default.key)
            {
                Home popup = new Home();
                popup.Show();

                if (Settings.Default.paid == true)
                {
                    DarkMessageBoxHelper.DMB("Success", "Successfully logged in as paid user. Have fun swapping!");
                }
                else
                {
                    DarkMessageBoxHelper.DMB("Success", "Successfully logged in as free user. Have fun swapping!");
                }
                Close();
            }
            else
            {
                DarkMessageBoxHelper.DMB("ERROR", "Entered key is incorrect, try again!");
            }
        }
Beispiel #15
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Backblings", "This backbling swaps molten battle shroud");
 }
Beispiel #16
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Backblings", "This backbling swaps cuddlepool's bow");
 }
Beispiel #17
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Backblings", "This backbling swaps frozen iron cage");
 }
Beispiel #18
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Pickaxe", "This pickaxe swaps frozen heart");
 }
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Skins", "This skin swaps blaze");
 }
Beispiel #20
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Pickaxe", "This pickaxe swaps stark splitter");
 }
Beispiel #21
0
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Gliders", "This glider swaps cruiser");
 }
Beispiel #22
0
 private void bunifuImageButton2_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("ERROR", "This item is currently disabled!");
 }
Beispiel #23
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     DarkMessageBoxHelper.DMB("Tamely#9111", "Tamely made this swapper, hope you enjoy it!");
 }