diff --git a/ModAssistant/App.xaml.cs b/ModAssistant/App.xaml.cs index ff62c33..be761c1 100644 --- a/ModAssistant/App.xaml.cs +++ b/ModAssistant/App.xaml.cs @@ -31,7 +31,7 @@ namespace ModAssistant private async void Application_Startup(object sender, StartupEventArgs e) { // Set SecurityProtocol to prevent crash with TLS - System.Net.ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; + ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; if (ModAssistant.Properties.Settings.Default.UpgradeRequired) { @@ -52,14 +52,14 @@ namespace ModAssistant Languages.LoadLanguages(); - while (string.IsNullOrEmpty(App.BeatSaberInstallDirectory)) + while (string.IsNullOrEmpty(BeatSaberInstallDirectory)) { string title = (string)Current.FindResource("App:InstallDirDialog:Title"); string body = (string)Current.FindResource("App:InstallDirDialog:OkCancel"); if (System.Windows.Forms.MessageBox.Show(body, title, System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK) { - App.BeatSaberInstallDirectory = Utils.GetManualDir(); + BeatSaberInstallDirectory = Utils.GetManualDir(); } else { @@ -224,7 +224,7 @@ namespace ModAssistant MessageBox.Show($"{body}: {e.Exception}", title, MessageBoxButton.OK, MessageBoxImage.Warning); e.Handled = true; - Application.Current.Shutdown(); + Current.Shutdown(); } } } diff --git a/ModAssistant/Classes/External Interfaces/BeatSaver.cs b/ModAssistant/Classes/External Interfaces/BeatSaver.cs index 38881d7..44a2dca 100644 --- a/ModAssistant/Classes/External Interfaces/BeatSaver.cs +++ b/ModAssistant/Classes/External Interfaces/BeatSaver.cs @@ -218,9 +218,9 @@ namespace ModAssistant.API public static DateTime UnixTimestampToDateTime(double unixTime) { - DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); + DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); long unixTimeStampInTicks = (long)(unixTime * TimeSpan.TicksPerSecond); - return new DateTime(unixStart.Ticks + unixTimeStampInTicks, System.DateTimeKind.Utc); + return new DateTime(unixStart.Ticks + unixTimeStampInTicks, DateTimeKind.Utc); } public static async Task Download(string url, string output, int retries = 3) diff --git a/ModAssistant/Classes/Themes.cs b/ModAssistant/Classes/Themes.cs index 04824dc..c06940c 100644 --- a/ModAssistant/Classes/Themes.cs +++ b/ModAssistant/Classes/Themes.cs @@ -112,22 +112,22 @@ namespace ModAssistant { try { - Themes.ApplyWindowsTheme(); + ApplyWindowsTheme(); } catch { - Themes.ApplyTheme("Light", false); + ApplyTheme("Light", false); } return; } try { - Themes.ApplyTheme(savedTheme, false); + ApplyTheme(savedTheme, false); } catch (ArgumentException) { - Themes.ApplyWindowsTheme(); + ApplyWindowsTheme(); MainWindow.Instance.MainText = (string)Application.Current.FindResource("Themes:ThemeNotFound"); } } diff --git a/ModAssistant/Classes/Utils.cs b/ModAssistant/Classes/Utils.cs index 9a75cff..85a0d21 100644 --- a/ModAssistant/Classes/Utils.cs +++ b/ModAssistant/Classes/Utils.cs @@ -245,7 +245,7 @@ namespace ModAssistant int index = Encoding.UTF8.GetString(file).IndexOf("public.app-category.games") + 136; Array.Copy(file, index, bytes, 0, 32); - string version = Encoding.UTF8.GetString(bytes).Trim(Utils.Constants.IllegalCharacters); + string version = Encoding.UTF8.GetString(bytes).Trim(Constants.IllegalCharacters); return version; } @@ -392,7 +392,7 @@ namespace ModAssistant { try { - System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo() + Process.Start(new System.Diagnostics.ProcessStartInfo() { FileName = location, UseShellExecute = true, @@ -462,7 +462,7 @@ namespace ModAssistant // want to suppress exceptions for non-clipboard operations if (success) { - Utils.SendNotify($"Copied text to clipboard"); + SendNotify($"Copied text to clipboard"); } } } diff --git a/ModAssistant/MainWindow.xaml.cs b/ModAssistant/MainWindow.xaml.cs index 47aa4db..dc40d95 100644 --- a/ModAssistant/MainWindow.xaml.cs +++ b/ModAssistant/MainWindow.xaml.cs @@ -30,7 +30,7 @@ namespace ModAssistant } set { - Dispatcher.Invoke(new Action(() => { MainWindow.Instance.MainTextBlock.Text = value; })); + Dispatcher.Invoke(new Action(() => { Instance.MainTextBlock.Text = value; })); } } @@ -54,11 +54,11 @@ namespace ModAssistant if (Utils.IsVoid()) { Main.Content = Invalid.Instance; - MainWindow.Instance.ModsButton.IsEnabled = false; - MainWindow.Instance.OptionsButton.IsEnabled = false; - MainWindow.Instance.IntroButton.IsEnabled = false; - MainWindow.Instance.AboutButton.IsEnabled = false; - MainWindow.Instance.GameVersionsBox.IsEnabled = false; + Instance.ModsButton.IsEnabled = false; + Instance.OptionsButton.IsEnabled = false; + Instance.IntroButton.IsEnabled = false; + Instance.AboutButton.IsEnabled = false; + Instance.GameVersionsBox.IsEnabled = false; return; } @@ -139,7 +139,7 @@ namespace ModAssistant if (!string.IsNullOrEmpty(GameVersion) && Properties.Settings.Default.Agreed) { - MainWindow.Instance.ModsButton.IsEnabled = true; + Instance.ModsButton.IsEnabled = true; } }); diff --git a/ModAssistant/OneClickStatus.xaml.cs b/ModAssistant/OneClickStatus.xaml.cs index 8312ed5..78badfd 100644 --- a/ModAssistant/OneClickStatus.xaml.cs +++ b/ModAssistant/OneClickStatus.xaml.cs @@ -19,7 +19,7 @@ namespace ModAssistant } set { - Dispatcher.Invoke(new Action(() => { OneClickStatus.Instance.HistoryTextBlock.Text = value; })); + Dispatcher.Invoke(new Action(() => { Instance.HistoryTextBlock.Text = value; })); } } public string MainText @@ -31,8 +31,8 @@ namespace ModAssistant set { Dispatcher.Invoke(new Action(() => { - OneClickStatus.Instance.MainTextBlock.Text = value; - OneClickStatus.Instance.HistoryTextBlock.Text = string.IsNullOrEmpty(MainText) ? $"{value}" : $"{value}\n{HistoryText}"; + Instance.MainTextBlock.Text = value; + Instance.HistoryTextBlock.Text = string.IsNullOrEmpty(MainText) ? $"{value}" : $"{value}\n{HistoryText}"; })); } } diff --git a/ModAssistant/Pages/Intro.xaml.cs b/ModAssistant/Pages/Intro.xaml.cs index 4a83ed1..7ab2cad 100644 --- a/ModAssistant/Pages/Intro.xaml.cs +++ b/ModAssistant/Pages/Intro.xaml.cs @@ -29,7 +29,7 @@ namespace ModAssistant.Pages Properties.Settings.Default.Agreed = false; Properties.Settings.Default.Save(); MessageBox.Show((string)FindResource("Intro:ClosingApp")); - System.Windows.Application.Current.Shutdown(); + Application.Current.Shutdown(); } private void Agree_Click(object sender, RoutedEventArgs e) diff --git a/ModAssistant/Pages/Mods.xaml.cs b/ModAssistant/Pages/Mods.xaml.cs index bdfe976..c20e5be 100644 --- a/ModAssistant/Pages/Mods.xaml.cs +++ b/ModAssistant/Pages/Mods.xaml.cs @@ -51,7 +51,7 @@ namespace ModAssistant.Pages public void RefreshColumns() { - if (MainWindow.Instance.Main.Content != Mods.Instance) return; + if (MainWindow.Instance.Main.Content != Instance) return; double viewWidth = ModsListView.ActualWidth; double totalSize = 0; GridViewColumn description = null; @@ -342,7 +342,7 @@ namespace ModAssistant.Pages ); } - Pages.Options.Instance.YeetBSIPA.IsEnabled = true; + Options.Instance.YeetBSIPA.IsEnabled = true; } else if (mod.ListItem.IsSelected) { @@ -622,7 +622,7 @@ namespace ModAssistant.Pages private void ModsListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if ((Mods.ModListItem)Mods.Instance.ModsListView.SelectedItem == null) + if ((Mods.ModListItem)Instance.ModsListView.SelectedItem == null) { MainWindow.Instance.InfoButton.IsEnabled = false; } @@ -647,7 +647,7 @@ namespace ModAssistant.Pages if (File.Exists(Path.Combine(App.BeatSaberInstallDirectory, file))) File.Delete(Path.Combine(App.BeatSaberInstallDirectory, file)); } - Pages.Options.Instance.YeetBSIPA.IsEnabled = false; + Options.Instance.YeetBSIPA.IsEnabled = false; } private void Uninstall_Click(object sender, RoutedEventArgs e) @@ -784,14 +784,14 @@ namespace ModAssistant.Pages { target.Height = oldHeight; DoubleAnimation animation = new DoubleAnimation(newHeight, duration); - target.BeginAnimation(TextBlock.HeightProperty, animation); + target.BeginAnimation(HeightProperty, animation); } private void Animate(TextBox target, double oldHeight, double newHeight, TimeSpan duration) { target.Height = oldHeight; DoubleAnimation animation = new DoubleAnimation(newHeight, duration); - target.BeginAnimation(TextBox.HeightProperty, animation); + target.BeginAnimation(HeightProperty, animation); } } } diff --git a/ModAssistant/Pages/Options.xaml.cs b/ModAssistant/Pages/Options.xaml.cs index e715ce1..868d65c 100644 --- a/ModAssistant/Pages/Options.xaml.cs +++ b/ModAssistant/Pages/Options.xaml.cs @@ -203,7 +203,7 @@ namespace ModAssistant.Pages MainWindow.Instance.MainText = $"{Application.Current.FindResource("Options:UploadingLog")}..."; await Task.Run(async () => await UploadLog()); - System.Diagnostics.Process.Start(LogURL); + Process.Start(LogURL); Utils.SetClipboard(LogURL); MainWindow.Instance.MainText = (string)Application.Current.FindResource("Options:LogUrlCopied"); }