diff --git a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin index b9484c25..952aa516 100644 Binary files a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin and b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin differ diff --git a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin index 79408c5b..f8a6940e 100644 Binary files a/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin and b/VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin differ diff --git a/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 b/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 index f9a19ef6..de991889 100644 Binary files a/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 and b/VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2 differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/0b3ac902-e018-463f-8e20-ac4e40dbf97e.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/0b3ac902-e018-463f-8e20-ac4e40dbf97e.vsidx new file mode 100644 index 00000000..45676e17 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/0b3ac902-e018-463f-8e20-ac4e40dbf97e.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/17d733c1-fcc5-4b13-9303-fecaea78b0bd.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/17d733c1-fcc5-4b13-9303-fecaea78b0bd.vsidx deleted file mode 100644 index f44c56e3..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/17d733c1-fcc5-4b13-9303-fecaea78b0bd.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/37dcaedf-e924-41c0-8e83-e445dfe442ca.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/37dcaedf-e924-41c0-8e83-e445dfe442ca.vsidx deleted file mode 100644 index 19dc7d17..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/37dcaedf-e924-41c0-8e83-e445dfe442ca.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/553fde22-4138-47d1-962f-fa7b74fece73.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/553fde22-4138-47d1-962f-fa7b74fece73.vsidx new file mode 100644 index 00000000..a1d94164 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/553fde22-4138-47d1-962f-fa7b74fece73.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/5dfd144c-d9f9-472c-8fc7-b60a273ecc82.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/5dfd144c-d9f9-472c-8fc7-b60a273ecc82.vsidx new file mode 100644 index 00000000..fa7ed47d Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/5dfd144c-d9f9-472c-8fc7-b60a273ecc82.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/5e43e1c2-9932-40e3-aa8a-b5e475c6288f.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/5e43e1c2-9932-40e3-aa8a-b5e475c6288f.vsidx deleted file mode 100644 index 241728af..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/5e43e1c2-9932-40e3-aa8a-b5e475c6288f.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/611074d7-ef2b-4505-9d6b-4da8e72aa6d3.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/611074d7-ef2b-4505-9d6b-4da8e72aa6d3.vsidx deleted file mode 100644 index cb46e2a7..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/611074d7-ef2b-4505-9d6b-4da8e72aa6d3.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/793edf76-4a5c-4697-8cd0-5a277295ba45.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/793edf76-4a5c-4697-8cd0-5a277295ba45.vsidx deleted file mode 100644 index 2b3421ee..00000000 Binary files a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/793edf76-4a5c-4697-8cd0-5a277295ba45.vsidx and /dev/null differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/961b1e3d-cce9-41e4-80a6-0aa3a9c269fd.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/961b1e3d-cce9-41e4-80a6-0aa3a9c269fd.vsidx new file mode 100644 index 00000000..cab430f0 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/961b1e3d-cce9-41e4-80a6-0aa3a9c269fd.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/FileContentIndex/d4c5d6d8-8f15-4869-bcb5-08d4e305655e.vsidx b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/d4c5d6d8-8f15-4869-bcb5-08d4e305655e.vsidx new file mode 100644 index 00000000..147fbec7 Binary files /dev/null and b/VTOL_2.0.0/.vs/VTOL/FileContentIndex/d4c5d6d8-8f15-4869-bcb5-08d4e305655e.vsidx differ diff --git a/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 b/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 index 059472df..d8a5ec93 100644 Binary files a/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 and b/VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2 differ diff --git a/VTOL_2.0.0/.vs/VTOL/v17/fileList.bin b/VTOL_2.0.0/.vs/VTOL/v17/fileList.bin index 2d486add..549fd169 100644 Binary files a/VTOL_2.0.0/.vs/VTOL/v17/fileList.bin and b/VTOL_2.0.0/.vs/VTOL/v17/fileList.bin differ diff --git a/VTOL_2.0.0/App.xaml.cs b/VTOL_2.0.0/App.xaml.cs index ee6e8250..6f0ffeb7 100644 --- a/VTOL_2.0.0/App.xaml.cs +++ b/VTOL_2.0.0/App.xaml.cs @@ -1,13 +1,5 @@ using Microsoft.Win32; -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Media.Animation; -using VTOL.Pages; namespace VTOL { /// @@ -19,7 +11,7 @@ public partial class App : Application const string FriendlyName = " Thunderstore Mod Manager Protocol"; public static void RegisterUriScheme() { - + using (var key = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Classes\\" + UriScheme)) { @@ -44,19 +36,19 @@ public static void RegisterUriScheme() } } } - private async void Application_Startup(object sender, StartupEventArgs e) + private async void Application_Startup(object sender, StartupEventArgs e) { //SplashScreen splashScreen = new SplashScreen(@"\Pages\Splash.jpg"); - + //splashScreen.Show(true, true); - + // Auto-close: NO, On top: YES - // var splashScreen = new Splash_(); - // splashScreen.Show(); + // var splashScreen = new Splash_(); + // splashScreen.Show(); // // Async load the main window // // var mainWindow = new MainWindow(); diff --git a/VTOL_2.0.0/MainWindow.xaml.cs b/VTOL_2.0.0/MainWindow.xaml.cs index d5cb13a7..cd14e2d7 100644 --- a/VTOL_2.0.0/MainWindow.xaml.cs +++ b/VTOL_2.0.0/MainWindow.xaml.cs @@ -1,37 +1,29 @@ -using System; +using Microsoft.Xaml.Behaviors; +using Newtonsoft.Json.Linq; +using Pixelmaniac.Notifications; +using Serilog; +using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; -using System.Text; +using System.Reflection; +using System.Security.Principal; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Parallax; -using Newtonsoft.Json.Linq; -using Microsoft.Win32; -using VTOL.Scripts; -using System.Globalization; -using Serilog; -using System.Threading; -using System.Reflection; -using System.Diagnostics; -using System.Security.Principal; using VTOL.Pages; -using Pixelmaniac.Notifications; -using Microsoft.Xaml.Behaviors; namespace VTOL { - - public class FadeInOutBehavior : Behavior + + public class FadeInOutBehavior : Behavior { protected override void OnAttached() { @@ -83,13 +75,13 @@ public partial class MainWindow : Window public NotificationManager NotificationManager; public bool Is_Focused = true; - // public List Current_Installed_Mods = new List(); + // public List Current_Installed_Mods = new List(); public HashSet Current_Installed_Mods = new HashSet(); bool failed_folder = false; public bool minimize_to_tray = false; - - + + public string ProductVersion { get @@ -111,11 +103,11 @@ public string ProductVersion private void UserInterfaceCustomScale(double customScale) { // Change scale of window content - - ScaleTransform dpiTransform = new ScaleTransform(1.5,1.5); - + + ScaleTransform dpiTransform = new ScaleTransform(1.5, 1.5); + this.LayoutTransform = dpiTransform; - + } public MainWindow() { @@ -123,13 +115,14 @@ public MainWindow() try { - - NotificationManager = new NotificationManager(); - minimize_to_tray = Properties.Settings.Default.Minimize_to_Tray; + + NotificationManager = new NotificationManager(); + minimize_to_tray = Properties.Settings.Default.Minimize_to_Tray; Profile_TAG.Content = Properties.Settings.Default.Profile_Name; - + if (!File.Exists(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json")) - { string DocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + { + string DocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (Directory.Exists(DocumentsFolder) && Directory.Exists(AppDataFolder)) { @@ -201,15 +194,15 @@ public MainWindow() { failed_folder = true; Send_Danger_Notif("VTOL SYSTEMS FAILED TO FIND YOUR APPDATA FOLDER, LOCATE A SAVE DATA FOLDER", 10000); - var folderDlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); - folderDlg.ShowNewFolderButton = true; - // Show the FolderBrowserDialog. - var result = folderDlg.ShowDialog(); - if (result == true) + var folderDlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); + folderDlg.ShowNewFolderButton = true; + // Show the FolderBrowserDialog. + var result = folderDlg.ShowDialog(); + if (result == true) + { + string path = folderDlg.SelectedPath; + if (path == null || !Directory.Exists(path)) { - string path = folderDlg.SelectedPath; - if (path == null || !Directory.Exists(path)) - { Send_Caution_Notif("INVALID FOLDER"); @@ -217,7 +210,7 @@ public MainWindow() } else - { + { Properties.Settings.Default.BACKUP_SAVE_DEST = path + @"\"; Properties.Settings.Default.Save(); @@ -225,7 +218,7 @@ public MainWindow() Restart(); } - } + } @@ -238,7 +231,7 @@ public MainWindow() } - + if (User_Settings_Vars != null) { @@ -294,7 +287,7 @@ public MainWindow() true // Whether to change accents automatically ); - + VERSION_TEXT.Text = "VTOL - " + ProductVersion + " |"; @@ -328,9 +321,9 @@ public MainWindow() } void Restart() { - - + + var currentExecutablePath = Process.GetCurrentProcess().MainModule.FileName; Process.Start(currentExecutablePath); Application.Current.Shutdown(); @@ -486,7 +479,7 @@ public bool TryCopyFile( return false; } - + public void Send_Success_Notif(string Input_Message) { @@ -550,7 +543,7 @@ private void CloseButton_Click(object sender, RoutedEventArgs e) - + private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.DragMove(); @@ -586,7 +579,7 @@ private void Theme_Click(object sender, RoutedEventArgs e) if (Wpf.Ui.Appearance.Theme.GetAppTheme() == ThemeType) { - Wpf.Ui.Appearance.Theme.Apply( + Wpf.Ui.Appearance.Theme.Apply( Wpf.Ui.Appearance.ThemeType.Light, // Theme type Wpf.Ui.Appearance.BackgroundType.Mica, // Background type true // Whether to change accents automatically @@ -649,26 +642,26 @@ private void Log_Folder_warning_Click(object sender, RoutedEventArgs e) string path = User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\logs\"; - if (Directory.Exists(path) ) + if (Directory.Exists(path)) { - - - string pattern = "*.dmp"; - var dirInfo = new DirectoryInfo(path); - var file = (from f in dirInfo.GetFiles(pattern) orderby f.LastWriteTime descending select f).FirstOrDefault(); - string p = file.FullName; - string args = string.Format("/e, /select, \"{0}\"", p); - - ProcessStartInfo info = new ProcessStartInfo(); - info.FileName = "explorer"; - info.Arguments = args; - Process.Start(info); + + + string pattern = "*.dmp"; + var dirInfo = new DirectoryInfo(path); + var file = (from f in dirInfo.GetFiles(pattern) orderby f.LastWriteTime descending select f).FirstOrDefault(); + string p = file.FullName; + string args = string.Format("/e, /select, \"{0}\"", p); + + ProcessStartInfo info = new ProcessStartInfo(); + info.FileName = "explorer"; + info.Arguments = args; + Process.Start(info); Properties.Settings.Default.LOG_Folder_Counter = Directory.GetFiles(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\logs\").Where(s => s.EndsWith(".dmp")).Count(); Properties.Settings.Default.Save(); Log_Folder_warning.Visibility = Visibility.Hidden; } - + } catch (Exception ex) { @@ -711,7 +704,8 @@ async Task OPEN_WEBPAGE(string URL) { await Task.Run(() => { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { Snackbar.Message = "Opening the Following URL - " + URL; Snackbar.Title = "INFO"; Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; @@ -738,16 +732,17 @@ private void NORTHSTAR_BUTTON_Click(object sender, RoutedEventArgs e) { Northstar_Dialog.Visibility = Visibility.Visible; } - + } private void Changelog_Click(object sender, RoutedEventArgs e) { - try { - string url = @"https://github.com/R2Northstar/Northstar/releases/tag/v" + NORTHSTAR_BUTTON.Content.ToString().Replace("Northstar Version", "").Replace("-", "").Trim().Replace(" ", ""); + try + { + string url = @"https://github.com/R2Northstar/Northstar/releases/tag/v" + NORTHSTAR_BUTTON.Content.ToString().Replace("Northstar Version", "").Replace("-", "").Trim().Replace(" ", ""); + + OPEN_WEBPAGE(url); - OPEN_WEBPAGE(url); - } @@ -805,27 +800,27 @@ private void Northstar_Dialog_IsVisibleChanged(object sender, DependencyProperty private void RootNavigation_PreviewMouseDown(object sender, MouseButtonEventArgs e) { - + } private void RootNavigation_TargetUpdated(object sender, DataTransferEventArgs e) { - + } private void RootNavigation_SourceUpdated(object sender, DataTransferEventArgs e) { - + } private void Northstar_Dialog_LostFocus(object sender, RoutedEventArgs e) { - + } private void Northstar_Dialog_LostMouseCapture(object sender, MouseEventArgs e) { - + } private void MenuItem_Click(object sender, RoutedEventArgs e) @@ -881,7 +876,7 @@ private void Thunderstore_Click(object sender, RoutedEventArgs e) private void RestartNorthstar_Click(object sender, RoutedEventArgs e) { - + } private void OpenMods_Click(object sender, RoutedEventArgs e) @@ -932,10 +927,11 @@ private void Main_Win_Control_Closed(object sender, EventArgs e) private void Main_Win_Control_StateChanged(object sender, EventArgs e) { - try { + try + { if (minimize_to_tray == true) { - + if (this.WindowState == WindowState.Minimized) { @@ -951,15 +947,15 @@ private void Main_Win_Control_StateChanged(object sender, EventArgs e) { this.ShowInTaskbar = true; - + } } - - catch (Exception ex) - { + + catch (Exception ex) + { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -968,13 +964,13 @@ private void Main_Win_Control_StateChanged(object sender, EventArgs e) } -} + } private void Reload__Click(object sender, RoutedEventArgs e) { Restart(); - + } private void Main_Win_Control_Loaded(object sender, RoutedEventArgs e) @@ -997,13 +993,13 @@ private void Action_Center_SourceUpdated(object sender, DataTransferEventArgs e) private void Action_Center_Progress_MouseDown(object sender, MouseButtonEventArgs e) { - + } private void Action_Center_Progress_Checked(object sender, RoutedEventArgs e) { - - + + if (Action_Center_Panel.Opacity < 1) { @@ -1043,11 +1039,12 @@ private void Cancel_Button_Click(object sender, RoutedEventArgs e) { try { - DispatchIfNecessary(async () => { - Wpf.Ui.Controls.Button Button; - Button = sender as Wpf.Ui.Controls.Button; - - + DispatchIfNecessary(async () => + { + Wpf.Ui.Controls.Button Button; + Button = sender as Wpf.Ui.Controls.Button; + + RootNavigation.Navigate(typeof(Pages.Page_Thunderstore)); Page_Thunderstore Page = RootFrame.Content as Page_Thunderstore; @@ -1070,12 +1067,12 @@ private void Cancel_Button_Click(object sender, RoutedEventArgs e) private void Cancel_Button_SourceUpdated(object sender, DataTransferEventArgs e) { - + } private void Cancel_Button_TargetUpdated(object sender, DataTransferEventArgs e) { - + } private void Action_Center_TargetUpdated(object sender, DataTransferEventArgs e) @@ -1090,24 +1087,25 @@ private void Action_Center_LayoutUpdated(object sender, EventArgs e) private void SymbolIcon_LayoutUpdated(object sender, EventArgs e) { - + } private void SymbolIcon_TargetUpdated(object sender, DataTransferEventArgs e) { - + } private void Button_Click(object sender, RoutedEventArgs e) { try { - DispatchIfNecessary(async () => { - Button Button; + DispatchIfNecessary(async () => + { + Button Button; Button = sender as Button; - + RootNavigation.Navigate(typeof(Pages.Page_Thunderstore)); Page_Thunderstore Page = RootFrame.Content as Page_Thunderstore; @@ -1116,7 +1114,7 @@ private void Button_Click(object sender, RoutedEventArgs e) if (Page._downloadQueue != null) { - Page._downloadQueue.CancelDownload("",true); + Page._downloadQueue.CancelDownload("", true); } } }); diff --git a/VTOL_2.0.0/Pages/Page_About.xaml.cs b/VTOL_2.0.0/Pages/Page_About.xaml.cs index 88307594..5ef868e3 100644 --- a/VTOL_2.0.0/Pages/Page_About.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_About.xaml.cs @@ -1,22 +1,11 @@ -using Serilog; -using System; -using System.Collections.Generic; +using System; using System.Diagnostics; -using System.Globalization; using System.IO; -using System.Linq; using System.Reflection; -using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using Path = System.IO.Path; namespace VTOL.Pages @@ -30,7 +19,7 @@ public partial class Page_About : Page public MainWindow Main = GetMainWindow(); private static String updaterModulePath; - bool is_portable_= true; + bool is_portable_ = true; Wpf.Ui.Controls.Snackbar SnackBar; async Task Set_About() @@ -107,7 +96,7 @@ public Page_About() { InitializeComponent(); string Header = Path.GetFullPath(Path.Combine(System.Reflection.Assembly.GetExecutingAssembly().Location, @"../")); - + updaterModulePath = Path.Combine(Header, "VTOL_Updater.exe"); @@ -153,11 +142,11 @@ void Check_For_New_Update() { try { - + var thisApp = Assembly.GetExecutingAssembly(); AssemblyName name = new AssemblyName(thisApp.FullName); Updater Update = new Updater("BigSpice", "VTOL"); - + if (Update.CheckForUpdate()) { @@ -187,7 +176,7 @@ void Check_For_New_Update() } catch (Exception ex) { - + } @@ -197,7 +186,7 @@ void Check_For_New_Update() private void Check_Click(object sender, RoutedEventArgs e) { - if (is_portable_==false) + if (is_portable_ == false) { if (File.Exists(updaterModulePath)) { @@ -205,7 +194,7 @@ private void Check_Click(object sender, RoutedEventArgs e) Process process = Process.Start(updaterModulePath, "/checknow "); // process.Close(); } - + } else { @@ -213,7 +202,7 @@ private void Check_Click(object sender, RoutedEventArgs e) Check_For_New_Update(); - + } diff --git a/VTOL_2.0.0/Pages/Page_Home.xaml.cs b/VTOL_2.0.0/Pages/Page_Home.xaml.cs index c464142f..bb8c9f89 100644 --- a/VTOL_2.0.0/Pages/Page_Home.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Home.xaml.cs @@ -1,57 +1,37 @@ -using System; +using HandyControl.Tools.Extension; +using Ionic.Zip; +using LiveCharts; +using LiveCharts.Defaults; +using LiveCharts.Wpf; +using Microsoft.Win32; +using Newtonsoft.Json.Linq; +using Serilog; +using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.IO; using System.Linq; -using System.Text; +using System.Net; +using System.Net.Http; +using System.Net.NetworkInformation; +using System.Reflection; +using System.Security.Principal; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using VTOL; using System.Windows.Media.Animation; -using System.Windows.Media.Effects; -using Wpf.Ui.Common; -using Wpf.Ui.Controls.Interfaces; -using Wpf.Ui.Mvvm.Contracts; -using LiveCharts.Wpf; -using LiveCharts; -using LiveCharts.Defaults; -using System.Threading; -using System.ComponentModel; -using System.Windows.Controls.Primitives; -using System.Net.NetworkInformation; -using System.Diagnostics; -using System.Net; -using System.Timers; +using System.Windows.Media.Imaging; using System.Windows.Threading; -using System.IO; -using Parallax.WPF; -using System.Security.Principal; -using Microsoft.Win32; -using System.Reflection; -using Path = System.IO.Path; -using Newtonsoft.Json.Linq; -using System.Net.Http; -using Octokit; -using Page = System.Windows.Controls.Page; -using FileMode = System.IO.FileMode; +using Wpf.Ui.Common; using Application = System.Windows.Application; -using Serilog; -using System.Globalization; -using Ionic.Zip; -using VTOL.Scripts; -using System.Runtime.InteropServices; -using VTOL.Properties; -using Pixelmaniac.Notifications; -using System.Xml; -using HandyControl.Tools.Extension; -using System.Text.RegularExpressions; -using Windows.UI; +using FileMode = System.IO.FileMode; +using Page = System.Windows.Controls.Page; +using Path = System.IO.Path; namespace VTOL.Pages { @@ -59,21 +39,21 @@ namespace VTOL.Pages /// Interaction logic for Page_Home.xaml /// /// - + public static class Utility { static string invalidRegStr; - public static string MakeValidFileName(this string name) - { - if (invalidRegStr == null) + public static string MakeValidFileName(this string name) { - var invalidChars = System.Text.RegularExpressions.Regex.Escape(new string(Path.GetInvalidFileNameChars())); - invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars); - } + if (invalidRegStr == null) + { + var invalidChars = System.Text.RegularExpressions.Regex.Escape(new string(Path.GetInvalidFileNameChars())); + invalidRegStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", invalidChars); + } - return System.Text.RegularExpressions.Regex.Replace(name, invalidRegStr, "_"); - } + return System.Text.RegularExpressions.Regex.Replace(name, invalidRegStr, "_"); + } } public static class FileDirectorySearch { @@ -139,7 +119,7 @@ private static IEnumerable GetFileSystemEntries(string directory, string } } } - public class InstalledApplications + public class InstalledApplications { public static string checkInstalled_Custom(string findByName) { @@ -231,13 +211,13 @@ static string FindTitanfall2Folder() public static void GetInstalledApps() { - + string x = ""; string appPATH = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"; using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(appPATH)) { - File.WriteAllTextAsync(@"C:\Users\jorda\Downloads\net6-mvvm-demo\WriteText.txt", String.Join("\n", rk.GetSubKeyNames())); + File.WriteAllTextAsync(@"C:\Users\jorda\Downloads\net6-mvvm-demo\WriteText.txt", String.Join("\n", rk.GetSubKeyNames())); foreach (string skName in rk.GetSubKeyNames()) { @@ -268,12 +248,12 @@ public static void GetInstalledApps() } catch (Exception ex) { - + } } } - + } } @@ -357,26 +337,26 @@ public Page_Home() try { - InitializeComponent(); - + InitializeComponent(); + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); WARNING_BANNER.Visibility = Visibility.Collapsed; - if(Main != null) + if (Main != null) { - - User_Settings_Vars = Main.User_Settings_Vars; - AppDataFolder = Main.AppDataFolder; - SnackBar = Main.Snackbar; - if (User_Settings_Vars != null) - { - Current_Install_Folder = User_Settings_Vars.NorthstarInstallLocation; - } - + User_Settings_Vars = Main.User_Settings_Vars; + AppDataFolder = Main.AppDataFolder; + SnackBar = Main.Snackbar; + if (User_Settings_Vars != null) + { + Current_Install_Folder = User_Settings_Vars.NorthstarInstallLocation; + + } + } DispatcherTimer Log_Changes_Timer = new DispatcherTimer(); DispatcherTimer UPDATES_TIMER = new DispatcherTimer(); @@ -508,9 +488,10 @@ public Page_Home() } Check_Log_Folder(); - }catch(Exception ex) + } + catch (Exception ex) { - + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -569,7 +550,7 @@ public static bool IsDirectoryValid(string directoryPath) return true; } - + public bool TryUnzipFile( string Zip_Path, string Destination, bool overwrite = true, @@ -639,7 +620,7 @@ public string[] FindFirstFiles(string path, string searchPattern) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); return Array.Empty(); @@ -703,7 +684,8 @@ async Task OPEN_WEBPAGE(string URL) { await Task.Run(() => { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { SnackBar.Message = "Opening the Following URL - " + URL; SnackBar.Title = "INFO"; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; @@ -840,13 +822,14 @@ async void Auto_Install_(bool resart_ = false) unpack_flg = false; } - }catch(Exception ex) + } + catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } - + void Restart() { var currentExecutablePath = Process.GetCurrentProcess().MainModule.FileName; @@ -881,7 +864,7 @@ async void Restart_App() SnackBar.Message = VTOL.Resources.Languages.Language.PleaseWaitAsVTOLRestarts; SnackBar.Show(); }); - + await Task.Delay(100); var currentExecutablePath = Process.GetCurrentProcess().MainModule.FileName; Process.Start(currentExecutablePath); @@ -935,8 +918,8 @@ void INIT() MasterServer_URL = User_Settings_Vars.MasterServerUrl; Current_Install_Folder = User_Settings_Vars.NorthstarInstallLocation; - - + + if (IsValidPath(Current_Install_Folder)) { if (!Current_Install_Folder.EndsWith(@"\")) @@ -1020,7 +1003,7 @@ void INIT() string Current_Install_Folder_x = steam.Result; Task Northstar_ = Task.Run(() => { - string x = Auto_Find_And_verify().Replace(@"\\", @"\").Replace("/", @"\"); + string x = Auto_Find_And_verify().Replace(@"\\", @"\").Replace("/", @"\"); return x; }); string Current_Install_Folder = Northstar_.Result; @@ -1101,7 +1084,7 @@ void INIT() //Console.WriteLine(myFileVersionInfo.FileVersion); Current_Ver_ = myFileVersionInfo.FileVersion; } - if(Current_Ver_ == null) + if (Current_Ver_ == null) { Current_Ver_ = "ERR"; @@ -1129,7 +1112,7 @@ void INIT() Main.VERSION_TEXT.Refresh(); Main.User_Settings_Vars = User_Settings_Vars; Directory_Box.Text = Current_Install_Folder; - Task check_task = Task.Run(() => Check_Integrity_Of_NSINSTALL()); + Task check_task = Task.Run(() => Check_Integrity_Of_NSINSTALL()); check_task.Wait(); @@ -1214,7 +1197,7 @@ void INIT() - // throw new Exception("Automated Path Finding Failed!"); + // throw new Exception("Automated Path Finding Failed!"); } if (IsValidPath(FINAL)) @@ -1350,18 +1333,18 @@ void INIT() } else { - DispatchIfNecessary(async () => - { + DispatchIfNecessary(async () => + { - Update_Northstar_Button.Content = VTOL.Resources.Languages.Language.Page_Home_INIT_InstallNorthstar; - }); + Update_Northstar_Button.Content = VTOL.Resources.Languages.Language.Page_Home_INIT_InstallNorthstar; + }); } } catch (Exception ex) { - + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -1668,11 +1651,13 @@ public bool Template_traverse(DirectoryInfo root, String Search) return false; - } + } void Toggle_MS_BT(bool f) { - try { - DispatchIfNecessary(async () => { + try + { + DispatchIfNecessary(async () => + { if (f == true) { @@ -1842,10 +1827,12 @@ public void FadeControl(Control control, bool fadeIn, double duration = 1) } } - void Check_Log_Folder() { + void Check_Log_Folder() + { try { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\logs\")) { @@ -1855,7 +1842,7 @@ void Check_Log_Folder() { if (Cntr != Properties.Settings.Default.LOG_Folder_Counter && Cntr != 0) { - FadeControl(Main.Log_Folder_warning, true,5); + FadeControl(Main.Log_Folder_warning, true, 5); SlowBlink(Main.Log_Folder_warning, 0.4); } @@ -1863,7 +1850,7 @@ void Check_Log_Folder() { { FadeControl(Main.Log_Folder_warning, false); - + } } else @@ -1936,7 +1923,7 @@ void Check_For_New_Northstar_Install_With_Notif() - + if (!Current_Install_Folder.EndsWith(@"\")) { string fix = Current_Install_Folder + @"\"; @@ -1951,7 +1938,7 @@ void Check_For_New_Northstar_Install_With_Notif() // Get the file version info for the notepad. // Print the file name and version number. - // Console.WriteLine(myFileVersionInfo.FileVersion); + // Console.WriteLine(myFileVersionInfo.FileVersion); if (myFileVersionInfo.FileVersion != null) { @@ -1963,7 +1950,7 @@ void Check_For_New_Northstar_Install_With_Notif() Current_Ver_ = "ERRR"; } - User_Settings_Vars.CurrentVersion = Current_Ver_; + User_Settings_Vars.CurrentVersion = Current_Ver_; Properties.Settings.Default.Version = Current_Ver_; Properties.Settings.Default.Save(); @@ -1996,7 +1983,7 @@ void Check_For_New_Northstar_Install_With_Notif() } - async void UPDATES_TIMER_Tick(object sender, EventArgs e) + async void UPDATES_TIMER_Tick(object sender, EventArgs e) { try { @@ -2039,7 +2026,7 @@ async void UPDATES_TIMER_Tick(object sender, EventArgs e) Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } - } + } async void timer_Tick(object sender, EventArgs e) @@ -2111,14 +2098,14 @@ async void timer_Tick(object sender, EventArgs e) } catch (Exception ex) { - + //i dont need to log this } } public async Task PingHost() { - + bool pingable = false; PingReply reply_; long Val; @@ -2138,14 +2125,15 @@ public async Task PingHost() { RequestUri = new Uri(hostUrl), Method = HttpMethod.Head - + }; request.Headers.Add("VTOL", "VTOL/" + Assembly.GetExecutingAssembly().GetName().Version.ToString()); var result = await httpClient.SendAsync(request); if (result.IsSuccessStatusCode == true) { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { Master_Server_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#B2037F10"); Master_Server_Card.Icon = SymbolRegular.PlugConnected20; @@ -2159,7 +2147,8 @@ public async Task PingHost() else { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { LastHourSeries[0].Values.Add(new ObservableValue(0)); LastHourSeries[0].Values.RemoveAt(0); @@ -2175,11 +2164,12 @@ public async Task PingHost() catch (WebException wex) { Log.Error(wex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - if (wex.Response != null) + if (wex.Response != null) { if (((HttpWebResponse)wex.Response).StatusCode == HttpStatusCode.NotFound) { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { LastHourSeries[0].Values.Add(new ObservableValue(0)); LastHourSeries[0].Values.RemoveAt(0); @@ -2201,8 +2191,9 @@ public async Task PingHost() catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - - DispatchIfNecessary(async () => { + + DispatchIfNecessary(async () => + { LastHourSeries[0].Values.Add(new ObservableValue(0)); LastHourSeries[0].Values.RemoveAt(0); @@ -2210,7 +2201,7 @@ public async Task PingHost() Fail_Counter_Ping++; // Discard PingExceptions and return false; } - + finally { if (pinger != null) @@ -2367,8 +2358,8 @@ private void Master_Server_Check_Toggle_Unchecked(object sender, RoutedEventArgs private async void FadeAndMinimizeWindow(MainWindow window) { DoubleAnimation animation = new DoubleAnimation(0, TimeSpan.FromSeconds(1)); - // window.BeginAnimation(UIElement.OpacityProperty, animation); - // await Task.Delay(TimeSpan.FromSeconds(1)); + // window.BeginAnimation(UIElement.OpacityProperty, animation); + // await Task.Delay(TimeSpan.FromSeconds(1)); // window.WindowState = WindowState.Minimized; window.Minimize(); return; @@ -2437,7 +2428,7 @@ public void Launch_Northstar_() SnackBar.Title = "FATAL - ERROR"; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; SnackBar.Show(); - + } } @@ -2445,7 +2436,7 @@ public bool Check_Process_Running(string ProcessName) { Process[] pname = Process.GetProcessesByName(ProcessName); if (pname.Length == 0) - { + { return false; } else @@ -2455,7 +2446,7 @@ public bool Check_Process_Running(string ProcessName) } - private void Launch_Northstar_Click(object sender, RoutedEventArgs e) + private void Launch_Northstar_Click(object sender, RoutedEventArgs e) { Launch_Northstar_(); } @@ -2480,7 +2471,7 @@ private string Get_And_Set_Filepaths(string rootDir, string Filename) catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } @@ -2488,11 +2479,11 @@ private string Get_And_Set_Filepaths(string rootDir, string Filename) } - + void WalkDirectoryTree(DirectoryInfo root, String Search) { - DirectoryInfo[] subDirs = null; + DirectoryInfo[] subDirs = null; try { @@ -2537,13 +2528,13 @@ void WalkDirectoryTree(DirectoryInfo root, String Search) catch (NullReferenceException ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } } - + public static bool IsDirectoryEmpty(DirectoryInfo directory) { int num = Directory.GetFiles(directory.FullName).Length + Directory.GetDirectories(directory.FullName).Length; @@ -2566,7 +2557,7 @@ private void Origin_Client_Card_Click(object sender, RoutedEventArgs e) if (true) { EA_ORGIGIN_Client_Card.Content = "Please Click for More Info"; - EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FCF100"); + EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#FCF100"); } else { @@ -2594,7 +2585,7 @@ private void Origin_Client_Card_Click(object sender, RoutedEventArgs e) } } - + } else { @@ -2638,7 +2629,7 @@ async void Run_Origin() { try { - + if (Properties.Settings.Default.EA_APP_SUPPORT == true) { if (!File.Exists(EA_Location)) @@ -2668,7 +2659,7 @@ async void Run_Origin() process.Start(); int id = process.Id; pid = id; - Process tempProc = Process.GetProcessById(id); + Process tempProc = Process.GetProcessById(id); process.Close(); EAClient_Running = Check_Process_Running("EABackgroundService"); fail = 0; @@ -2796,20 +2787,20 @@ async void Run_Origin() // Process process = Process.Start(NSExe, Arg_Box.Text); process.Close(); - - Origin_Client_Running = Check_Process_Running("OriginClientService"); - fail = 0; - while (!Origin_Client_Running && fail <= 3) - { + + Origin_Client_Running = Check_Process_Running("OriginClientService"); + fail = 0; + while (!Origin_Client_Running && fail <= 3) + { - Origin_Client_Running = Check_Process_Running("OriginClientService"); + Origin_Client_Running = Check_Process_Running("OriginClientService"); await Task.Delay(100); fail++; - } - if (fail >= 3) - { + } + if (fail >= 3) + { DispatchIfNecessary(async () => { @@ -2818,16 +2809,16 @@ async void Run_Origin() }); - } + } if (Origin_Client_Running == true) { DispatchIfNecessary(async () => { EA_ORGIGIN_Client_Card.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#B2037F10"); - EA_ORGIGIN_Client_Card.IconFilled = true; - }); + EA_ORGIGIN_Client_Card.IconFilled = true; + }); - } + } } else @@ -2847,7 +2838,7 @@ async void Run_Origin() } - + } catch (Exception ex) { @@ -2858,99 +2849,100 @@ async void Run_Origin() EA_ORGIGIN_Client_Card.IconFilled = false; }); Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } } - + private void Browse_Titanfall_Button_Click(object sender, RoutedEventArgs e) { - try { - - var folderDlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); - folderDlg.ShowNewFolderButton = true; - // Show the FolderBrowserDialog. - var result = folderDlg.ShowDialog(); - if (result == true) + try { - string path = folderDlg.SelectedPath; - if (path == null || !Directory.Exists(path)) - { - SnackBar.Appearance = ControlAppearance.Danger; - SnackBar.Title = "WARNING!"; - SnackBar.Message = "Invalid Install Path!"; - SnackBar.Show(); + var folderDlg = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); + folderDlg.ShowNewFolderButton = true; + // Show the FolderBrowserDialog. + var result = folderDlg.ShowDialog(); + if (result == true) + { + string path = folderDlg.SelectedPath; + if (path == null || !Directory.Exists(path)) + { + SnackBar.Appearance = ControlAppearance.Danger; + SnackBar.Title = "WARNING!"; + SnackBar.Message = "Invalid Install Path!"; + SnackBar.Show(); - } - else - { - Current_Install_Folder = path + @"\"; - DirectoryInfo Dir = new DirectoryInfo(Current_Install_Folder); - if (Dir.Exists && File.Exists(Current_Install_Folder + "Titanfall2.exe")) + } + else { - if (File.Exists(Current_Install_Folder + "NorthstarLauncher.exe")) + Current_Install_Folder = path + @"\"; + DirectoryInfo Dir = new DirectoryInfo(Current_Install_Folder); + + if (Dir.Exists && File.Exists(Current_Install_Folder + "Titanfall2.exe")) { - Found_Install_Folder = true; - + if (File.Exists(Current_Install_Folder + "NorthstarLauncher.exe")) + { + Found_Install_Folder = true; - Directory_Box.Text = Current_Install_Folder; - User_Settings_Vars.NorthstarInstallLocation = Current_Install_Folder; - string User_Settings_Json_Strings = Newtonsoft.Json.JsonConvert.SerializeObject(User_Settings_Vars); - using (var StreamWriter = new StreamWriter(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json", false)) - { - StreamWriter.WriteLine(User_Settings_Json_Strings); - StreamWriter.Close(); + Directory_Box.Text = Current_Install_Folder; + + User_Settings_Vars.NorthstarInstallLocation = Current_Install_Folder; + string User_Settings_Json_Strings = Newtonsoft.Json.JsonConvert.SerializeObject(User_Settings_Vars); + using (var StreamWriter = new StreamWriter(AppDataFolder + @"\VTOL_DATA\Settings\User_Settings.Json", false)) + { + StreamWriter.WriteLine(User_Settings_Json_Strings); + StreamWriter.Close(); + } + + NSExe = Get_And_Set_Filepaths(Current_Install_Folder, "NorthstarLauncher.exe"); + Check_Integrity_Of_NSINSTALL(); + SnackBar.Appearance = ControlAppearance.Success; + SnackBar.Title = VTOL.Resources.Languages.Language.SUCCESS; + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_Browse_Titanfall_Button_Click_TheLocation + Current_Install_Folder + VTOL.Resources.Languages.Language.Page_Home_Browse_Titanfall_Button_Click_IsValidAndHasBeenSet; + SnackBar.Show(); + Restart_App(); } + else + { + if (!Current_Install_Folder.EndsWith(@"\")) + { + string fix = Current_Install_Folder + @"\"; + User_Settings_Vars.NorthstarInstallLocation = fix; + Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\"); + //Console.WriteLine("Replaced2"); - NSExe = Get_And_Set_Filepaths(Current_Install_Folder, "NorthstarLauncher.exe"); - Check_Integrity_Of_NSINSTALL(); - SnackBar.Appearance = ControlAppearance.Success; - SnackBar.Title = VTOL.Resources.Languages.Language.SUCCESS; - SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_Browse_Titanfall_Button_Click_TheLocation + Current_Install_Folder + VTOL.Resources.Languages.Language.Page_Home_Browse_Titanfall_Button_Click_IsValidAndHasBeenSet; - SnackBar.Show(); - Restart_App(); + } + SnackBar.Appearance = ControlAppearance.Danger; + SnackBar.Title = "WARNING!"; + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_INIT_NORTHSTARAUTOINSTALLWILLNOWBEGINPLEASEWAITABOUT30SECONDS; + SnackBar.Timeout = 8000; + SnackBar.Show(); + + Auto_Install_(true); + } } else { - if (!Current_Install_Folder.EndsWith(@"\")) - { - string fix = Current_Install_Folder + @"\"; - User_Settings_Vars.NorthstarInstallLocation = fix; - Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\"); - //Console.WriteLine("Replaced2"); - - } SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = "WARNING!"; - SnackBar.Message = VTOL.Resources.Languages.Language.Page_Home_INIT_NORTHSTARAUTOINSTALLWILLNOWBEGINPLEASEWAITABOUT30SECONDS; + SnackBar.Message = VTOL.Resources.Languages.Language.Browse_Titanfall_Button_Click_TheLocation + Current_Install_Folder + VTOL.Resources.Languages.Language.Page_Home_Browse_Titanfall_Button_Click_IsNotValid; SnackBar.Timeout = 8000; SnackBar.Show(); - Auto_Install_(true); } - } - else - { - SnackBar.Appearance = ControlAppearance.Danger; - SnackBar.Title = "WARNING!"; - SnackBar.Message = VTOL.Resources.Languages.Language.Browse_Titanfall_Button_Click_TheLocation + Current_Install_Folder + VTOL.Resources.Languages.Language.Page_Home_Browse_Titanfall_Button_Click_IsNotValid; - SnackBar.Timeout = 8000; - SnackBar.Show(); - - } + } } } - } catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } } @@ -3066,7 +3058,7 @@ void Fade_In_Fade_Out_Control(bool fade_in = false) { if (fade_in == true) { - DispatchIfNecessary( () => + DispatchIfNecessary(() => { if (ProgressBar.Opacity < 1) { @@ -3085,7 +3077,7 @@ void Fade_In_Fade_Out_Control(bool fade_in = false) } else { - DispatchIfNecessary( () => + DispatchIfNecessary(() => { if (ProgressBar.Opacity > 0) { @@ -3131,7 +3123,7 @@ private async Task Read_Latest_Release(string address, string json_name = "temp. { if (address != null) { - + WebClient client = new WebClient(); webClient.Proxy = null; WebRequest.DefaultWebProxy = null; @@ -3161,12 +3153,12 @@ private async Task Read_Latest_Release(string address, string json_name = "temp. attempts++; } Parse_Release(); - + } else { - await TryCreateDirectory(AppDataFolder + @"\VTOL_DATA\temp\"); + await TryCreateDirectory(AppDataFolder + @"\VTOL_DATA\temp\"); saveAsyncFile(s, AppDataFolder + @"\VTOL_DATA\temp\" + json_name, false, false); FileInfo File = new FileInfo(AppDataFolder + @"\VTOL_DATA\temp\" + json_name); int attempts = 0; @@ -3179,7 +3171,7 @@ private async Task Read_Latest_Release(string address, string json_name = "temp. attempts++; } Parse_Release(); - + } } else @@ -3193,7 +3185,7 @@ private async Task Read_Latest_Release(string address, string json_name = "temp. SnackBar.Show(); }); - + //Send_Error_Notif(GetTextResource("NOTIF_ERROR_INVALID_URL")); } @@ -3249,7 +3241,7 @@ private void Parse_Release(string json_name = "temp.json") var myJObject = JObject.Parse(myJsonString); - + current_Northstar_version_Url = myJObject.SelectToken("assets[0].browser_download_url").Value(); Properties.Settings.Default.Version = myJObject.SelectToken("tag_name").Value(); Properties.Settings.Default.Save(); @@ -3274,7 +3266,7 @@ private void Parse_Release(string json_name = "temp.json") SnackBar.Message = VTOL.Resources.Languages.Language.Parse_Release_ReleaseNotFound; SnackBar.Show(); }); - + } @@ -3290,7 +3282,7 @@ private void Parse_Release(string json_name = "temp.json") catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. return; } @@ -3376,25 +3368,25 @@ void Check_For_New_Northstar_Install() } async Task Install_NS_METHOD() { - + try - { - webClient = new WebClient(); - webClient.Proxy = null; - WebRequest.DefaultWebProxy = null; - - Fade_In_Fade_Out_Control(true); + { + webClient = new WebClient(); + webClient.Proxy = null; + WebRequest.DefaultWebProxy = null; - if (Directory.Exists(Current_Install_Folder + @"TempCopyFolder")) + Fade_In_Fade_Out_Control(true); + + if (Directory.Exists(Current_Install_Folder + @"TempCopyFolder")) { - await TryDeleteDirectory(Current_Install_Folder + @"TempCopyFolder", true); - - + await TryDeleteDirectory(Current_Install_Folder + @"TempCopyFolder", true); + + } - await Read_Latest_Release(Current_REPO_URL); - webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); - if (Directory.Exists(Current_Install_Folder) && Current_Install_Folder != null && Current_Install_Folder != "NODATA") + await Read_Latest_Release(Current_REPO_URL); + webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); + if (Directory.Exists(Current_Install_Folder) && Current_Install_Folder != null && Current_Install_Folder != "NODATA") { if (File.Exists(Current_Install_Folder + @"ns_startup_args_dedi.txt") && File.Exists(Current_Install_Folder + @"ns_startup_args.txt")) { @@ -3433,25 +3425,25 @@ async Task Install_NS_METHOD() } } - await TryCreateDirectory(AppDataFolder + @"\VTOL_DATA\Releases\"); - webClient.DownloadFileAsync(new Uri(current_Northstar_version_Url), AppDataFolder + @"\VTOL_DATA\Releases\Northstar_Release.zip"); - webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback_Progress_Window); + await TryCreateDirectory(AppDataFolder + @"\VTOL_DATA\Releases\"); + webClient.DownloadFileAsync(new Uri(current_Northstar_version_Url), AppDataFolder + @"\VTOL_DATA\Releases\Northstar_Release.zip"); + webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressCallback_Progress_Window); - while (unpack_flg == false) - { - await Task.Delay(100); - } - - - + while (unpack_flg == false) + { + await Task.Delay(100); } + + + + } } catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); //Removed PaperTrailSystem Due to lack of reliability. - + if (ex.Message.Contains("The remote server returned an error: (403) rate limit exceeded")) { DispatchIfNecessary(async () => @@ -3471,7 +3463,7 @@ async Task Install_NS_METHOD() Fade_In_Fade_Out_Control(false); }); } - + } public string GetFile(string directory, string Search, @@ -3505,7 +3497,7 @@ public string GetFile(string directory, string Search, } catch (IOException) { - Thread.Sleep(millisecondsDelay); + Thread.Sleep(millisecondsDelay); } catch (UnauthorizedAccessException) { @@ -3519,7 +3511,7 @@ public string GetFile(string directory, string Search, return null; } - + private void DownloadProgressCallback_Progress_Window(object sender, DownloadProgressChangedEventArgs e) { @@ -3543,7 +3535,7 @@ private void Completed(object sender, AsyncCompletedEventArgs e) DispatchIfNecessary(async () => { ProgressBar.IsIndeterminate = true; - Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); + Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); }); if (!Current_Install_Folder.EndsWith(@"\")) @@ -3553,8 +3545,8 @@ private void Completed(object sender, AsyncCompletedEventArgs e) Current_Install_Folder = fix.Replace(@"\\", @"\").Replace("/", @"\"); } - - if(Directory.Exists(Current_Install_Folder)) + + if (Directory.Exists(Current_Install_Folder)) { if (!User_Settings_Vars.NorthstarInstallLocation.EndsWith(@"\")) { @@ -3569,10 +3561,11 @@ private void Completed(object sender, AsyncCompletedEventArgs e) Unpack_To_Location(AppDataFolder + @"\VTOL_DATA\Releases\NorthStar_Release.zip", User_Settings_Vars.NorthstarInstallLocation); - }else + } + else DispatchIfNecessary(async () => - + { Fade_In_Fade_Out_Control(false); Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); @@ -3582,16 +3575,16 @@ private void Completed(object sender, AsyncCompletedEventArgs e) SnackBar.Message = "Install Location Is Invalid"; SnackBar.Show(); }); - - return; - } + + return; } + } + - catch (Exception ex) { - if(ex.Message.Contains("is denied")) + if (ex.Message.Contains("is denied")) { Admin_Warn_Flag++; } @@ -3600,9 +3593,9 @@ private void Completed(object sender, AsyncCompletedEventArgs e) DispatchIfNecessary(async () => { Fade_In_Fade_Out_Control(false); - - ProgressBar.Value = 0; - Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); + + ProgressBar.Value = 0; + Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); }); @@ -3798,7 +3791,7 @@ public async Task TryCopyFile( return false; } - + private void Unpack_To_Location(string Target_Zip, string Destination_Zip) { try @@ -3825,7 +3818,7 @@ private void Unpack_To_Location(string Target_Zip, string Destination_Zip) string nrml = GetFile(Current_Install_Folder, @"ns_startup_args.txt"); string cfg = GetFile(Current_Install_Folder, @"autoexec_ns_server.cfg"); string dedi = GetFile(Current_Install_Folder, @"ns_startup_args_dedi.txt"); - if (do_not_overwrite_Ns_file == true ) + if (do_not_overwrite_Ns_file == true) { if (!Directory.Exists(Current_Install_Folder + @"TempCopyFolder")) { @@ -3880,7 +3873,7 @@ private void Unpack_To_Location(string Target_Zip, string Destination_Zip) TryUnzipFile(Target_Zip, Destination_Zip); - if (do_not_overwrite_Ns_file == true ) + if (do_not_overwrite_Ns_file == true) { if (Directory.Exists(Current_Install_Folder + @"TempCopyFolder\")) @@ -3933,7 +3926,7 @@ private void Unpack_To_Location(string Target_Zip, string Destination_Zip) Main.NORTHSTAR_BUTTON.Refresh(); NSExe = Get_And_Set_Filepaths(Current_Install_Folder, "NorthstarLauncher.exe"); - + Fade_In_Fade_Out_Control(false); ProgressBar.Value = 0; Mouse.OverrideCursor = null; @@ -3959,7 +3952,7 @@ private void Unpack_To_Location(string Target_Zip, string Destination_Zip) DispatchIfNecessary(async () => { - Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); + Wpf.Ui.TaskBar.TaskBarProgress.SetState(Main, Wpf.Ui.TaskBar.TaskBarProgressState.None); ProgressBar.Value = 0; @@ -4030,15 +4023,15 @@ private void Unpack_To_Location(string Target_Zip, string Destination_Zip) } - - + + } private void Update_Northstar_Button_Click(object sender, RoutedEventArgs e) { try { - Install_NS_METHOD(); + Install_NS_METHOD(); //InfoBar_Test_1.Message = "sdsd"; //InfoBar_Test_1.IsOpen = true; @@ -4106,7 +4099,7 @@ private void EA_ORGIGIN_Client_Card_Loaded(object sender, RoutedEventArgs e) bitmapx.EndInit(); CLIENT_CARD_IMAGE.Source = bitmapx; - + } else { @@ -4118,7 +4111,7 @@ private void EA_ORGIGIN_Client_Card_Loaded(object sender, RoutedEventArgs e) CLIENT_CARD_IMAGE.Source = bitmapy; EA_ORGIGIN_Client_Card.Content = VTOL.Resources.Languages.Language.Page_Home_OriginClientRunning; - + } @@ -4139,7 +4132,7 @@ private void Exit_BTN_Click(object sender, RoutedEventArgs e) private void Exit_BTN_Click_1(object sender, RoutedEventArgs e) { WARNING_BANNER.Visibility = Visibility.Collapsed; - // resetEvent.Set(); + // resetEvent.Set(); } @@ -4155,7 +4148,7 @@ private void Button_MouseLeave_1(object sender, MouseEventArgs e) void ShowBanner() { - + WARNING_BANNER.Visibility = Visibility.Visible; @@ -4190,23 +4183,25 @@ private void EXE_BUTTON_MouseEnter(object sender, MouseEventArgs e) private void EXE_BUTTON_MouseLeave(object sender, MouseEventArgs e) { - try { - DispatchIfNecessary(async () => + try { - EXE_BUTTON.IconFilled = false; + DispatchIfNecessary(async () => + { + EXE_BUTTON.IconFilled = false; - }); - } + }); + } catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } -} + } private void Warning_Sin_Loaded(object sender, RoutedEventArgs e) { - try { + try + { StartPulseAnimation(0.75); } @@ -4219,38 +4214,40 @@ private void Warning_Sin_Loaded(object sender, RoutedEventArgs e) private void StartPulseAnimation(double minimumOpacity) { - try { - DispatchIfNecessary(async () => + try { - // Create a DoubleAnimation to animate the control's Opacity property - var animation = new DoubleAnimation + DispatchIfNecessary(async () => { - From = 1.0, - To = minimumOpacity, - Duration = new Duration(TimeSpan.FromSeconds(0.6)), - AutoReverse = true, - RepeatBehavior = RepeatBehavior.Forever - }; - - // Apply the animation to the control's Opacity property - Warning_Sin.BeginAnimation(UIElement.OpacityProperty, animation); - }); - } + // Create a DoubleAnimation to animate the control's Opacity property + var animation = new DoubleAnimation + { + From = 1.0, + To = minimumOpacity, + Duration = new Duration(TimeSpan.FromSeconds(0.6)), + AutoReverse = true, + RepeatBehavior = RepeatBehavior.Forever + }; + + // Apply the animation to the control's Opacity property + Warning_Sin.BeginAnimation(UIElement.OpacityProperty, animation); + }); + } catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } -} + } public void EditExe(string exePath) { - try { - // Get the path to the manifest file - // Open the registry key for the application - RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", true); + try + { + // Get the path to the manifest file + // Open the registry key for the application + RegistryKey key = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers", true); - // Add the entry to run the application as an administrator - key.SetValue(exePath, "~ RUNASADMIN"); + // Add the entry to run the application as an administrator + key.SetValue(exePath, "~ RUNASADMIN"); Restart_App(); } catch (Exception ex) @@ -4264,12 +4261,12 @@ private void EXE_BUTTON_Click(object sender, RoutedEventArgs e) try { - - var currentExecutablePath = Process.GetCurrentProcess().MainModule.FileName; + + var currentExecutablePath = Process.GetCurrentProcess().MainModule.FileName; - EditExe(currentExecutablePath); - Restart_App(); + EditExe(currentExecutablePath); + Restart_App(); } catch (Exception ex) { @@ -4280,20 +4277,21 @@ private void EXE_BUTTON_Click(object sender, RoutedEventArgs e) private void Welcome_Close_Click(object sender, RoutedEventArgs e) { - try { - DispatchIfNecessary(async () => + try { - WELCOME_BANNER.Visibility = Visibility.Collapsed; - Main.RootNavigation.IsEnabled = true; + DispatchIfNecessary(async () => + { + WELCOME_BANNER.Visibility = Visibility.Collapsed; + Main.RootNavigation.IsEnabled = true; - }); - } + }); + } catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } -} + } private void Locate_Titanfall_Install_Click(object sender, RoutedEventArgs e) { @@ -4328,7 +4326,7 @@ private void Locate_Titanfall_Install_Click(object sender, RoutedEventArgs e) if (File.Exists(Current_Install_Folder + "NorthstarLauncher.exe")) { Found_Install_Folder = true; - + Directory_Box.Text = Current_Install_Folder; @@ -4379,7 +4377,7 @@ private void Locate_Titanfall_Install_Click(object sender, RoutedEventArgs e) } else { - + WELCOME_BANNER.Visibility = Visibility.Collapsed; Main.RootNavigation.IsEnabled = true; if (!Current_Install_Folder.EndsWith(@"\")) diff --git a/VTOL_2.0.0/Pages/Page_Logs.xaml.cs b/VTOL_2.0.0/Pages/Page_Logs.xaml.cs index 5a7a0959..db62fd4f 100644 --- a/VTOL_2.0.0/Pages/Page_Logs.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Logs.xaml.cs @@ -1,17 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Windows.Controls; namespace VTOL.Pages diff --git a/VTOL_2.0.0/Pages/Page_Mods.xaml.cs b/VTOL_2.0.0/Pages/Page_Mods.xaml.cs index 5b4e565a..d6c21b9e 100644 --- a/VTOL_2.0.0/Pages/Page_Mods.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Mods.xaml.cs @@ -1,4 +1,6 @@ -using Ionic.Zip; +using HandyControl.Tools.Extension; +using Ionic.Zip; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; using System; @@ -8,39 +10,18 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Reflection; -using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using System.Windows.Threading; -using Wpf.Ui; -using Wpf.Ui.Common.Interfaces; -using Path = System.IO.Path; -using VTOL; -using System.Xml.Linq; -using ABI.Windows.UI; -using HandyControl.Tools.Extension; -using System.Drawing.Drawing2D; -using System.Drawing; -using Newtonsoft.Json; -using HandyControl.Tools; -using Lsj.Util.Win32.Structs; using VTOL.Advocate.Conversion.JSON; -using System.Runtime; -using System.Text.Json.Nodes; -using Newtonsoft.Json.Serialization; -using System.Net.Http.Json; +using Path = System.IO.Path; namespace VTOL.Pages { @@ -248,302 +229,146 @@ private void DispatchIfNecessary(Action action) else action.Invoke(); } - async void Call_Mods_From_Folder_Lite() + + + public class NORTHSTARCOMPATIBLE_MOD { + public string Name { get; set; } + public bool Value { get; set; } + public DirectoryInfo DIRECTORY_INFO { get; set; } + public bool IsValidandinstalled { get; set; } - try - { - - if (User_Settings_Vars.NorthstarInstallLocation != null || User_Settings_Vars.NorthstarInstallLocation != "" || Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) - { - - if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) - { - - - Main.Current_Installed_Mods.Clear(); - - string NS_Mod_Dir = User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; - - System.IO.DirectoryInfo rootDirs = new DirectoryInfo(@NS_Mod_Dir); - if (IsValidPath(NS_Mod_Dir) == true) - { - - System.IO.DirectoryInfo[] subDirs = null; - subDirs = rootDirs.GetDirectories(); - - - foreach (System.IO.DirectoryInfo dirInfo in subDirs) - { - - - Main.Current_Installed_Mods.Add(dirInfo.Name.Trim()); - - } - Console.WriteLine("Finished_Mod_Load"); - DispatchIfNecessary(async () => - { - - ApplyDataBinding(); - }); - } - - - - } - - - } - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } } - public static List MismatchDetector(List mods, List jsonMods) - { - List mismatchedMods = new List(); - List matchedMods = new List(); - - foreach (NORTHSTARCOMPATIBLE_MOD mod in mods) - { - bool match = jsonMods.Any(jsonMod => jsonMod.Name == mod.Name); - if (match) - { - matchedMods.Add(mod); - - } - else - { - mismatchedMods.Add(mod); - - } - - - } - - + - return matchedMods; - } - public static async Task Check_Plugins_and_multi_mod(string Destination, string directory, bool checkIntegrity = false) + + public List READ_UPDATE_MOD_LIST(DirectoryInfo[] modsToUpdate, bool UPDATE_Folders = false) { - string fileName = new DirectoryInfo(directory).Name + ".mc"; - string filePath = Path.Combine(Destination, fileName); - - - string pluginsFolderName = "plugins"; // Folder name to search for - - string pluginsFolderPath = Path.Combine(Destination, pluginsFolderName); - - if (checkIntegrity) - { - - if (File.Exists(filePath)) + List OUTPUT = new List(); + + if (modsToUpdate.Count() <= 0) { - string[] lines = await File.ReadAllLinesAsync(filePath); - - foreach (string line in lines) - { - if (!Directory.Exists(line)) - { - return true; - } - } + return OUTPUT; } - } - - if (Directory.Exists(pluginsFolderPath)) - { - return true; - } - - if (File.Exists(filePath)) - { - return true; - } - - - - - + + string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); - return false; - } - public class HashSetConverter : JsonConverter> - { - public override HashSet ReadJson(JsonReader reader, Type objectType, HashSet existingValue, bool hasExistingValue, JsonSerializer serializer) - { - if (reader.TokenType == JsonToken.StartObject) + if (File.Exists(Json_Path) == true) { - JObject jsonObject = JObject.Load(reader); - HashSet hashSet = new HashSet(); - - foreach (var property in jsonObject.Properties()) + // Read the JSON file + string jsonContent = File.ReadAllText(Json_Path); + + if (jsonContent.IsNullOrEmpty() == true || jsonContent.Length < 5) { - if (property.Value.Type == JTokenType.Boolean && (bool)property.Value == true) - { - hashSet.Add(property.Name); - } - } - - return hashSet; - } - - throw new JsonSerializationException("Invalid JSON format for HashSet."); - } - - public override void WriteJson(JsonWriter writer, HashSet value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - } - - - - public class NORTHSTARCOMPATIBLE_MOD - { - public string Name { get; set; } - public bool Value { get; set; } - public DirectoryInfo DIRECTORY_INFO { get; set; } - public bool IsValidandinstalled { get; set; } + foreach (var dirInfo in modsToUpdate) + { + NORTHSTARCOMPATIBLE_MOD Mod = new NORTHSTARCOMPATIBLE_MOD(); - } - public static List MergeModsIntoJsonFile(string filePath, List JSON_FILE, List modsToMerge) - { - - // Merge the existing and new Mods - List mergedMods = new List(JSON_FILE); - mergedMods.AddRange(modsToMerge); + string dirName = dirInfo.Name; - using (StreamWriter writer = new StreamWriter(filePath)) - { - writer.WriteLine("{"); + // Use the regex pattern to extract the version number + string pattern = @"-\d+\.\d+\.\d+$"; + Match match = Regex.Match(dirName, pattern); + // Remove the version number from the directory name + string dirNameWithoutVersion = match.Success ? dirName.Replace(match.Value, "") : dirName; + // Handle the case where the value is null + Mod.Name = dirNameWithoutVersion; + Mod.Value = true; // or some other appropriate value + Mod.IsValidandinstalled = false; // or some other appropriate value + if (dirInfo.Exists) + { + Mod.DIRECTORY_INFO = dirInfo; // or some other appropriate value - for (int i = 0; i < mergedMods.Count; i++) - { - NORTHSTARCOMPATIBLE_MOD mod = mergedMods[i]; - writer.Write($" \"{mod.Name}\": {mod.Value.ToString().ToLower()}"); + } + OUTPUT.Add(Mod); - if (i < mergedMods.Count - 1) - { - writer.WriteLine(","); + } + // Handle case where json is null or empty + return OUTPUT; } else { - writer.WriteLine(); - } - } - - writer.WriteLine("}"); - } - - // Serialize the merged Mods back to JSON - // string updatedJson = JsonConvert.SerializeObject(mergedMods, Formatting.None); - - // Write the updated JSON back to the file - //File.WriteAllText(filePath, updatedJson); - - // Return the updated list of Mods - return mergedMods; - } + try + { + ////// Parse the JSON content + JObject jsonObject = JObject.Parse(jsonContent); - public static List ReadJsonValues(string json) - { - List mods = new List(); - JObject data = JObject.Parse(json); - foreach (var property in data.Properties()) - { - string name = property.Name; - bool value = (bool)property.Value; - + foreach (var dirInfo in modsToUpdate) + { + NORTHSTARCOMPATIBLE_MOD Mod = new NORTHSTARCOMPATIBLE_MOD(); - NORTHSTARCOMPATIBLE_MOD mod = new NORTHSTARCOMPATIBLE_MOD - { - Name = name, - Value = value - }; + Mod.Name = (dirInfo.Name.Split('-')[0]); + Mod.DIRECTORY_INFO = null; - mods.Add(mod); - } + if (jsonObject.TryGetValue(Mod.Name.Replace("_", " "), out JToken value)) + { + if (value != null && value.Type == JTokenType.Boolean) + { + bool isValueTrue = (bool)value; + Mod.Value = isValueTrue; + Console.WriteLine(isValueTrue.ToString()); + } + else + { + Mod.Value = false; + } - return mods; - } - public List READ_UPDATE_MOD_LIST(DirectoryInfo[] modsToUpdate, bool UPDATE_Folders = false) - { - List OUTPUT = new List(); - string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); + Mod.IsValidandinstalled = true; - if (File.Exists(Json_Path) == true) - { - // Read the JSON file - string jsonContent = File.ReadAllText(Json_Path); - // Parse the JSON content - JObject jsonObject = JObject.Parse(jsonContent); + if (dirInfo.Exists) + { + Mod.DIRECTORY_INFO = dirInfo; // or some other appropriate value - foreach (var dirInfo in modsToUpdate) - { - NORTHSTARCOMPATIBLE_MOD Mod = new NORTHSTARCOMPATIBLE_MOD(); + } + OUTPUT.Add(Mod); + } + else + { + // Handle the case where the value is null + Mod.Value = false; // or some other appropriate value + Mod.IsValidandinstalled = false; // or some other appropriate value + if (dirInfo.Exists) + { + Mod.DIRECTORY_INFO = dirInfo; // or some other appropriate value - Mod.Name = (dirInfo.Name.Split('-')[0]); - Mod.DIRECTORY_INFO = null; + } + OUTPUT.Add(Mod); + } - if (jsonObject.TryGetValue(Mod.Name.Replace("_", " "), out JToken value)) - { - if (value.Type == JTokenType.Boolean) - { - bool isValueTrue = (bool)value; - Mod.Value = isValueTrue; - Console.WriteLine(isValueTrue.ToString()); - } - else - { - Mod.Value = false; } - Mod.IsValidandinstalled = true; - - Mod.DIRECTORY_INFO = dirInfo; - OUTPUT.Add(Mod); } - else + catch (Exception ex) { - Mod.DIRECTORY_INFO = dirInfo; - // Console.WriteLine("Could not find - " + Mod.Name); - Mod.Value = false; - Mod.IsValidandinstalled = false; - OUTPUT.Add(Mod); + Console.WriteLine("Invalid JSON: " + ex.Message); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } - - - - - // MessageBox.Show(Mod.DIRECTORY_INFO.FullName); } - } + } + return OUTPUT; } public async Task Call_Mods_From_Folder() -{ - bool install_Prompt = false; - string IS_CORE_MOD_temp = "#00000000"; - try - { - Final_List.Clear(); - if (User_Settings_Vars.NorthstarInstallLocation != null || User_Settings_Vars.NorthstarInstallLocation != "" || Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) { - if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) + bool install_Prompt = false; + string IS_CORE_MOD_temp = "#00000000"; + try { - if (User_Settings_Vars.CurrentVersion != "NODATA") + Final_List.Clear(); + if (User_Settings_Vars.NorthstarInstallLocation != null || User_Settings_Vars.NorthstarInstallLocation != "" || Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) { + if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) + { + if (User_Settings_Vars.CurrentVersion != "NODATA") + { string NS_Mod_Dir = User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; @@ -558,48 +383,28 @@ public async Task Call_Mods_From_Folder() var dirs = rootDirs.EnumerateDirectories("*", new EnumerationOptions { RecurseSubdirectories = false }).ToArray(); - - DispatchIfNecessary(async () => { Mod_Count_Label.Content = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ModCount + subDirs.Length; }); - if (subDirs.Count() > 0){ + if (subDirs.Count() > 0) + { int index = 0; List existingDirectories = null; - string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); - + string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); - if (File.Exists(Json_Path)) - { - var myJsonString = File.ReadAllText(Json_Path); - // dynamic myJObject = JObject.Parse(myJsonString); - List READ_JSON_MODS = ReadJsonValues(myJsonString); - //List DIRECTORY_MODS = MismatchDetector(READ_UPDATE_MOD_LIST(dirs), READ_JSON_MODS); + + if (File.Exists(Json_Path)) + { + List DIRECTORY_MODS = READ_UPDATE_MOD_LIST(dirs); CLEANED_FORMAT_MODS = DIRECTORY_MODS; - if (Json_Path != null) - - - { - // CLEANED_FORMAT_MODS = MergeModsIntoJsonFile(Json_Path,READ_JSON_MODS, DIRECTORY_MODS); - } - // MessageBox.Show("Mismatchedd Mods:\n" + string.Join(Environment.NewLine, DIRECTORY_MODS.Select(mod => mod.Name))); - - - //existingDirectories = dirs.Where(directory => READ_JSON_MODS.Any(mod => mod.Name == directory.Name.Split('-')[0])).ToList(); - - //MessageBox.Show(string.Join(Environment.NewLine, missed)); - - // Filter the directory names to include only those that exist in the hash set - - + + } - } - //TODO migrate to using the enabled mod list instad of var directory info in existingDirectories foreach (var Verified_Installed_Mod in CLEANED_FORMAT_MODS) { @@ -608,10 +413,9 @@ public async Task Call_Mods_From_Folder() if (Verified_Installed_Mod.DIRECTORY_INFO != null) { - Console.WriteLine($"Index: {index}, Value: {Verified_Installed_Mod}"); index++; - // bool Has_Manifest_or_plugins = await Check_Plugins_and_multi_mod(Verified_Installed_Mod.DIRECTORY_INFO.FullName, Verified_Installed_Mod.DIRECTORY_INFO.Name); + // bool Has_Manifest_or_plugins = await Check_Plugins_and_multi_mod(Verified_Installed_Mod.DIRECTORY_INFO.FullName, Verified_Installed_Mod.DIRECTORY_INFO.Name); if (Regex.IsMatch(Verified_Installed_Mod.Name.Trim(), @"^Northstar\.CustomServers\w{0,2}$") || Regex.IsMatch(Verified_Installed_Mod.Name.Trim(), @"^Northstar\.Custom\w{0,2}$") || Regex.IsMatch(Verified_Installed_Mod.Name.Trim(), @"^Northstar\.Client\w{0,2}$")) { IS_CORE_MOD_temp = "#FF8C7F24"; @@ -639,13 +443,13 @@ public async Task Call_Mods_From_Folder() { - + int Flag_mod = 0; string ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ThereIsAnIssueDetectedWithYourMod; - if (Verified_Installed_Mod.IsValidandinstalled == false ) + if (Verified_Installed_Mod.IsValidandinstalled == false) { - IS_CORE_MOD_temp = "#c80815"; + IS_CORE_MOD_temp = "#c80815"; ToolTip_Dynamic = "The Mod Is not Registered Properly in the Backend List, Please Fix the Mod formatting or update your TF2 Mod List"; Flag_mod = 100; @@ -686,357 +490,248 @@ public async Task Call_Mods_From_Folder() } } + } + DispatchIfNecessary(async () => + { + ApplyDataBinding(); + }); + } + } + } + } + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + public async Task TryDeleteDirectoryAsync( + string directoryPath, bool overwrite = true, + int maxRetries = 10, + int millisecondsDelay = 30) + { + if (directoryPath == null) + throw new ArgumentNullException(directoryPath); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (Directory.Exists(directoryPath)) + { + Directory.Delete(directoryPath, overwrite); + } + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + return false; + } + public bool TryDeleteDirectory( +string directoryPath, bool overwrite = true, +int maxRetries = 10, +int millisecondsDelay = 300) + { + if (directoryPath == null) + throw new ArgumentNullException(directoryPath); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (Directory.Exists(directoryPath)) + { + Directory.Delete(directoryPath, overwrite); + } + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } - //foreach (var dirInfo in dirs) - //{ - // try - // { - - - // Console.WriteLine($"Index: {index}, Value: {dirInfo}"); - // index++; - - // bool Has_Manifest_or_plugins = await Check_Plugins_and_multi_mod(dirInfo.FullPathFullName, dirInfo.Name); - - // if (Regex.IsMatch(dirInfo.Name.Trim(), @"^Northstar\.CustomServers\w{0,2}$") || Regex.IsMatch(dirInfo.Name.Trim(), @"^Northstar\.Custom\w{0,2}$") || Regex.IsMatch(dirInfo.Name.Trim(), @"^Northstar\.Client\w{0,2}$")) - // { - // IS_CORE_MOD_temp = "#FF8C7F24"; - - // } - // else - // { - // IS_CORE_MOD_temp = "#00000000"; - - // } - - // if (dirInfo.FullName.ToString().Contains("ModSettings")) - // { - // DispatchIfNecessary(async () => - - // { - // DialogF.ButtonLeftName = "Delete"; - // DialogF.ButtonLeftAppearance = Wpf.Ui.Common.ControlAppearance.Danger; - // DialogF.ButtonRightName = "Cancel"; - - // DialogF.ButtonRightAppearance = Wpf.Ui.Common.ControlAppearance.Secondary; - // DialogF.Title = "WARNING!"; - // DialogF.Message = VTOL.Resources.Languages.Language.YouHaveInstalledModSettingsModSettingsHasBeenDepreceatedAndWillCauseErrorsNDeleteItNow; - // Mod_Settings_Mod_OLD_PATH = dirInfo.FullName; - // DialogF.Show(); - // }); - // } - - // if (Page_Home.IsDirectoryEmpty(new DirectoryInfo(dirInfo.FullName))) - // { - - // TryDeleteDirectoryAsync(dirInfo.FullName, true); - - // continue; - - // } - // if (Template_traverse(dirInfo, "Locked_Folder") == true) - // { - + return false; + } + public bool TryCreateDirectory( + string directoryPath, + int maxRetries = 10, + int millisecondsDelay = 200) + { + if (directoryPath == null) + throw new ArgumentNullException(directoryPath); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - // if (Directory.Exists(dirInfo + @"\Locked_Folder") && Page_Home.IsDirectoryEmpty(new DirectoryInfo(dirInfo + @"\Locked_Folder"))) - // { - // TryDeleteDirectoryAsync(dirInfo + @"\Locked_Folder"); - // } - // int Flag_mod = 0; - // string ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ThereIsAnIssueDetectedWithYourMod; + for (int i = 0; i < maxRetries; ++i) + { + try + { - // if (!File.Exists(dirInfo.FullName + @"\Locked_Folder" + @"\mod.json") && Has_Manifest_or_plugins == false) - // { - // ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_PleaseOpenYourFolderAt + dirInfo.Parent + VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_AndManuallyRepairTheMod + dirInfo.Name; - // Flag_mod = 100; - // } + Directory.CreateDirectory(directoryPath); - // Final_List.Add(new Card_ { Mod_Name_ = dirInfo.Name.Trim(), Mod_Date_ = dirInfo.CreationTime.ToString(), Is_Active_Color = "#B29A0404", Size__ = dirInfo.LastAccessTime.ToString(), En_Di = "Enable", Is_Active_ = true, Mod_Path_ = dirInfo.FullName, Flag = Flag_mod, Error_Tooltip = ToolTip_Dynamic, Label = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_Enable, IS_CORE_MOD = IS_CORE_MOD_temp }); - // } - // else - // { - // int Flag_mod = 0; - // string ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_ThereIsAnIssueDetectedWithYourMod; + if (Directory.Exists(directoryPath)) + { - // if (!File.Exists(dirInfo.FullName + @"\mod.json") && Has_Manifest_or_plugins == false) - // { + return true; + } - // ToolTip_Dynamic = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_PleaseOpenYourFolderAt + dirInfo.Parent + VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_AndManuallyRepairTheMod + dirInfo.Name; - // Flag_mod = 100; - // } - // Final_List.Add(new Card_ { Mod_Name_ = dirInfo.Name.Trim(), Mod_Date_ = dirInfo.CreationTime.ToString(), Is_Active_Color = "#B2049A28", Size__ = dirInfo.LastAccessTime.ToString(), En_Di = "Disable", Is_Active_ = false, Mod_Path_ = dirInfo.FullName, Flag = Flag_mod, Error_Tooltip = ToolTip_Dynamic, Label = VTOL.Resources.Languages.Language.Page_Mods_Call_Mods_From_Folder_Disable_, IS_CORE_MOD = IS_CORE_MOD_temp }); + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + return false; + } + public bool TryMoveFile( + string Origin, string Destination, bool overwrite = true, + int maxRetries = 10, + int millisecondsDelay = 200) + { + if (Origin == null) + throw new ArgumentNullException(Origin); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - // } - // DispatchIfNecessary(async () => - // { - // Main.Current_Installed_Mods.Add(dirInfo.Name.Trim()); - // }); - // }catch(Exception ex) - // { - // Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (File.Exists(Origin)) + { + File.Move(Origin, Destination, overwrite); + } - // } - //} + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } - } + return false; + } + public bool TryCopyFile( + string Origin, string Destination, bool overwrite = true, + int maxRetries = 10, + int millisecondsDelay = 300) + { + if (Origin == null) + throw new ArgumentNullException(Origin); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - DispatchIfNecessary(async () => - { + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (File.Exists(Origin)) + { + File.Copy(Origin, Destination, true); + } + Thread.Sleep(millisecondsDelay); - ApplyDataBinding(); - }); - } + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } - } + return false; + } + public bool TryDeleteFile( +string Origin, +int maxRetries = 10, +int millisecondsDelay = 300) + { + if (Origin == null) + throw new ArgumentNullException(Origin); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (File.Exists(Origin)) + { + File.Delete(Origin); } + Thread.Sleep(millisecondsDelay); - + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); } - - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } - + return false; } - public async Task TryDeleteDirectoryAsync( - string directoryPath, bool overwrite = true, - int maxRetries = 10, - int millisecondsDelay = 30) - { - if (directoryPath == null) - throw new ArgumentNullException(directoryPath); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (Directory.Exists(directoryPath)) - { - Directory.Delete(directoryPath, overwrite); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryDeleteDirectory( - string directoryPath, bool overwrite = true, - int maxRetries = 10, - int millisecondsDelay = 300) - { - if (directoryPath == null) - throw new ArgumentNullException(directoryPath); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (Directory.Exists(directoryPath)) - { - Directory.Delete(directoryPath, overwrite); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryCreateDirectory( - string directoryPath, - int maxRetries = 10, - int millisecondsDelay = 200) - { - if (directoryPath == null) - throw new ArgumentNullException(directoryPath); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - - Directory.CreateDirectory(directoryPath); - - if (Directory.Exists(directoryPath)) - { - - return true; - } - - - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryMoveFile( - string Origin, string Destination, bool overwrite = true, - int maxRetries = 10, - int millisecondsDelay = 200) - { - if (Origin == null) - throw new ArgumentNullException(Origin); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (File.Exists(Origin)) - { - File.Move(Origin, Destination, overwrite); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryCopyFile( - string Origin, string Destination, bool overwrite = true, - int maxRetries = 10, - int millisecondsDelay = 300) - { - if (Origin == null) - throw new ArgumentNullException(Origin); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (File.Exists(Origin)) - { - File.Copy(Origin, Destination, true); - } - Thread.Sleep(millisecondsDelay); - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryDeleteFile( - string Origin, - int maxRetries = 10, - int millisecondsDelay = 300) - { - if (Origin == null) - throw new ArgumentNullException(Origin); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (File.Exists(Origin)) - { - File.Delete(Origin); - } - Thread.Sleep(millisecondsDelay); - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool Template_traverse(System.IO.DirectoryInfo root, String Search) { @@ -1131,7 +826,7 @@ public bool IsValidPath(string path, bool allowRelativePaths = false) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); isValid = false; } @@ -1164,7 +859,7 @@ private void ApplyDataBinding() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -1183,112 +878,43 @@ public void Move_Mods(string val, bool Enable_Disable) if (val != null) { - - string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); + string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); - if (File.Exists(Json_Path)) - { - // Read the JSON file - string jsonContent = File.ReadAllText(Json_Path); + + if (File.Exists(Json_Path)) + { + // Read the JSON file + string jsonContent = File.ReadAllText(Json_Path); // Parse the JSON content JObject jsonObject = JObject.Parse(jsonContent); string Name = val.Replace("_", " "); if (jsonObject.TryGetValue(Name, out _)) + { + if (Enable_Disable != null) { - if (Enable_Disable != null) - { - // Insert a new property - jsonObject[Name] = Enable_Disable; - } + // Insert a new property + jsonObject[Name] = Enable_Disable; } - // Convert back to JSON string - string updatedJson = jsonObject.ToString(); - - // string updatedJson = JsonConvert.SerializeObject(jsonObject, Formatting.Indented); - - // Write back to the file - File.WriteAllText(Json_Path, updatedJson); - } - else - { - - Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; - Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Snackbar.Message = "File" + Json_Path + " Could not be Edited."; - Snackbar.Show(); - - } - //if (Enable_Disable == true) - //{ - // if (File.Exists(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\Locked_Folder" + @"\mod.json")) - // { - // TryMoveFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\Locked_Folder" + @"\mod.json", User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\mod.json", true); - - // DirectoryInfo Locked = new DirectoryInfo(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\Locked_Folder"); - // if (Page_Home.IsDirectoryEmpty(Locked)) - // { - - // TryDeleteDirectory(Locked.FullName); - - // } - - - // } - // else - // { - - // Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; - // Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - // Snackbar.Message = "File" + val + " Could not be Edited."; - // Snackbar.Show(); - // } - - - - - - //} - //else - //{ - // if (File.Exists(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\mod.json")) - // { - // TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\Locked_Folder"); - - // TryMoveFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\mod.json", User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages\" + val + @"\Locked_Folder" + @"\mod.json", true); - - - - // } - // else - // { - // Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; - // Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - // Snackbar.Message = "File" + val + " Could not be Edited."; - // Snackbar.Show(); - // } - - - //} - - - - - - - - - - - - - + // Convert back to JSON string + string updatedJson = jsonObject.ToString(); + // string updatedJson = JsonConvert.SerializeObject(jsonObject, Formatting.Indented); + // Write back to the file + File.WriteAllText(Json_Path, updatedJson); + } + else + { + Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; + Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Snackbar.Message = "File" + Json_Path + " Could not be Edited."; + Snackbar.Show(); + } } else { @@ -1507,7 +1133,7 @@ public void ComboBox_Actions() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -1557,7 +1183,7 @@ private void Search_Bar_Suggest_Mods_LostFocus(object sender, RoutedEventArgs e) Search_Bar_Suggest_Mods.Text = "~Search"; } Search_Bar_Suggest_Mods.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); - // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); + // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); } IEnumerable Keep_List_State(bool Searching, bool reverse = false) @@ -2065,7 +1691,7 @@ IEnumerable Keep_List_State(bool Searching, bool reverse = false) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -2115,7 +1741,7 @@ private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEvent } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -2164,7 +1790,7 @@ void Check_Reverse(bool Apply_Change = true) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -2186,7 +1812,7 @@ private void padd_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -2197,7 +1823,7 @@ private void Mod_List_Box_GotFocus(object sender, RoutedEventArgs e) { } - + private string Find_Folder(string searchQuery, string folderPath) { searchQuery = "*" + searchQuery + "*"; @@ -2221,7 +1847,7 @@ public static string FindFirstFile(string path, string searchPattern) } catch (Exception ex) { - + return string.Empty; } @@ -2265,7 +1891,7 @@ public static string FindFirstFile(string path, string searchPattern) catch (Exception ex) { - + } // If no file was found (neither in this directory nor in the child directories) @@ -2274,15 +1900,16 @@ public static string FindFirstFile(string path, string searchPattern) } public long GetDirectorySize(string path) { - try { - DirectoryInfo directoryInfo = new DirectoryInfo(path); - return directoryInfo.EnumerateFiles("*", SearchOption.AllDirectories) - .Sum(file => file.Length); + try + { + DirectoryInfo directoryInfo = new DirectoryInfo(path); + return directoryInfo.EnumerateFiles("*", SearchOption.AllDirectories) + .Sum(file => file.Length); } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } return 0; @@ -2374,7 +2001,7 @@ void Open_Mod_Info(string Mod_name) long size = GetDirectorySize(FolderDir); string size_str = "Mod Size on Disk: " + SizeSuffix(size); string Content = Description + Environment.NewLine + version + Environment.NewLine + size_str.Replace(",", "."); - + DispatchIfNecessary(async () => { @@ -2415,7 +2042,7 @@ void Open_Mod_Info(string Mod_name) } if (manifest_json != null && File.Exists(manifest_json)) { - + var mymanifestString = File.ReadAllText(manifest_json); dynamic myMObject = JObject.Parse(mymanifestString); @@ -2504,8 +2131,8 @@ void Open_Folder(string Folder) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + //Removed PaperTrailSystem Due to lack of reliability. + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -2539,7 +2166,7 @@ private void Info_Btn_Click(object sender, RoutedEventArgs e) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -2573,7 +2200,7 @@ private void Delete_Btn_Click(object sender, RoutedEventArgs e) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -2603,7 +2230,7 @@ private childItem FindVisualChild(DependencyObject obj) catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -2617,7 +2244,7 @@ void Delete_Mod(string Mod_name) try { - + string FolderDir = Find_Folder(Mod_name, User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"); if (Directory.Exists(FolderDir)) { @@ -2664,21 +2291,27 @@ void Delete_Action(object sender, RoutedEventArgs e) { // Read the JSON file string jsonContent = File.ReadAllText(Json_Path); - // Parse the JSON content - JObject jsonObject = JObject.Parse(jsonContent); - string Name = workingmod.Replace("_", " "); - if (jsonObject.TryGetValue(Name, out _)) - { - jsonObject.Remove(Name); - } - // Convert back to JSON string - string updatedJson = jsonObject.ToString(); + if (jsonContent.IsNullOrEmpty() != true && jsonContent.Length > 5) + {// Parse the JSON content + + JObject jsonObject = JObject.Parse(jsonContent); + string Name = workingmod.Replace("_", " "); + if (jsonObject.TryGetValue(Name, out _)) + { + jsonObject.Remove(Name); - // string updatedJson = JsonConvert.SerializeObject(jsonObject, Formatting.Indented); + } + // Convert back to JSON string + string updatedJson = jsonObject.ToString(); - // Write back to the file - File.WriteAllText(Json_Path, updatedJson); + // string updatedJson = JsonConvert.SerializeObject(jsonObject, Formatting.Indented); + + // Write back to the file + File.WriteAllText(Json_Path, updatedJson); + + } + } @@ -2788,7 +2421,7 @@ private void EXTRA_SETTINGS_Dock_MouseRightButtonDown(object sender, MouseButton } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -2894,7 +2527,7 @@ public string Search_For_Mod_Thunderstore(string SearchQuery = "None") } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -2908,7 +2541,8 @@ private void DialogF_ButtonLeftClick(object sender, RoutedEventArgs e) if (IsValidPath(Mod_Settings_Mod_OLD_PATH)) { bool isValid = TryDeleteDirectoryAsync(Mod_Settings_Mod_OLD_PATH, true).Result; - if (isValid == true){ + if (isValid == true) + { DialogF.Hide(); @@ -2921,13 +2555,13 @@ private void DialogF_ButtonLeftClick(object sender, RoutedEventArgs e) } else { - Snackbar.Title =VTOL.Resources.Languages.Language.ERROR; + Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; Snackbar.Message = VTOL.Resources.Languages.Language.TheModAt + Mod_Settings_Mod_OLD_PATH + VTOL.Resources.Languages.Language.CouldNotBeDeleted; Snackbar.Show(); } - - + + } } diff --git a/VTOL_2.0.0/Pages/Page_Profiles.xaml.cs b/VTOL_2.0.0/Pages/Page_Profiles.xaml.cs index ee1fc27e..6460badf 100644 --- a/VTOL_2.0.0/Pages/Page_Profiles.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Profiles.xaml.cs @@ -1,2092 +1,2093 @@ -using System; +using Serilog; +using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.IO.Compression; using System.Linq; -using System.Text; +using System.Runtime.InteropServices; +using System.Runtime.Serialization.Formatters.Binary; +using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using System.IO.Compression; -using System.Threading; -using System.Text.RegularExpressions; -using HandyControl.Tools; using System.Windows.Media.Animation; -using System.Collections.ObjectModel; -using System.Reflection; -using System.Globalization; -using Windows.System.Profile; -using System.Diagnostics; -using System.Runtime.InteropServices; -using Serilog; -namespace VTOL.Pages - { - - /// - /// Interaction logic for Page_Profiles.xaml - /// - /// - namespace FileLockInfo - { - public static class Win32Processes - { - /// - /// Find out what process(es) have a lock on the specified file. - /// - /// Path of the file. - /// Processes locking the file - /// See also: - /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa373661(v=vs.85).aspx - /// http://wyupdate.googlecode.com/svn-history/r401/trunk/frmFilesInUse.cs (no copyright in code at time of viewing) - /// - public static List GetProcessesLockingFile(string path) - { - uint handle; - string key = Guid.NewGuid().ToString(); - int res = RmStartSession(out handle, 0, key); - - if (res != 0) throw new Exception("Could not begin restart session. Unable to determine file locker."); - - try - { - const int MORE_DATA = 234; - uint pnProcInfoNeeded, pnProcInfo = 0, lpdwRebootReasons = RmRebootReasonNone; - - string[] resources = { path }; // Just checking on one resource. - - res = RmRegisterResources(handle, (uint)resources.Length, resources, 0, null, 0, null); - - if (res != 0) throw new Exception("Could not register resource."); - - //Note: there's a race condition here -- the first call to RmGetList() returns - // the total number of process. However, when we call RmGetList() again to get - // the actual processes this number may have increased. - res = RmGetList(handle, out pnProcInfoNeeded, ref pnProcInfo, null, ref lpdwRebootReasons); - - if (res == MORE_DATA) - { - return EnumerateProcesses(pnProcInfoNeeded, handle, lpdwRebootReasons); - } - else if (res != 0) throw new Exception("Could not list processes locking resource. Failed to get size of result."); - } - finally - { - RmEndSession(handle); - } - - return new List(); - } - - - [StructLayout(LayoutKind.Sequential)] - public struct RM_UNIQUE_PROCESS - { - public int dwProcessId; - public System.Runtime.InteropServices.ComTypes.FILETIME ProcessStartTime; - } - - const int RmRebootReasonNone = 0; - const int CCH_RM_MAX_APP_NAME = 255; - const int CCH_RM_MAX_SVC_NAME = 63; - - public enum RM_APP_TYPE - { - RmUnknownApp = 0, - RmMainWindow = 1, - RmOtherWindow = 2, - RmService = 3, - RmExplorer = 4, - RmConsole = 5, - RmCritical = 1000 - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - public struct RM_PROCESS_INFO - { - public RM_UNIQUE_PROCESS Process; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCH_RM_MAX_APP_NAME + 1)] public string strAppName; - - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCH_RM_MAX_SVC_NAME + 1)] public string strServiceShortName; - - public RM_APP_TYPE ApplicationType; - public uint AppStatus; - public uint TSSessionId; - [MarshalAs(UnmanagedType.Bool)] public bool bRestartable; - } - - [DllImport("rstrtmgr.dll", CharSet = CharSet.Unicode)] - static extern int RmRegisterResources(uint pSessionHandle, uint nFiles, string[] rgsFilenames, - uint nApplications, [In] RM_UNIQUE_PROCESS[] rgApplications, uint nServices, - string[] rgsServiceNames); - - [DllImport("rstrtmgr.dll", CharSet = CharSet.Auto)] - static extern int RmStartSession(out uint pSessionHandle, int dwSessionFlags, string strSessionKey); - - [DllImport("rstrtmgr.dll")] - static extern int RmEndSession(uint pSessionHandle); - - [DllImport("rstrtmgr.dll")] - static extern int RmGetList(uint dwSessionHandle, out uint pnProcInfoNeeded, - ref uint pnProcInfo, [In, Out] RM_PROCESS_INFO[] rgAffectedApps, - ref uint lpdwRebootReasons); - - private static List EnumerateProcesses(uint pnProcInfoNeeded, uint handle, uint lpdwRebootReasons) - { - var processes = new List(10); - // Create an array to store the process results - var processInfo = new RM_PROCESS_INFO[pnProcInfoNeeded]; - var pnProcInfo = pnProcInfoNeeded; - - // Get the list - var res = RmGetList(handle, out pnProcInfoNeeded, ref pnProcInfo, processInfo, ref lpdwRebootReasons); - - if (res != 0) throw new Exception("Could not list processes locking resource."); - for (int i = 0; i < pnProcInfo; i++) - { - try - { - processes.Add(Process.GetProcessById(processInfo[i].Process.dwProcessId)); - } - catch (ArgumentException) { } // catch the error -- in case the process is no longer running - } - return processes; - } - } - } - public partial class Page_Profiles : Page - { - - - public MainWindow Main = GetMainWindow(); - string NAME__; - int NUMBER_MODS__; - string SIZE; - string VERSION; - string SAVE_NAME__; - string SAVE_PATH__; - string CURRENT_FILE__; - List Final_List = new List(); - public bool _Completed_Mod_call = false; - - bool Do_Not_save_Mods = false; - string[] Folders = new string[] { @"R2Northstar\plugins", @"R2Northstar\packages", @"bin\x64_dedi" }; - string[] Files = new string[] { "Northstar.dll", "NorthstarLauncher.exe", "r2ds.bat", "discord_game_sdk.dll" , "wsock32.dll", "ns_startup_args.txt", "ns_startup_args_dedi.txt", "placeholder_playerdata.pdata", "LEGAL.txt" }; - bool Skip_Mods = false; - bool Backup_Profile_Current = false; - bool cancel = false; - public CancellationTokenSource _cts = new CancellationTokenSource(); - public class PathModel - { - public string PathName { get; set; } - public string Path { get; set; } - } - class GZipStreamWithProgress : GZipStream - { - public event EventHandler ProgressChanged; - public event EventHandler CurrentFileChanged; - - private long totalBytesRead; - private string currentFile; - - public GZipStreamWithProgress(Stream stream, CompressionMode mode) : base(stream, mode) { } - - public override int Read(byte[] buffer, int offset, int count) - { - int bytesRead = base.Read(buffer, offset, count); - totalBytesRead += bytesRead; - - OnProgressChanged(totalBytesRead); - //Console.WriteLine(bytesRead); - return bytesRead; - } - - public void SetCurrentFile(string file) - { - currentFile = file; - OnCurrentFileChanged(file); - } - - protected void OnProgressChanged(long totalBytesRead) - { - double progress = (double)totalBytesRead / BaseStream.Length; - ProgressChanged?.Invoke(this, progress); - } - - protected void OnCurrentFileChanged(string file) - { - CurrentFileChanged?.Invoke(this, file); - } - } - public async void UnpackRead_BIN_INFO(string path) - { - try - - { - CURRENT_FILE__ = path; - string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - - //decompress the .vbp file - using (FileStream sourceStream = File.Open(path, FileMode.Open)) - { - - - if (sourceStream.Length == 0) - { - return; - } - using (var decompressionStream = new GZipStreamWithProgress(sourceStream, CompressionMode.Decompress)) - { - - if (File.Exists(appDataPath + @"\File_info.bin")) - { - File.Delete(appDataPath + @"\File_info.bin"); - } - // unpack the "directory.bin" file - using (FileStream decompressedFileStream = new FileStream(appDataPath + @"\File_info.bin", FileMode.Create)) - { - decompressionStream.CopyTo(decompressedFileStream); - } - - using (var stream = File.Open(appDataPath + @"\File_info.bin", FileMode.Open)) - { - var formatter = new BinaryFormatter(); - var data = (DirectoryData)formatter.Deserialize(stream); - string dataAsString = data.ToString(); - //string dataAsString = data.ToString(); - if (data != null) - { - if (data.NAME.Length > 1 && data.NORTHSTAR_VERSION.Length > 1 && data.TOTAL_SIZE_OF_FOLDERS.Length > 1) - { - I_NORTHSTAR_VERSION.Content = data.NORTHSTAR_VERSION; - I_NUMBER_OF_MODS.Content = data.MOD_COUNT; - I_TOTAL_SIZE.Content = data.TOTAL_SIZE_OF_FOLDERS; - NAME.Content = data.NAME; - - //Console.WriteLine(data.NAME + "\n" + data.NORTHSTAR_VERSION + "\n" + data.MOD_COUNT + "\n" + data.TOTAL_SIZE_OF_FOLDERS); - DispatchIfNecessary(async () => - { - Main.Profile_TAG.Content = data.NAME; - Properties.Settings.Default.Profile_Name = data.NAME; - Properties.Settings.Default.Save(); - - - }); - } - } - } - - } - } - - - if (File.Exists(appDataPath + @"\File_info.bin")) - { - File.Delete(appDataPath + @"\File_info.bin"); - } - - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } - - - public bool UnpackDirectory(string path, string targetDirectory, CancellationToken token) - { - try - { - - - string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - if (File.Exists(appDataPath + @"\directory_open.bin")) - { - - TryDeleteFile(appDataPath + @"\directory_open.bin"); - } - //decompress the bin.gz file - using (FileStream sourceStream = File.Open(path, FileMode.Open)) - { - - - if (sourceStream.Length == 0) - { - //Console.WriteLine("The file is empty."); - return false; - } - using (var decompressionStream = new GZipStreamWithProgress(sourceStream, CompressionMode.Decompress)) - { - - - // unpack the "directory.bin" file - using (FileStream decompressedFileStream = new FileStream(appDataPath + @"\directory_open.bin", FileMode.Create)) - { - decompressionStream.CopyTo(decompressedFileStream); - decompressionStream.Close(); - } - - decompressionStream.Close(); - - } - - // unpack the "directory.bin" file - using (var stream = File.Open(appDataPath + @"\directory_open.bin", FileMode.OpenOrCreate)) - { - var formatter = new BinaryFormatter(); - var data = (DirectoryData)formatter.Deserialize(stream); - string dataAsString = data.ToString(); - if (Skip_Mods == true) - { - data.Folders = data.Folders.Where(folder => !folder.Contains("R2Northstar\\packages")).ToArray(); - data.Files = data.Files.Where(file => !file.Path.Contains("R2Northstar\\packages")).ToArray(); - - } - if(Backup_Profile_Current == true) +namespace VTOL.Pages +{ + + /// + /// Interaction logic for Page_Profiles.xaml + /// + /// + namespace FileLockInfo + { + public static class Win32Processes + { + /// + /// Find out what process(es) have a lock on the specified file. + /// + /// Path of the file. + /// Processes locking the file + /// See also: + /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa373661(v=vs.85).aspx + /// http://wyupdate.googlecode.com/svn-history/r401/trunk/frmFilesInUse.cs (no copyright in code at time of viewing) + /// + public static List GetProcessesLockingFile(string path) + { + uint handle; + string key = Guid.NewGuid().ToString(); + int res = RmStartSession(out handle, 0, key); + + if (res != 0) throw new Exception("Could not begin restart session. Unable to determine file locker."); + + try + { + const int MORE_DATA = 234; + uint pnProcInfoNeeded, pnProcInfo = 0, lpdwRebootReasons = RmRebootReasonNone; + + string[] resources = { path }; // Just checking on one resource. + + res = RmRegisterResources(handle, (uint)resources.Length, resources, 0, null, 0, null); + + if (res != 0) throw new Exception("Could not register resource."); + + //Note: there's a race condition here -- the first call to RmGetList() returns + // the total number of process. However, when we call RmGetList() again to get + // the actual processes this number may have increased. + res = RmGetList(handle, out pnProcInfoNeeded, ref pnProcInfo, null, ref lpdwRebootReasons); + + if (res == MORE_DATA) + { + return EnumerateProcesses(pnProcInfoNeeded, handle, lpdwRebootReasons); + } + else if (res != 0) throw new Exception("Could not list processes locking resource. Failed to get size of result."); + } + finally + { + RmEndSession(handle); + } + + return new List(); + } + + + [StructLayout(LayoutKind.Sequential)] + public struct RM_UNIQUE_PROCESS + { + public int dwProcessId; + public System.Runtime.InteropServices.ComTypes.FILETIME ProcessStartTime; + } + + const int RmRebootReasonNone = 0; + const int CCH_RM_MAX_APP_NAME = 255; + const int CCH_RM_MAX_SVC_NAME = 63; + + public enum RM_APP_TYPE + { + RmUnknownApp = 0, + RmMainWindow = 1, + RmOtherWindow = 2, + RmService = 3, + RmExplorer = 4, + RmConsole = 5, + RmCritical = 1000 + } + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + public struct RM_PROCESS_INFO + { + public RM_UNIQUE_PROCESS Process; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCH_RM_MAX_APP_NAME + 1)] public string strAppName; + + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCH_RM_MAX_SVC_NAME + 1)] public string strServiceShortName; + + public RM_APP_TYPE ApplicationType; + public uint AppStatus; + public uint TSSessionId; + [MarshalAs(UnmanagedType.Bool)] public bool bRestartable; + } + + [DllImport("rstrtmgr.dll", CharSet = CharSet.Unicode)] + static extern int RmRegisterResources(uint pSessionHandle, uint nFiles, string[] rgsFilenames, + uint nApplications, [In] RM_UNIQUE_PROCESS[] rgApplications, uint nServices, + string[] rgsServiceNames); + + [DllImport("rstrtmgr.dll", CharSet = CharSet.Auto)] + static extern int RmStartSession(out uint pSessionHandle, int dwSessionFlags, string strSessionKey); + + [DllImport("rstrtmgr.dll")] + static extern int RmEndSession(uint pSessionHandle); + + [DllImport("rstrtmgr.dll")] + static extern int RmGetList(uint dwSessionHandle, out uint pnProcInfoNeeded, + ref uint pnProcInfo, [In, Out] RM_PROCESS_INFO[] rgAffectedApps, + ref uint lpdwRebootReasons); + + private static List EnumerateProcesses(uint pnProcInfoNeeded, uint handle, uint lpdwRebootReasons) + { + var processes = new List(10); + // Create an array to store the process results + var processInfo = new RM_PROCESS_INFO[pnProcInfoNeeded]; + var pnProcInfo = pnProcInfoNeeded; + + // Get the list + var res = RmGetList(handle, out pnProcInfoNeeded, ref pnProcInfo, processInfo, ref lpdwRebootReasons); + + if (res != 0) throw new Exception("Could not list processes locking resource."); + for (int i = 0; i < pnProcInfo; i++) + { + try + { + processes.Add(Process.GetProcessById(processInfo[i].Process.dwProcessId)); + } + catch (ArgumentException) { } // catch the error -- in case the process is no longer running + } + return processes; + } + } + } + public partial class Page_Profiles : Page + { + + + public MainWindow Main = GetMainWindow(); + string NAME__; + int NUMBER_MODS__; + string SIZE; + string VERSION; + string SAVE_NAME__; + string SAVE_PATH__; + string CURRENT_FILE__; + List Final_List = new List(); + public bool _Completed_Mod_call = false; + + bool Do_Not_save_Mods = false; + string[] Folders = new string[] { @"R2Northstar\plugins", @"R2Northstar\packages", @"bin\x64_dedi" }; + string[] Files = new string[] { "Northstar.dll", "NorthstarLauncher.exe", "r2ds.bat", "discord_game_sdk.dll", "wsock32.dll", "ns_startup_args.txt", "ns_startup_args_dedi.txt", "placeholder_playerdata.pdata", "LEGAL.txt" }; + bool Skip_Mods = false; + bool Backup_Profile_Current = false; + bool cancel = false; + public CancellationTokenSource _cts = new CancellationTokenSource(); + public class PathModel + { + public string PathName { get; set; } + public string Path { get; set; } + } + class GZipStreamWithProgress : GZipStream + { + public event EventHandler ProgressChanged; + public event EventHandler CurrentFileChanged; + + private long totalBytesRead; + private string currentFile; + + public GZipStreamWithProgress(Stream stream, CompressionMode mode) : base(stream, mode) { } + + public override int Read(byte[] buffer, int offset, int count) + { + int bytesRead = base.Read(buffer, offset, count); + totalBytesRead += bytesRead; + + OnProgressChanged(totalBytesRead); + //Console.WriteLine(bytesRead); + return bytesRead; + } + + public void SetCurrentFile(string file) + { + currentFile = file; + OnCurrentFileChanged(file); + } + + protected void OnProgressChanged(long totalBytesRead) + { + double progress = (double)totalBytesRead / BaseStream.Length; + ProgressChanged?.Invoke(this, progress); + } + + protected void OnCurrentFileChanged(string file) + { + CurrentFileChanged?.Invoke(this, file); + } + } + public async void UnpackRead_BIN_INFO(string path) + { + try + + { + CURRENT_FILE__ = path; + string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + + //decompress the .vbp file + using (FileStream sourceStream = File.Open(path, FileMode.Open)) + { + + + if (sourceStream.Length == 0) + { + return; + } + using (var decompressionStream = new GZipStreamWithProgress(sourceStream, CompressionMode.Decompress)) + { + + if (File.Exists(appDataPath + @"\File_info.bin")) + { + File.Delete(appDataPath + @"\File_info.bin"); + } + // unpack the "directory.bin" file + using (FileStream decompressedFileStream = new FileStream(appDataPath + @"\File_info.bin", FileMode.Create)) + { + decompressionStream.CopyTo(decompressedFileStream); + } + + using (var stream = File.Open(appDataPath + @"\File_info.bin", FileMode.Open)) + { + var formatter = new BinaryFormatter(); + var data = (DirectoryData)formatter.Deserialize(stream); + string dataAsString = data.ToString(); + //string dataAsString = data.ToString(); + if (data != null) + { + if (data.NAME.Length > 1 && data.NORTHSTAR_VERSION.Length > 1 && data.TOTAL_SIZE_OF_FOLDERS.Length > 1) + { + I_NORTHSTAR_VERSION.Content = data.NORTHSTAR_VERSION; + I_NUMBER_OF_MODS.Content = data.MOD_COUNT; + I_TOTAL_SIZE.Content = data.TOTAL_SIZE_OF_FOLDERS; + NAME.Content = data.NAME; + + //Console.WriteLine(data.NAME + "\n" + data.NORTHSTAR_VERSION + "\n" + data.MOD_COUNT + "\n" + data.TOTAL_SIZE_OF_FOLDERS); + DispatchIfNecessary(async () => + { + Main.Profile_TAG.Content = data.NAME; + Properties.Settings.Default.Profile_Name = data.NAME; + Properties.Settings.Default.Save(); + + + }); + } + } + } + + } + } + + + if (File.Exists(appDataPath + @"\File_info.bin")) + { + File.Delete(appDataPath + @"\File_info.bin"); + } + + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + + + public bool UnpackDirectory(string path, string targetDirectory, CancellationToken token) + { + try + { + + + string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + if (File.Exists(appDataPath + @"\directory_open.bin")) + { + + TryDeleteFile(appDataPath + @"\directory_open.bin"); + } + //decompress the bin.gz file + using (FileStream sourceStream = File.Open(path, FileMode.Open)) + { + + + if (sourceStream.Length == 0) + { + //Console.WriteLine("The file is empty."); + return false; + } + using (var decompressionStream = new GZipStreamWithProgress(sourceStream, CompressionMode.Decompress)) + { + + + // unpack the "directory.bin" file + using (FileStream decompressedFileStream = new FileStream(appDataPath + @"\directory_open.bin", FileMode.Create)) + { + decompressionStream.CopyTo(decompressedFileStream); + decompressionStream.Close(); + } + + decompressionStream.Close(); + + } + + // unpack the "directory.bin" file + using (var stream = File.Open(appDataPath + @"\directory_open.bin", FileMode.OpenOrCreate)) + { + var formatter = new BinaryFormatter(); + var data = (DirectoryData)formatter.Deserialize(stream); + string dataAsString = data.ToString(); + if (Skip_Mods == true) + { + data.Folders = data.Folders.Where(folder => !folder.Contains("R2Northstar\\packages")).ToArray(); + data.Files = data.Files.Where(file => !file.Path.Contains("R2Northstar\\packages")).ToArray(); + + } + if (Backup_Profile_Current == true) + { + + if (Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\")) + { + DispatchIfNecessary(async () => + { + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; + Main.Snackbar.Show("INFO", "Backing Up Current Profile now"); + Pack_Label.Content = "Packing the File/Folder"; + }); + + + Task packTask = Task.Run(() => Pack_NO_UI(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files)); + // Wait for the task to complete before continuing + packTask.Wait(); + + DispatchIfNecessary(async () => + { + LoadProfiles(); + }); + //TryCopyFile(Name_, Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name); + } + + } + double totalSize = data.Folders.Count() + data.Files.Count(); + double currentSize = 0; + string currentitem = ""; + + + foreach (string folder in data.Folders) + { + if (token.IsCancellationRequested || cancel == true) + { + return false; + } + string append = ""; + + + string foldername = System.IO.Path.GetFileName(folder); + currentitem = foldername; + int index = folder.LastIndexOf("Titanfall2"); + string fileNameUpToWord = folder.Substring(index + "Titanfall2".Length + 1); + string targetFolder = System.IO.Path.Combine(targetDirectory, fileNameUpToWord); + Directory.CreateDirectory(targetFolder); + // System.Threading.Thread.Sleep(50); // to simulate delay + currentSize++; + double progress = currentSize / totalSize * 100; + int progressInt = (int)Math.Round(progress); + DispatchIfNecessary(async () => + { + Current_File_Tag.Content = append + currentitem; + wave_progress.Text = progressInt + "%"; + wave_progress.Value = progressInt; + + }); + if (token.IsCancellationRequested || cancel == true) + { + return false; + } + //Console.WriteLine("Creating Folders " + progressInt + "% - " + currentitem); + } + + foreach (FileData file in data.Files) + { + if (token.IsCancellationRequested || cancel == true) + { + return false; + } + string append = ""; + string fileName = System.IO.Path.GetFileName(file.Path); + currentitem = fileName; + string targetFile = System.IO.Path.Combine(targetDirectory, fileName); + string parentFolder = System.IO.Path.GetDirectoryName(file.Path); + int index = file.Path.LastIndexOf("Titanfall2"); + string fileNameUpToWord = file.Path.Substring(index + "Titanfall2".Length + 1); + + TryCreateFile(file.Data, System.IO.Path.Combine(targetDirectory, fileNameUpToWord), true); + // else + //{ + //} + // System.Threading.Thread.Sleep(50); // to simulate delay + currentSize++; + double progress = currentSize / totalSize * 100; + int progressInt = (int)Math.Round(progress); + DispatchIfNecessary(async () => + { + Current_File_Tag.Content = append + currentitem; + wave_progress.Text = progressInt + "%"; + wave_progress.Value = progressInt; + + }); + if (token.IsCancellationRequested || cancel == true) + { + return false; + } + + //Console.WriteLine("Copying... " + progressInt + "% - " + currentitem); + } + CheckDirectory(appDataPath + @"\directory_open.bin", targetDirectory); + } + + + } + if (File.Exists(appDataPath + @"\directory_open.bin")) + { + File.Delete(appDataPath + @"\directory_open.bin"); + } + + return true; + + } + catch (FileNotFoundException ex) + { + //Console.WriteLine("The file could not be found: " + ex.Message); + return false; + + } + catch (DirectoryNotFoundException ex) + { + //Console.WriteLine("The directory could not be found: " + ex.Message); + return false; + + } + catch (IOException ex) + { + //Console.WriteLine("An IO error occurred: " + ex.Message); + return false; + + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + return false; + + } + return false; + + } + public async Task TryDeleteDirectoryAsync(string directoryPath, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 30) + { + if (directoryPath == null) + throw new ArgumentNullException(directoryPath); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (Directory.Exists(directoryPath)) + { + Directory.Delete(directoryPath, overwrite); + } + + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + public bool TryDeleteDirectory(string directoryPath, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 300) + { + if (directoryPath == null) + throw new ArgumentNullException(directoryPath); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (Directory.Exists(directoryPath)) + { + Directory.Delete(directoryPath, overwrite); + } + + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + public bool TryCreateDirectory(string directoryPath, int maxRetries = 10, int millisecondsDelay = 200) + { + if (directoryPath == null) + throw new ArgumentNullException(directoryPath); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + { + + Directory.CreateDirectory(directoryPath); + + if (Directory.Exists(directoryPath)) + { + + return true; + } + + + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + protected virtual bool IsFileLocked(string File) + { + try + { + FileInfo file = new FileInfo(File); + using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None)) + { + stream.Close(); + } + } + catch (IOException) + { + //the file is unavailable because it is: + //still being written to + //or being processed by another thread + //or does not exist (has already been processed) + return true; + } + + //file is not locked + return false; + } + public bool TryMoveFile(string Origin, string Destination, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 200) + { + if (IsFileLocked(Origin) || IsFileLocked(Destination)) + return false; + if (Origin == null) + throw new ArgumentNullException(Origin); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (File.Exists(Origin)) + { + File.Move(Origin, Destination, overwrite); + } + + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + + public bool TryCopyFile(string Origin, string Destination, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 300) + { + + if (Origin == null) + throw new ArgumentNullException(Origin); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + + + { + string directoryPath = System.IO.Path.GetDirectoryName(Destination); + if (!Directory.Exists(directoryPath)) + { + + Directory.CreateDirectory(directoryPath); + } + + if (File.Exists(Origin)) + { + + File.Copy(Origin, Destination, true); + + } + Thread.Sleep(millisecondsDelay); + + return true; + } + catch (IOException) + { + + + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + + public bool TryCreateFile(byte[] origin, string destination, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 300) + { + if (origin == null) + throw new ArgumentNullException(nameof(origin)); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + { + string directoryPath = System.IO.Path.GetDirectoryName(destination); + if (!Directory.Exists(directoryPath)) + { + Directory.CreateDirectory(directoryPath); + } + + using (var stream = new FileStream(destination, overwrite ? FileMode.Create : FileMode.CreateNew)) + { + stream.Write(origin, 0, origin.Length); + } + + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + public bool TryDeleteFile( + string Origin, + int maxRetries = 10, + int millisecondsDelay = 300) + { + if (Origin == null) + throw new ArgumentNullException(Origin); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) + { + try + { + if (File.Exists(Origin)) + { + File.Delete(Origin); + } + Thread.Sleep(millisecondsDelay); + + return true; + } + catch (IOException) + { + Thread.Sleep(millisecondsDelay); + } + catch (UnauthorizedAccessException) + { + Thread.Sleep(millisecondsDelay); + } + } + + return false; + } + public void DispatchIfNecessary(Action action) + { + if (!Dispatcher.CheckAccess()) + Dispatcher.Invoke(action); + else + action.Invoke(); + } + public class FileSizeCalculator + { + public static string Pack(string directoryPath, string[] folders, string[] files) + { + long totalSize = 0; + // check if the directory exists + if (Directory.Exists(directoryPath)) + { + // get the directory info + DirectoryInfo directory = new DirectoryInfo(directoryPath); + // iterate through the folders array + foreach (string folder in folders) + { + // check if the folder exists in the directory + if (directory.GetDirectories(folder).Length > 0) + { + // get the folder info + DirectoryInfo folderPath = directory.GetDirectories(folder)[0]; + // get the folder size + totalSize += GetDirectorySize(folderPath); + } + } + // iterate through the files array + foreach (string file in files) + { + // check if the file exists in the directory + if (directory.GetFiles(file).Length > 0) + { + // get the file info + FileInfo filePath = directory.GetFiles(file)[0]; + // get the file size + totalSize += filePath.Length; + } + } + } + return FormatSizeUnits(totalSize); + } + + private static long GetDirectorySize(DirectoryInfo directory) + { + long totalSize = 0; + // get the size of the files in the directory + foreach (FileInfo file in directory.GetFiles()) + { + totalSize += file.Length; + } + // get the size of the subdirectories + foreach (DirectoryInfo subDirectory in directory.GetDirectories()) + { + totalSize += GetDirectorySize(subDirectory); + } + return totalSize; + } + private static string FormatSizeUnits(long bytes) + { + string[] units = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; + double mod = 1024.0; + int i = 0; + while (bytes >= mod) + { + bytes /= (long)mod; + i++; + } + return $"{bytes:F2} {units[i]}"; + } + } + public string[] CheckAndRemoveMissingFolders(string[] folderNames) + { + return folderNames.Where(folder => Directory.Exists(folder)).ToArray(); + } + public string[] CheckAndRemoveMissingFilesAndFolders(string[] fileAndFolderNames) + { + try + { + + var validFilesAndFolders = new List(); + int totalFiles = fileAndFolderNames.Length; + int currentFile = 0; + // Console.Write("Checking files and folders ---> 0%"); + // Console.CursorVisible = false; // to hide the cursor + foreach (string fileOrFolderName in fileAndFolderNames) + { + currentFile++; + int progress = (currentFile * 100) / totalFiles; + // Console.SetCursorPosition(23, Console.CursorTop); // to set cursor position + // Console.Write(progress + "%"); + if (File.Exists(fileOrFolderName) || Directory.Exists(fileOrFolderName)) + { + validFilesAndFolders.Add(fileOrFolderName); + } + + } + return validFilesAndFolders.ToArray(); + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + return null; + } + + public string CheckAndRemoveMissingFileAndFolder(string fileOrFolderPath) + { + try + { + var validFilesAndFolders = new List(); + + if (File.Exists(fileOrFolderPath) || Directory.Exists(fileOrFolderPath)) + { + return fileOrFolderPath; + } + + + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + return null; + } + public void CheckDirectory(string binFilePath, string targetPath) + { + try + { + if (!Directory.Exists(binFilePath) || !Directory.Exists(targetPath)) + { + + + return; + } + // Deserialize the directory data from the bin file + DirectoryData data; + using (var stream = File.OpenRead(binFilePath)) + { + var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); + data = (DirectoryData)formatter.Deserialize(stream); + } + + var missingFolders = new List(); + var missingFiles = new List(); + string dataAsString = data.ToString(); + + // Check if folders exist + foreach (var folder in data.Folders) + { + + int index = folder.LastIndexOf("Titanfall2"); + string fileNameUpToWord = folder.Substring(index + "Titanfall2".Length + 1); + var targetFolder = System.IO.Path.Combine(targetPath, fileNameUpToWord); + + if (!Directory.Exists(targetFolder)) + { + missingFolders.Add(targetFolder); + } + } + + // Check if files exist + foreach (var file in data.Files) + { + int index = file.Path.LastIndexOf("Titanfall2"); + string fileNameUpToWord = file.Path.Substring(index + "Titanfall2".Length + 1); + var targetFile = System.IO.Path.Combine(targetPath, fileNameUpToWord); + + if (!File.Exists(targetFile)) + { + missingFiles.Add(targetFile); + } + } + + // Display summary of missing folders and files + var message = ""; + if (missingFolders.Count > 0) + { + message += $"Missing Folders: {string.Join(", ", missingFolders)}\n"; + } + if (missingFiles.Count > 0) + { + message += $"Missing Files: {string.Join(", ", missingFiles)}\n"; + } + + //if (!string.IsNullOrEmpty(message)) + //{ + // //MessageBox.Show(message, "Missing Folders and Files"); + //} + //else + //{ + + // //MessageBox.Show("Files Verified Successfully!"); + + //} + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + public static string[] TrimPathsToTitanfall2(string[] paths) + { + string titanfall2FolderName = "Titanfall2" + System.IO.Path.DirectorySeparatorChar; + string[] resultArray = new string[paths.Length]; + + for (int i = 0; i < paths.Length; i++) + { + string path = paths[i]; + + // Check if the path contains the Titanfall2 folder + int titanfall2Index = path.IndexOf(titanfall2FolderName, StringComparison.OrdinalIgnoreCase); + if (titanfall2Index < 0) + { + // Titanfall2 folder not found in path, return the original path + resultArray[i] = path; + } + else + { + // Trim the path to start at the Titanfall2 folder + int startIndex = titanfall2Index + titanfall2FolderName.Length; + string trimmedPath = path.Substring(startIndex); + + // Add the Titanfall2 folder to the trimmed path + trimmedPath = System.IO.Path.Combine(titanfall2FolderName, trimmedPath); + + resultArray[i] = trimmedPath; + } + } + + return resultArray; + } + public static string TrimPathToTitanfall2(string path) + { + string titanfall2FolderName = "Titanfall2" + System.IO.Path.DirectorySeparatorChar; + + // Check if the path contains the Titanfall2 folder + int titanfall2Index = path.IndexOf(titanfall2FolderName, StringComparison.OrdinalIgnoreCase); + if (titanfall2Index < 0) + { + // Titanfall2 folder not found in path, return the original path + return path; + } + else + { + // Trim the path to start at the Titanfall2 folder + int startIndex = titanfall2Index + titanfall2FolderName.Length; + string trimmedPath = path.Substring(startIndex); + + // Add the Titanfall2 folder to the trimmed path + trimmedPath = System.IO.Path.Combine(titanfall2FolderName, trimmedPath); + + return trimmedPath; + } + } + public bool ListDirectory(string path, string[] includedFolders, string[] includedFiles, CancellationToken token) + { + try + { + + if (!Directory.Exists(SAVE_PATH__)) + { + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Main.Snackbar.ShowAsync("ERROR!", "The Profile Path" + SAVE_PATH__ + "Is Invalid!"); + return false; + } + + //Console.WriteLine("Starting"); + var allFolders = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); + var allFiles = Directory.GetFiles(path, "*", SearchOption.AllDirectories); + IEnumerable includedFoldersPath = Enumerable.Empty(); + IEnumerable includedFilesPath = Enumerable.Empty(); + if (token.IsCancellationRequested) + return false; + + + + if (Do_Not_save_Mods == true) + { + //string NS_Mod_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; + //Console.WriteLine("Skipped Mods"); + + includedFoldersPath = allFolders.Where(f => !f.Contains("R2Northstar\\packages") && includedFolders.Any(i => f.StartsWith(System.IO.Path.Combine(path, i)))); + + includedFilesPath = allFiles.Where(f => !f.Contains("R2Northstar\\packages") && includedFiles.Contains(System.IO.Path.GetFileName(f)) || includedFoldersPath.Any(folder => f.StartsWith(folder))); + + } + else + { + includedFoldersPath = allFolders.Where(f => includedFolders.Any(i => f.StartsWith(System.IO.Path.Combine(path, i)))); + includedFilesPath = allFiles.Where(f => includedFiles.Contains(System.IO.Path.GetFileName(f)) || includedFoldersPath.Any(folder => f.StartsWith(folder))); + + } + if (token.IsCancellationRequested) + return false; + //Console.WriteLine("\n\n\n\n\n FILES \n\n\n\n\n"); + //Console.WriteLine(string.Join("\n ", includedFilesPath.ToArray())); + //Console.WriteLine("\n\n\n\n\n FILES IN DATA \n\n\n\n\n"); + //Console.WriteLine(string.Join("\n ", TrimPathsToTitanfall2(includedFilesPath.ToArray()))); + + var data = new DirectoryData + { + + Folders = TrimPathsToTitanfall2(CheckAndRemoveMissingFilesAndFolders(includedFoldersPath.Select(f => f).ToArray())), + Files = includedFilesPath.Select(f => new FileData { Path = TrimPathToTitanfall2(CheckAndRemoveMissingFileAndFolder(f)), Data = File.ReadAllBytes(f) }).ToArray(), + NORTHSTAR_VERSION = VERSION, + NAME = SAVE_NAME__, + MOD_COUNT = NUMBER_MODS__, + TOTAL_SIZE_OF_FOLDERS = SIZE + + }; + //foreach(var f in data.Files) + // { + + // Console.WriteLine("\n" + f.Path); + // Console.WriteLine("\n" + f.Data.Length.ToString()); + + + //} + if (token.IsCancellationRequested) + return false; + + using (var stream = File.Open(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin", FileMode.Create)) + { + var formatter = new BinaryFormatter(); + formatter.Serialize(stream, data); + } + if (token.IsCancellationRequested) + return false; + //compress the bin file + using (FileStream sourceStream = File.Open(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin", FileMode.Open)) + using (FileStream targetStream = File.Create(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".vbp")) + using (GZipStreamWithProgress compressionStream = new GZipStreamWithProgress(targetStream, CompressionMode.Compress)) + { + sourceStream.CopyTo(compressionStream); + } + + + + + + if (File.Exists(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin")) + { + + File.Delete(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin"); + + } + cancel = false; + + CancelWork(); + return true; + + + + } + catch (OperationCanceledException) + { + //Console.WriteLine("Cancelled!"); + return false; + + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + return false; + } + + return false; + + } + + + + + + + [Serializable] + public class DirectoryData + { + public string[] Folders { get; set; } + public FileData[] Files { get; set; } + public string NORTHSTAR_VERSION { get; set; } + public string NAME { get; set; } + public int MOD_COUNT { get; set; } + public string TOTAL_SIZE_OF_FOLDERS { get; set; } + + public override string ToString() + { + var paths = Folders.Concat(Files.Select(f => f.Path)); + return string.Join(" ", paths); + } + } + [Serializable] + public class FileData + { + public string Path { get; set; } + public byte[] Data { get; set; } + } + + public string EnforceWindowsStringName(string input) + { + // Replace spaces with underscores + input = input.Replace(" ", "_"); + + // Remove any invalid characters + input = Regex.Replace(input, @"[^a-zA-Z0-9_]", ""); + + // Remove any leading or trailing underscores + input = input.Trim('_'); + + // Ensure the first character is a letter or number + if (!char.IsLetterOrDigit(input[0])) + { + input = "_" + input; + } + + return input; + } + public void FadeControl(Control control, bool fadeIn, double duration = 1) + { + if (fadeIn) + { + control.Visibility = Visibility.Visible; + var animation = new DoubleAnimation + { + From = 0, + To = 1, + Duration = new Duration(TimeSpan.FromSeconds(duration)) + }; + control.BeginAnimation(UIElement.OpacityProperty, animation); + } + else + { + var animation = new DoubleAnimation + { + From = 1, + To = 0, + Duration = new Duration(TimeSpan.FromSeconds(duration)) + }; + animation.Completed += (sender, e) => control.Visibility = Visibility.Hidden; + control.BeginAnimation(UIElement.OpacityProperty, animation); + } + } + private void Pack_NO_UI(string target_directory, string[] folders_, string[] files_) + { + _cts = new CancellationTokenSource(); + var token = _cts.Token; + + bool result = false; + string NS_Mod_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; + + if (Directory.Exists(target_directory) && Directory.Exists(NS_Mod_Dir)) + { + System.IO.DirectoryInfo rootDirs = new DirectoryInfo(@NS_Mod_Dir); + System.IO.DirectoryInfo[] subDirs = null; + subDirs = rootDirs.GetDirectories(); + string currentDateTimeString = DateTime.Now.ToString("yyyyMMdd-HHmmss"); + VERSION = Main.User_Settings_Vars.CurrentVersion; + NUMBER_MODS__ = subDirs.Length; + SIZE = FileSizeCalculator.Pack(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files); + SAVE_NAME__ = "BACKUP - " + currentDateTimeString; + SAVE_PATH__ = Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\"; + + while (!token.IsCancellationRequested) + { + // Check the token's cancellation status + token.ThrowIfCancellationRequested(); + // Add your long running operation here + result = ListDirectory(target_directory, folders_, files_, token); + } + + + if (result == true) + { + DispatchIfNecessary(async () => + { + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + Main.Snackbar.Show("SUCCESS!", "The Profile " + SAVE_NAME__ + " has been created"); + cancel = false; + + }); + } + else + { + DispatchIfNecessary(async () => + { + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "The Backup Failed!"); + }); + } + } + + } + + private async void Pack(string target_directory, string[] folders_, string[] files_) + { + try + { + _cts = new CancellationTokenSource(); + var token = _cts.Token; + + DispatchIfNecessary(async () => + { + // Perform the long-running operation on a background thread + try + { + bool result = false; + var result_ = await Task.Run(() => + { + while (!token.IsCancellationRequested) + { + // Check the token's cancellation status + token.ThrowIfCancellationRequested(); + // Add your long running operation here + result = ListDirectory(target_directory, folders_, files_, token); + } + return result; + }, token); + if (result == true) + { + //Console.WriteLine(result); + //Console.WriteLine("Complete!"); + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + Main.Snackbar.Show("SUCCESS!", "The Profile " + SAVE_NAME__ + "Has Been Packed"); + Loading_Panel.Visibility = Visibility.Hidden; + wave_progress.Visibility = Visibility.Hidden; + Circe_progress.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + cancel = false; + + DispatchIfNecessary(async () => + { + LoadProfiles(); + //PopulateListBoxWithRandomPaths(); + }); + } + else + { + //Console.WriteLine(result); + //Console.WriteLine("Failed!"); + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "The Profile " + SAVE_NAME__ + "Failed To Be Packed"); + } + } + catch (OperationCanceledException) + { + // Handle the cancellation + //Console.WriteLine("Cancelled!"); + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "The Profile Creation of" + SAVE_NAME__ + "Failed"); + wave_progress.Visibility = Visibility.Visible; + Circe_progress.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + + } + finally + { + cancel = false; + + wave_progress.Visibility = Visibility.Visible; + Circe_progress.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + } + }); + } + + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + + public class Card_ + { + public string Profile_Path_ { get; set; } + public string Profile_Name_ { get; set; } + public string Profile_Date_ { get; set; } + } + + private async void LoadProfiles() + { + try + { + + // Clear current listbox items + Profile_List_Box.ItemsSource = null; + Final_List.Clear(); + + // Get all .vpb files in the directory + string[] vpbFiles = await Task.Run(() => Directory.GetFiles(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles", "*.vbp", SearchOption.AllDirectories)); + if (vpbFiles != null) + { + + foreach (string file in vpbFiles) + { + + FileInfo fileInfo = new FileInfo(file); + long fileSize = fileInfo.Length; + DateTime creationDate = fileInfo.CreationTime; + string formattedCreationDate = creationDate.ToString("MM/dd/yyyy HH:mm:ss"); + Final_List.Add(new Card_ { Profile_Name_ = fileInfo.Name, Profile_Date_ = formattedCreationDate, Profile_Path_ = fileInfo.FullName }); + + } + await Task.Delay(10); + Profile_List_Box.ItemsSource = Final_List; + + //foreach (string file in Final_List) + //{ + // Profile_List_Box.Items.Add(file); + + // Profile_List_Box.Refresh(); + // await Task.Delay(50); + //} + // Hide loading icon + // LoadingIcon.Visibility = Visibility.Collapsed; + // Output the list to console + //vpbFiles.ToList().ForEach(//Console.WriteLine); + + _Completed_Mod_call = true; + } + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + private async void UnpackandCheck(string vtol_profiles_file_bin, string Target_Dir) + { + DispatchIfNecessary(async () => + { + Options_Panel.Visibility = Visibility.Visible; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + + }); + //Console.WriteLine("Unpacking!"); + + if (File.Exists(vtol_profiles_file_bin)) + { + //Console.WriteLine("Found!"); + DispatchIfNecessary(async () => + { + Current_File_Tag.Content = "Backing Up vtol_profiles_file_bin"; + wave_progress.Text = 0 + "%"; + wave_progress.Value = 0; + Loading_Panel.Visibility = Visibility.Visible; + + }); + _cts = new CancellationTokenSource(); + var token = _cts.Token; + try + { + // Display a message to the user indicating that the operation has started + + // Perform the long-running operation on a background thread + + var result = await Task.Run(() => + { + return UnpackDirectory(vtol_profiles_file_bin, Target_Dir, token); + }); + + if (result == true) + { + DispatchIfNecessary(async () => + { + //Console.WriteLine(result); + //Console.WriteLine("Complete!"); + Main.Snackbar.Title = VTOL.Resources.Languages.Language.SUCCESS; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + Main.Snackbar.Message = "Operation Complete - The Profile is now active"; + Main.Snackbar.Show(); + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + }); + cancel = false; + + } + else + { + DispatchIfNecessary(async () => { + Main.Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Main.Snackbar.Message = "Operation Failed / Cancelled"; + Main.Snackbar.Show(); + //Console.WriteLine(result); + //Console.WriteLine("Failed!"); + wave_progress.Visibility = Visibility.Visible; + Circe_progress.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + }); + cancel = false; + - if (Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\")) - { - DispatchIfNecessary(async () => - { - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; - Main.Snackbar.Show("INFO", "Backing Up Current Profile now"); - Pack_Label.Content = "Packing the File/Folder"; - }); - - - Task packTask = Task.Run(() => Pack_NO_UI(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files)); - // Wait for the task to complete before continuing - packTask.Wait(); - - DispatchIfNecessary(async () => - { - LoadProfiles(); - }); - //TryCopyFile(Name_, Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name); - } - - } - double totalSize = data.Folders.Count() + data.Files.Count(); - double currentSize = 0; - string currentitem = ""; - - - foreach (string folder in data.Folders) - { - if (token.IsCancellationRequested || cancel == true) - { - return false; - } - string append = ""; - - - string foldername = System.IO.Path.GetFileName(folder); - currentitem = foldername; - int index = folder.LastIndexOf("Titanfall2"); - string fileNameUpToWord = folder.Substring(index + "Titanfall2".Length + 1); - string targetFolder = System.IO.Path.Combine(targetDirectory, fileNameUpToWord); - Directory.CreateDirectory(targetFolder); - // System.Threading.Thread.Sleep(50); // to simulate delay - currentSize++; - double progress = currentSize / totalSize * 100; - int progressInt = (int)Math.Round(progress); - DispatchIfNecessary(async () => - { - Current_File_Tag.Content = append + currentitem; - wave_progress.Text = progressInt + "%"; - wave_progress.Value = progressInt; - - }); - if (token.IsCancellationRequested || cancel == true) - { - return false; - } - //Console.WriteLine("Creating Folders " + progressInt + "% - " + currentitem); - } - - foreach (FileData file in data.Files) - { - if (token.IsCancellationRequested || cancel == true) - { - return false; - } - string append = ""; - string fileName = System.IO.Path.GetFileName(file.Path); - currentitem = fileName; - string targetFile = System.IO.Path.Combine(targetDirectory, fileName); - string parentFolder = System.IO.Path.GetDirectoryName(file.Path); - int index = file.Path.LastIndexOf("Titanfall2"); - string fileNameUpToWord = file.Path.Substring(index + "Titanfall2".Length + 1); - - TryCreateFile(file.Data, System.IO.Path.Combine(targetDirectory, fileNameUpToWord), true); - // else - //{ - //} - // System.Threading.Thread.Sleep(50); // to simulate delay - currentSize++; - double progress = currentSize / totalSize * 100; - int progressInt = (int)Math.Round(progress); - DispatchIfNecessary(async () => - { - Current_File_Tag.Content = append + currentitem; - wave_progress.Text = progressInt + "%"; - wave_progress.Value = progressInt; - - }); - if (token.IsCancellationRequested || cancel == true) - { - return false; - } - - //Console.WriteLine("Copying... " + progressInt + "% - " + currentitem); - } - CheckDirectory(appDataPath + @"\directory_open.bin", targetDirectory); - } - - - } - if (File.Exists(appDataPath + @"\directory_open.bin")) - { - File.Delete(appDataPath + @"\directory_open.bin"); - } - - return true; - - } - catch (FileNotFoundException ex) - { - //Console.WriteLine("The file could not be found: " + ex.Message); - return false; - - } - catch (DirectoryNotFoundException ex) - { - //Console.WriteLine("The directory could not be found: " + ex.Message); - return false; - - } - catch (IOException ex) - { - //Console.WriteLine("An IO error occurred: " + ex.Message); - return false; - - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - return false; - - } - return false; - - } - public async Task TryDeleteDirectoryAsync(string directoryPath, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 30) - { - if (directoryPath == null) - throw new ArgumentNullException(directoryPath); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (Directory.Exists(directoryPath)) - { - Directory.Delete(directoryPath, overwrite); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryDeleteDirectory(string directoryPath, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 300) - { - if (directoryPath == null) - throw new ArgumentNullException(directoryPath); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (Directory.Exists(directoryPath)) - { - Directory.Delete(directoryPath, overwrite); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryCreateDirectory(string directoryPath, int maxRetries = 10, int millisecondsDelay = 200) - { - if (directoryPath == null) - throw new ArgumentNullException(directoryPath); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - - Directory.CreateDirectory(directoryPath); - - if (Directory.Exists(directoryPath)) - { - - return true; - } - - - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - protected virtual bool IsFileLocked(string File) - { - try - { - FileInfo file = new FileInfo(File); - using (FileStream stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None)) - { - stream.Close(); - } - } - catch (IOException) - { - //the file is unavailable because it is: - //still being written to - //or being processed by another thread - //or does not exist (has already been processed) - return true; - } - - //file is not locked - return false; - } - public bool TryMoveFile(string Origin, string Destination, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 200) - { - if(IsFileLocked(Origin) || IsFileLocked(Destination)) - return false; - if (Origin == null) - throw new ArgumentNullException(Origin); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (File.Exists(Origin)) - { - File.Move(Origin, Destination, overwrite); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - - public bool TryCopyFile(string Origin, string Destination, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 300) - { - - if (Origin == null) - throw new ArgumentNullException(Origin); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - - - { - string directoryPath = System.IO.Path.GetDirectoryName(Destination); - if (!Directory.Exists(directoryPath)){ - - Directory.CreateDirectory(directoryPath); } - - if (File.Exists(Origin)) - { - - File.Copy(Origin, Destination, true); - - } - Thread.Sleep(millisecondsDelay); - - return true; - } - catch (IOException) - { - - - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - - public bool TryCreateFile(byte[] origin, string destination, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 300) - { - if (origin == null) - throw new ArgumentNullException(nameof(origin)); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - string directoryPath = System.IO.Path.GetDirectoryName(destination); - if (!Directory.Exists(directoryPath)) - { - Directory.CreateDirectory(directoryPath); - } - - using (var stream = new FileStream(destination, overwrite ? FileMode.Create : FileMode.CreateNew)) - { - stream.Write(origin, 0, origin.Length); - } - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public bool TryDeleteFile( - string Origin, - int maxRetries = 10, - int millisecondsDelay = 300) - { - if (Origin == null) - throw new ArgumentNullException(Origin); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - try - { - if (File.Exists(Origin)) - { - File.Delete(Origin); - } - Thread.Sleep(millisecondsDelay); - - return true; - } - catch (IOException) - { - Thread.Sleep(millisecondsDelay); - } - catch (UnauthorizedAccessException) - { - Thread.Sleep(millisecondsDelay); - } - } - - return false; - } - public void DispatchIfNecessary(Action action) - { - if (!Dispatcher.CheckAccess()) - Dispatcher.Invoke(action); - else - action.Invoke(); - } - public class FileSizeCalculator - { - public static string Pack(string directoryPath, string[] folders, string[] files) - { - long totalSize = 0; - // check if the directory exists - if (Directory.Exists(directoryPath)) - { - // get the directory info - DirectoryInfo directory = new DirectoryInfo(directoryPath); - // iterate through the folders array - foreach (string folder in folders) - { - // check if the folder exists in the directory - if (directory.GetDirectories(folder).Length > 0) - { - // get the folder info - DirectoryInfo folderPath = directory.GetDirectories(folder)[0]; - // get the folder size - totalSize += GetDirectorySize(folderPath); - } - } - // iterate through the files array - foreach (string file in files) - { - // check if the file exists in the directory - if (directory.GetFiles(file).Length > 0) - { - // get the file info - FileInfo filePath = directory.GetFiles(file)[0]; - // get the file size - totalSize += filePath.Length; - } - } - } - return FormatSizeUnits(totalSize); - } - - private static long GetDirectorySize(DirectoryInfo directory) - { - long totalSize = 0; - // get the size of the files in the directory - foreach (FileInfo file in directory.GetFiles()) - { - totalSize += file.Length; - } - // get the size of the subdirectories - foreach (DirectoryInfo subDirectory in directory.GetDirectories()) - { - totalSize += GetDirectorySize(subDirectory); - } - return totalSize; - } - private static string FormatSizeUnits(long bytes) - { - string[] units = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" }; - double mod = 1024.0; - int i = 0; - while (bytes >= mod) - { - bytes /= (long)mod; - i++; - } - return $"{bytes:F2} {units[i]}"; - } - } - public string[] CheckAndRemoveMissingFolders(string[] folderNames) - { - return folderNames.Where(folder => Directory.Exists(folder)).ToArray(); - } - public string[] CheckAndRemoveMissingFilesAndFolders(string[] fileAndFolderNames) - { - try - { - - var validFilesAndFolders = new List(); - int totalFiles = fileAndFolderNames.Length; - int currentFile = 0; - // Console.Write("Checking files and folders ---> 0%"); - // Console.CursorVisible = false; // to hide the cursor - foreach (string fileOrFolderName in fileAndFolderNames) - { - currentFile++; - int progress = (currentFile * 100) / totalFiles; - // Console.SetCursorPosition(23, Console.CursorTop); // to set cursor position - // Console.Write(progress + "%"); - if (File.Exists(fileOrFolderName) || Directory.Exists(fileOrFolderName)) - { - validFilesAndFolders.Add(fileOrFolderName); - } - - } - return validFilesAndFolders.ToArray(); - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - return null; - } - - public string CheckAndRemoveMissingFileAndFolder(string fileOrFolderPath) - { - try - { - var validFilesAndFolders = new List(); - - if (File.Exists(fileOrFolderPath) || Directory.Exists(fileOrFolderPath)) - { - return fileOrFolderPath; - } - - - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - return null; - } - public void CheckDirectory(string binFilePath, string targetPath) - { - try { - if (!Directory.Exists(binFilePath) || !Directory.Exists(targetPath)) { - - - return; - } - // Deserialize the directory data from the bin file - DirectoryData data; - using (var stream = File.OpenRead(binFilePath)) - { - var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); - data = (DirectoryData)formatter.Deserialize(stream); - } - - var missingFolders = new List(); - var missingFiles = new List(); - string dataAsString = data.ToString(); - - // Check if folders exist - foreach (var folder in data.Folders) - { - - int index = folder.LastIndexOf("Titanfall2"); - string fileNameUpToWord = folder.Substring(index + "Titanfall2".Length + 1); - var targetFolder = System.IO.Path.Combine(targetPath, fileNameUpToWord); - - if (!Directory.Exists(targetFolder)) - { - missingFolders.Add(targetFolder); - } - } - - // Check if files exist - foreach (var file in data.Files) - { - int index = file.Path.LastIndexOf("Titanfall2"); - string fileNameUpToWord = file.Path.Substring(index + "Titanfall2".Length + 1); - var targetFile = System.IO.Path.Combine(targetPath, fileNameUpToWord); - - if (!File.Exists(targetFile)) - { - missingFiles.Add(targetFile); - } - } - - // Display summary of missing folders and files - var message = ""; - if (missingFolders.Count > 0) - { - message += $"Missing Folders: {string.Join(", ", missingFolders)}\n"; - } - if (missingFiles.Count > 0) - { - message += $"Missing Files: {string.Join(", ", missingFiles)}\n"; - } - - //if (!string.IsNullOrEmpty(message)) - //{ - // //MessageBox.Show(message, "Missing Folders and Files"); - //} - //else - //{ - - // //MessageBox.Show("Files Verified Successfully!"); - - //} - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } - public static string[] TrimPathsToTitanfall2(string[] paths) - { - string titanfall2FolderName = "Titanfall2" + System.IO.Path.DirectorySeparatorChar; - string[] resultArray = new string[paths.Length]; - - for (int i = 0; i < paths.Length; i++) - { - string path = paths[i]; - - // Check if the path contains the Titanfall2 folder - int titanfall2Index = path.IndexOf(titanfall2FolderName, StringComparison.OrdinalIgnoreCase); - if (titanfall2Index < 0) - { - // Titanfall2 folder not found in path, return the original path - resultArray[i] = path; - } - else - { - // Trim the path to start at the Titanfall2 folder - int startIndex = titanfall2Index + titanfall2FolderName.Length; - string trimmedPath = path.Substring(startIndex); - - // Add the Titanfall2 folder to the trimmed path - trimmedPath = System.IO.Path.Combine(titanfall2FolderName, trimmedPath); - - resultArray[i] = trimmedPath; - } - } - - return resultArray; - } - public static string TrimPathToTitanfall2(string path) - { - string titanfall2FolderName = "Titanfall2" + System.IO.Path.DirectorySeparatorChar; - - // Check if the path contains the Titanfall2 folder - int titanfall2Index = path.IndexOf(titanfall2FolderName, StringComparison.OrdinalIgnoreCase); - if (titanfall2Index < 0) - { - // Titanfall2 folder not found in path, return the original path - return path; - } - else - { - // Trim the path to start at the Titanfall2 folder - int startIndex = titanfall2Index + titanfall2FolderName.Length; - string trimmedPath = path.Substring(startIndex); - - // Add the Titanfall2 folder to the trimmed path - trimmedPath = System.IO.Path.Combine(titanfall2FolderName, trimmedPath); - - return trimmedPath; - } - } - public bool ListDirectory(string path, string[] includedFolders, string[] includedFiles, CancellationToken token) - { - try { - - if (!Directory.Exists(SAVE_PATH__)) - { - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.ShowAsync("ERROR!", "The Profile Path" + SAVE_PATH__ + "Is Invalid!"); - return false; - } - - //Console.WriteLine("Starting"); - var allFolders = Directory.GetDirectories(path, "*", SearchOption.AllDirectories); - var allFiles = Directory.GetFiles(path, "*", SearchOption.AllDirectories); - IEnumerable includedFoldersPath = Enumerable.Empty(); - IEnumerable includedFilesPath = Enumerable.Empty(); - if (token.IsCancellationRequested) - return false; - - - - if (Do_Not_save_Mods == true) - { - //string NS_Mod_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; - //Console.WriteLine("Skipped Mods"); - - includedFoldersPath = allFolders.Where(f => !f.Contains("R2Northstar\\packages") && includedFolders.Any(i => f.StartsWith(System.IO.Path.Combine(path, i)))); - - includedFilesPath = allFiles.Where(f => !f.Contains("R2Northstar\\packages") && includedFiles.Contains(System.IO.Path.GetFileName(f)) || includedFoldersPath.Any(folder => f.StartsWith(folder))); - - } - else - { - includedFoldersPath = allFolders.Where(f => includedFolders.Any(i => f.StartsWith(System.IO.Path.Combine(path, i)))); - includedFilesPath = allFiles.Where(f => includedFiles.Contains(System.IO.Path.GetFileName(f)) || includedFoldersPath.Any(folder => f.StartsWith(folder))); - - } - if (token.IsCancellationRequested) - return false; - //Console.WriteLine("\n\n\n\n\n FILES \n\n\n\n\n"); - //Console.WriteLine(string.Join("\n ", includedFilesPath.ToArray())); - //Console.WriteLine("\n\n\n\n\n FILES IN DATA \n\n\n\n\n"); - //Console.WriteLine(string.Join("\n ", TrimPathsToTitanfall2(includedFilesPath.ToArray()))); - - var data = new DirectoryData - { - - Folders = TrimPathsToTitanfall2(CheckAndRemoveMissingFilesAndFolders(includedFoldersPath.Select(f => f).ToArray())), - Files = includedFilesPath.Select(f => new FileData { Path = TrimPathToTitanfall2(CheckAndRemoveMissingFileAndFolder(f)), Data = File.ReadAllBytes(f) }).ToArray(), - NORTHSTAR_VERSION = VERSION, - NAME = SAVE_NAME__, - MOD_COUNT = NUMBER_MODS__, - TOTAL_SIZE_OF_FOLDERS = SIZE - - }; - //foreach(var f in data.Files) - // { - - // Console.WriteLine("\n" + f.Path); - // Console.WriteLine("\n" + f.Data.Length.ToString()); - - - //} - if (token.IsCancellationRequested) - return false; - - using (var stream = File.Open(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin", FileMode.Create)) - { - var formatter = new BinaryFormatter(); - formatter.Serialize(stream, data); - } - if (token.IsCancellationRequested) - return false; - //compress the bin file - using (FileStream sourceStream = File.Open(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin", FileMode.Open)) - using (FileStream targetStream = File.Create(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".vbp")) - using (GZipStreamWithProgress compressionStream = new GZipStreamWithProgress(targetStream, CompressionMode.Compress)) - { - sourceStream.CopyTo(compressionStream); - } - - - - - - if (File.Exists(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin")) - { - - File.Delete(SAVE_PATH__ + @"\" + EnforceWindowsStringName(SAVE_NAME__) + ".bin"); - - } - cancel = false; - - CancelWork(); - return true; - - - - } - catch (OperationCanceledException) - { - //Console.WriteLine("Cancelled!"); - return false; - - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - return false; - } - - return false; - - } - - - - - - - [Serializable] - public class DirectoryData - { - public string[] Folders { get; set; } - public FileData[] Files { get; set; } - public string NORTHSTAR_VERSION { get; set; } - public string NAME { get; set; } - public int MOD_COUNT { get; set; } - public string TOTAL_SIZE_OF_FOLDERS { get; set; } - - public override string ToString() - { - var paths = Folders.Concat(Files.Select(f => f.Path)); - return string.Join(" ", paths); - } - } - [Serializable] - public class FileData - { - public string Path { get; set; } - public byte[] Data { get; set; } - } - - public string EnforceWindowsStringName(string input) - { - // Replace spaces with underscores - input = input.Replace(" ", "_"); - - // Remove any invalid characters - input = Regex.Replace(input, @"[^a-zA-Z0-9_]", ""); - - // Remove any leading or trailing underscores - input = input.Trim('_'); - - // Ensure the first character is a letter or number - if (!char.IsLetterOrDigit(input[0])) - { - input = "_" + input; - } - - return input; - } - public void FadeControl(Control control, bool fadeIn, double duration = 1) - { - if (fadeIn) - { - control.Visibility = Visibility.Visible; - var animation = new DoubleAnimation - { - From = 0, - To = 1, - Duration = new Duration(TimeSpan.FromSeconds(duration)) - }; - control.BeginAnimation(UIElement.OpacityProperty, animation); - } - else - { - var animation = new DoubleAnimation - { - From = 1, - To = 0, - Duration = new Duration(TimeSpan.FromSeconds(duration)) - }; - animation.Completed += (sender, e) => control.Visibility = Visibility.Hidden; - control.BeginAnimation(UIElement.OpacityProperty, animation); - } - } - private void Pack_NO_UI(string target_directory, string[] folders_, string[] files_) - { - _cts = new CancellationTokenSource(); - var token = _cts.Token; - - bool result = false; - string NS_Mod_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; - - if (Directory.Exists(target_directory) && Directory.Exists(NS_Mod_Dir)) - { - System.IO.DirectoryInfo rootDirs = new DirectoryInfo(@NS_Mod_Dir); - System.IO.DirectoryInfo[] subDirs = null; - subDirs = rootDirs.GetDirectories(); - string currentDateTimeString = DateTime.Now.ToString("yyyyMMdd-HHmmss"); - VERSION = Main.User_Settings_Vars.CurrentVersion; - NUMBER_MODS__ = subDirs.Length; - SIZE = FileSizeCalculator.Pack(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files); - SAVE_NAME__ = "BACKUP - " + currentDateTimeString; - SAVE_PATH__ = Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\"; - - while (!token.IsCancellationRequested) - { - // Check the token's cancellation status - token.ThrowIfCancellationRequested(); - // Add your long running operation here - result = ListDirectory(target_directory, folders_, files_, token); - } - - - if (result == true) - { - DispatchIfNecessary(async () => - { - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; - Main.Snackbar.Show("SUCCESS!", "The Profile " + SAVE_NAME__ + " has been created"); - cancel = false; - - }); - } - else - { - DispatchIfNecessary(async () => - { - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "The Backup Failed!"); - }); - } - } - - } - - private async void Pack(string target_directory, string[] folders_, string[] files_) - { - try - { - _cts = new CancellationTokenSource(); - var token = _cts.Token; - - DispatchIfNecessary(async () => - { - // Perform the long-running operation on a background thread - try - { - bool result = false; - var result_ = await Task.Run(() => - { - while (!token.IsCancellationRequested) - { - // Check the token's cancellation status - token.ThrowIfCancellationRequested(); - // Add your long running operation here - result = ListDirectory(target_directory, folders_, files_, token); - } - return result; - }, token); - if (result == true) - { - //Console.WriteLine(result); - //Console.WriteLine("Complete!"); - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; - Main.Snackbar.Show("SUCCESS!", "The Profile " + SAVE_NAME__ + "Has Been Packed"); - Loading_Panel.Visibility = Visibility.Hidden; - wave_progress.Visibility = Visibility.Hidden; - Circe_progress.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - cancel = false; - - DispatchIfNecessary(async () => - { - LoadProfiles(); - //PopulateListBoxWithRandomPaths(); - }); - } - else - { - //Console.WriteLine(result); - //Console.WriteLine("Failed!"); - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "The Profile " + SAVE_NAME__ + "Failed To Be Packed"); - } - } - catch (OperationCanceledException) - { - // Handle the cancellation - //Console.WriteLine("Cancelled!"); - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "The Profile Creation of" + SAVE_NAME__ + "Failed"); - wave_progress.Visibility = Visibility.Visible; - Circe_progress.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - - } - finally - { - cancel = false; - - wave_progress.Visibility = Visibility.Visible; - Circe_progress.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - } - }); - } - - - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } - - public class Card_ - { - public string Profile_Path_ { get; set; } - public string Profile_Name_ { get; set; } - public string Profile_Date_ { get; set; } - } - - private async void LoadProfiles() - { - try - { - - // Clear current listbox items - Profile_List_Box.ItemsSource = null; - Final_List.Clear(); - - // Get all .vpb files in the directory - string[] vpbFiles = await Task.Run(() => Directory.GetFiles(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles", "*.vbp", SearchOption.AllDirectories)); - if (vpbFiles != null) - { - - foreach (string file in vpbFiles) - { - - FileInfo fileInfo = new FileInfo(file); - long fileSize = fileInfo.Length; - DateTime creationDate = fileInfo.CreationTime; - string formattedCreationDate = creationDate.ToString("MM/dd/yyyy HH:mm:ss"); - Final_List.Add(new Card_ { Profile_Name_ = fileInfo.Name, Profile_Date_ = formattedCreationDate, Profile_Path_ = fileInfo.FullName }); - - } - await Task.Delay(10); - Profile_List_Box.ItemsSource = Final_List; - - //foreach (string file in Final_List) - //{ - // Profile_List_Box.Items.Add(file); - - // Profile_List_Box.Refresh(); - // await Task.Delay(50); - //} - // Hide loading icon - // LoadingIcon.Visibility = Visibility.Collapsed; - // Output the list to console - //vpbFiles.ToList().ForEach(//Console.WriteLine); - - _Completed_Mod_call = true; - } - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } - private async void UnpackandCheck(string vtol_profiles_file_bin, string Target_Dir) - { - DispatchIfNecessary(async () => - { - Options_Panel.Visibility = Visibility.Visible; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - - }); - //Console.WriteLine("Unpacking!"); - - if (File.Exists(vtol_profiles_file_bin)) - { - //Console.WriteLine("Found!"); - DispatchIfNecessary(async () => - { - Current_File_Tag.Content = "Backing Up vtol_profiles_file_bin"; - wave_progress.Text = 0 + "%"; - wave_progress.Value = 0; - Loading_Panel.Visibility = Visibility.Visible; - - }); - _cts = new CancellationTokenSource(); - var token = _cts.Token; - try - { - // Display a message to the user indicating that the operation has started - - // Perform the long-running operation on a background thread - - var result = await Task.Run(() => - { - return UnpackDirectory(vtol_profiles_file_bin, Target_Dir, token); - }); - - if (result == true) - { - DispatchIfNecessary(async () => - { - //Console.WriteLine(result); - //Console.WriteLine("Complete!"); - Main.Snackbar.Title = VTOL.Resources.Languages.Language.SUCCESS; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; - Main.Snackbar.Message = "Operation Complete - The Profile is now active"; - Main.Snackbar.Show(); - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - }); - cancel = false; - - } - else - { - DispatchIfNecessary(async () => - { - Main.Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.Message = "Operation Failed / Cancelled"; - Main.Snackbar.Show(); - //Console.WriteLine(result); - //Console.WriteLine("Failed!"); - wave_progress.Visibility = Visibility.Visible; - Circe_progress.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - }); - cancel = false; - - - } - DispatchIfNecessary(async () => - { - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - }); - cancel = false; - - - } - - - - catch (OperationCanceledException) - { - DispatchIfNecessary(async () => - { - Main.Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.Message = "Operation Failed / Cancelled"; - Main.Snackbar.Show(); - wave_progress.Visibility = Visibility.Visible; - Circe_progress.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - }); - cancel = false; - - } - - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - - DispatchIfNecessary(async () => - { - Main.Snackbar.Title = "FATAL"; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; - Main.Snackbar.Message = "FAILED\n Could Not Find the file - " + vtol_profiles_file_bin; - Main.Snackbar.Show(); - wave_progress.Visibility = Visibility.Visible; - Circe_progress.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - cancel = false; - }); - } - } - else - { - DispatchIfNecessary(async () => - { - Main.Snackbar.Title = "FATAL"; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; - Main.Snackbar.Message = "FAILED\n Could Not Find the file - " + vtol_profiles_file_bin; - Main.Snackbar.Show(); - wave_progress.Visibility = Visibility.Visible; - Circe_progress.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - - cancel = false; - - }); - - } - - } - - public void CancelWork() - { - if (_cts != null) - { - _cts?.Cancel(); - } - } - public Page_Profiles() - { - - - InitializeComponent(); - - - //Load paths here - if (!Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles")) - { - - Directory.CreateDirectory(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles"); - } - SAVE_PATH__ = Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles"; - Profile_Location.Text = SAVE_PATH__; - } - public static MainWindow GetMainWindow() - { - MainWindow mainWindow = null; - - foreach (Window window in Application.Current.Windows) - { - Type type = typeof(MainWindow); - if (window != null && window.DependencyObjectType.Name == type.Name) - { - mainWindow = (MainWindow)window; - if (mainWindow != null) - { - break; - } - } - } - - - return mainWindow; - - } - private void ComboBox_DropDownClosed(object sender, EventArgs e) - { - Extra_Menu.Text = null; - } - public class DirectoryReader - { - public static DirectoryData ReadDirectory(string path) - { - using (var stream = File.Open(path, FileMode.Open)) - { - var formatter = new BinaryFormatter(); - return (DirectoryData)formatter.Deserialize(stream); - - } - } - } - public void FadeControl(UIElement control, bool? show = null, double duration = 0.5) - { - DispatchIfNecessary(async () => - { - // Determine the target visibility - Visibility targetVisibility; - if (show == true) - { - targetVisibility = Visibility.Visible; - } - else if (show == false) - { - targetVisibility = Visibility.Hidden; - } - else - { - targetVisibility = control.Visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; - } - - // Check if the control is already at the target visibility - if (control.Visibility == targetVisibility) - return; - - // Create a DoubleAnimation to animate the control's opacity - DoubleAnimation da = new DoubleAnimation - { - From = control.Opacity, - To = targetVisibility == Visibility.Visible ? 1 : 0, - Duration = new Duration(TimeSpan.FromSeconds(duration)), - AutoReverse = false - }; - - // Start the animation - control.BeginAnimation(OpacityProperty, da); - - // Update the control's visibility - control.Visibility = targetVisibility; - - // Wait for the animation to finish - await Task.Delay((int)(duration * 1000)); - }); - } - - public void Export(string path, string[] includedFolders, string[] includedFiles) { - try { - //Profile_Name.Text = SAVE_NAME__; - //Profile_Location.Text = SAVE_PATH__; - string NS_Mod_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; - if (!Directory.Exists(NS_Mod_Dir)) - { - return; - } - System.IO.DirectoryInfo rootDirs = new DirectoryInfo(@NS_Mod_Dir); - System.IO.DirectoryInfo[] subDirs = null; - subDirs = rootDirs.GetDirectories(); - - - VERSION = Main.User_Settings_Vars.CurrentVersion; - SAVE_NAME__ = Profile_Name.Text; - NUMBER_MODS__ = subDirs.Length; - SIZE = FileSizeCalculator.Pack(path, includedFolders, includedFiles); - - Options_Panel.Visibility = Visibility.Visible; - Export_Profile_Options_Panel.Visibility = Visibility.Visible; - NORTHSTAR_VERSION.Content = VERSION; - NUMBER_OF_MODS.Content = NUMBER_MODS__; - TOTAL_SIZE.Content = SIZE; - Current_File_Tag.Content = "Processing the Directory - " + path; - - wave_progress.Visibility = Visibility.Hidden; - Circe_progress.Visibility = Visibility.Visible; - - } - - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } - - - private void Export_Profile_Click(object sender, RoutedEventArgs e) - { - cancel = false; - - Export(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files); - } - - private void Import_Profile_Click(object sender, RoutedEventArgs e) - { - try - { - - if (sender.GetType() == typeof(Wpf.Ui.Controls.Button)) - { - cancel = false; - - - Wpf.Ui.Controls.Button Button_ = (Wpf.Ui.Controls.Button)sender; - string Name_ = Button_.Tag.ToString(); - if (Name_ != null) - { - if (File.Exists(Name_)) - { - FileInfo f = new FileInfo(Name_); - //FadeControl(Options_Panel, true, 2); - DispatchIfNecessary(async () => - { - Options_Panel.Visibility = Visibility.Visible; - }); - if (Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles") && !File.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name)) - { - TryCopyFile(Name_, Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name); + DispatchIfNecessary(async () => + { + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + }); + cancel = false; + + + } + + catch (OperationCanceledException) + { + DispatchIfNecessary(async () => + { + Main.Snackbar.Title = VTOL.Resources.Languages.Language.ERROR; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; + Main.Snackbar.Message = "Operation Failed / Cancelled"; + Main.Snackbar.Show(); + wave_progress.Visibility = Visibility.Visible; + Circe_progress.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + }); + cancel = false; + + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + + DispatchIfNecessary(async () => + { + Main.Snackbar.Title = "FATAL"; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; + Main.Snackbar.Message = "FAILED\n Could Not Find the file - " + vtol_profiles_file_bin; + Main.Snackbar.Show(); + wave_progress.Visibility = Visibility.Visible; + Circe_progress.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + cancel = false; + }); + } + } + else + { + DispatchIfNecessary(async () => + { + Main.Snackbar.Title = "FATAL"; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; + Main.Snackbar.Message = "FAILED\n Could Not Find the file - " + vtol_profiles_file_bin; + Main.Snackbar.Show(); + wave_progress.Visibility = Visibility.Visible; + Circe_progress.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + + cancel = false; + + }); - } - DispatchIfNecessary(async () => - { - UnpackRead_BIN_INFO(Name_); + } + + } + + public void CancelWork() + { + if (_cts != null) + { + _cts?.Cancel(); + } + } + public Page_Profiles() + { - LoadProfiles(); + InitializeComponent(); - }); - DispatchIfNecessary(async () => - { - FadeControl(Add_Profile_Options_Panel, true, 1.5); - }); - } - } - } + //Load paths here + if (!Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles")) + { + Directory.CreateDirectory(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles"); + } + SAVE_PATH__ = Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles"; + Profile_Location.Text = SAVE_PATH__; + } + public static MainWindow GetMainWindow() + { + MainWindow mainWindow = null; + foreach (Window window in Application.Current.Windows) + { + Type type = typeof(MainWindow); + if (window != null && window.DependencyObjectType.Name == type.Name) + { + mainWindow = (MainWindow)window; + if (mainWindow != null) + { + break; + } + } + } + return mainWindow; + } + private void ComboBox_DropDownClosed(object sender, EventArgs e) + { + Extra_Menu.Text = null; + } + public class DirectoryReader + { + public static DirectoryData ReadDirectory(string path) + { + using (var stream = File.Open(path, FileMode.Open)) + { + var formatter = new BinaryFormatter(); + return (DirectoryData)formatter.Deserialize(stream); - } + } + } + } + public void FadeControl(UIElement control, bool? show = null, double duration = 0.5) + { + DispatchIfNecessary(async () => + { + // Determine the target visibility + Visibility targetVisibility; + if (show == true) + { + targetVisibility = Visibility.Visible; + } + else if (show == false) + { + targetVisibility = Visibility.Hidden; + } + else + { + targetVisibility = control.Visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; + } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + // Check if the control is already at the target visibility + if (control.Visibility == targetVisibility) + return; + // Create a DoubleAnimation to animate the control's opacity + DoubleAnimation da = new DoubleAnimation + { + From = control.Opacity, + To = targetVisibility == Visibility.Visible ? 1 : 0, + Duration = new Duration(TimeSpan.FromSeconds(duration)), + AutoReverse = false + }; - } - - + // Start the animation + control.BeginAnimation(OpacityProperty, da); - } + // Update the control's visibility + control.Visibility = targetVisibility; - private void Button_Click(object sender, RoutedEventArgs e) - { + // Wait for the animation to finish + await Task.Delay((int)(duration * 1000)); + }); + } - } + public void Export(string path, string[] includedFolders, string[] includedFiles) + { + try + { + //Profile_Name.Text = SAVE_NAME__; + //Profile_Location.Text = SAVE_PATH__; + string NS_Mod_Dir = Main.User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\packages"; + if (!Directory.Exists(NS_Mod_Dir)) + { + return; + } + System.IO.DirectoryInfo rootDirs = new DirectoryInfo(@NS_Mod_Dir); + System.IO.DirectoryInfo[] subDirs = null; + subDirs = rootDirs.GetDirectories(); + + + VERSION = Main.User_Settings_Vars.CurrentVersion; + SAVE_NAME__ = Profile_Name.Text; + NUMBER_MODS__ = subDirs.Length; + SIZE = FileSizeCalculator.Pack(path, includedFolders, includedFiles); + + Options_Panel.Visibility = Visibility.Visible; + Export_Profile_Options_Panel.Visibility = Visibility.Visible; + NORTHSTAR_VERSION.Content = VERSION; + NUMBER_OF_MODS.Content = NUMBER_MODS__; + TOTAL_SIZE.Content = SIZE; + Current_File_Tag.Content = "Processing the Directory - " + path; + + wave_progress.Visibility = Visibility.Hidden; + Circe_progress.Visibility = Visibility.Visible; + + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } - private void Button_Click_1(object sender, RoutedEventArgs e) - { - } - private void Export_Profile_BTN(object sender, RoutedEventArgs e) + private void Export_Profile_Click(object sender, RoutedEventArgs e) { - try { - Loading_Panel.Visibility = Visibility.Visible; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - Options_Panel.Visibility = Visibility.Visible; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; - Main.Snackbar.Show("INFO", "Packing Profile now"); - Pack_Label.Content = "Packing the File/Folder"; + cancel = false; - Pack(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files); - } + Export(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files); + } - catch (Exception ex) -{ - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } + private void Import_Profile_Click(object sender, RoutedEventArgs e) + { + try + { -} + if (sender.GetType() == typeof(Wpf.Ui.Controls.Button)) + { + cancel = false; - private void Import_BTN(object sender, RoutedEventArgs e) - { - Pack_Label.Content = "UnPacking the File/Folder"; - cancel = false; - - UnpackandCheck(CURRENT_FILE__, Main.User_Settings_Vars.NorthstarInstallLocation); - - } - - private void I_Export_Mods_Checked(object sender, RoutedEventArgs e) - { - Skip_Mods = true; - - } - - private void I_Export_Mods_Unchecked(object sender, RoutedEventArgs e) - { - Skip_Mods = false; - } - - private void Exit_BTN_Click(object sender, RoutedEventArgs e) - { - try { - CancelWork(); - Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - cancel = true; - } - - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } - - private void Add_Profile_Click(object sender, RoutedEventArgs e) - { - try - { - string path = null; - - - var dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog(); - dialog.Filter = "vbp files (*.vbp)|*.vbp"; // Only show .vbp files - dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); - - string FileName_Last; - var result = dialog.ShowDialog(); - if (result == true) - { - path = dialog.FileName; - - } - if (File.Exists(path)) - { - FileInfo f = new FileInfo(path); - FadeControl(Options_Panel, true, 2); - if (Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles")) + + Wpf.Ui.Controls.Button Button_ = (Wpf.Ui.Controls.Button)sender; + string Name_ = Button_.Tag.ToString(); + if (Name_ != null) { - TryCopyFile(path, Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\"+f.Name); + if (File.Exists(Name_)) + { + FileInfo f = new FileInfo(Name_); + //FadeControl(Options_Panel, true, 2); + DispatchIfNecessary(async () => + { + Options_Panel.Visibility = Visibility.Visible; + }); + if (Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles") && !File.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name)) + { + TryCopyFile(Name_, Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name); - } + } + DispatchIfNecessary(async () => + { + UnpackRead_BIN_INFO(Name_); - UnpackRead_BIN_INFO(path); - DispatchIfNecessary(async () => - { + LoadProfiles(); - LoadProfiles(); + }); + DispatchIfNecessary(async () => + { + FadeControl(Add_Profile_Options_Panel, true, 1.5); - }); - DispatchIfNecessary(async () => - { - FadeControl(Add_Profile_Options_Panel, true, 1.5); + }); + } + } + } - }); - } - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - } + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + + + } + - private void Extra_Menu_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - -} - private void save_Lcoation_Btn_Click(object sender, RoutedEventArgs e) - { + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + + } + + private void Button_Click_1(object sender, RoutedEventArgs e) + { + } + + private void Export_Profile_BTN(object sender, RoutedEventArgs e) + { + try + { + Loading_Panel.Visibility = Visibility.Visible; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + Options_Panel.Visibility = Visibility.Visible; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; + Main.Snackbar.Show("INFO", "Packing Profile now"); + Pack_Label.Content = "Packing the File/Folder"; + + Pack(Main.User_Settings_Vars.NorthstarInstallLocation, Folders, Files); + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + + } + + private void Import_BTN(object sender, RoutedEventArgs e) + { + Pack_Label.Content = "UnPacking the File/Folder"; + cancel = false; + + UnpackandCheck(CURRENT_FILE__, Main.User_Settings_Vars.NorthstarInstallLocation); + + } + + private void I_Export_Mods_Checked(object sender, RoutedEventArgs e) + { + Skip_Mods = true; + + } + + private void I_Export_Mods_Unchecked(object sender, RoutedEventArgs e) + { + Skip_Mods = false; + } + + private void Exit_BTN_Click(object sender, RoutedEventArgs e) + { + try + { + CancelWork(); + Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + cancel = true; + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + + private void Add_Profile_Click(object sender, RoutedEventArgs e) + { + try + { + string path = null; + + + var dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog(); + dialog.Filter = "vbp files (*.vbp)|*.vbp"; // Only show .vbp files + dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); + + string FileName_Last; + var result = dialog.ShowDialog(); + if (result == true) + { + path = dialog.FileName; + + } + if (File.Exists(path)) + { + FileInfo f = new FileInfo(path); + FadeControl(Options_Panel, true, 2); + if (Directory.Exists(Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles")) + { + TryCopyFile(path, Main.User_Settings_Vars.NorthstarInstallLocation + "VTOL_profiles\\" + f.Name); + + + + } + + UnpackRead_BIN_INFO(path); + + DispatchIfNecessary(async () => + { + + LoadProfiles(); + + }); + DispatchIfNecessary(async () => + { + FadeControl(Add_Profile_Options_Panel, true, 1.5); + + }); + } - var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); - //dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); - string path = null; - var result = dialog.ShowDialog(); - if (result == true) - { - path = dialog.SelectedPath; - } - if (Directory.Exists(path)) - { - SAVE_PATH__ = path; - Profile_Location.Text = SAVE_PATH__; - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; - Main.Snackbar.Show("SUCCESS!", "The Path has been set to - " + path); - } - } + } - private void Exit_BTN_ADD_Prfl_Click(object sender, RoutedEventArgs e) - { - CancelWork(); - Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - cancel = true; + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + + private void Extra_Menu_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + + } + + private void save_Lcoation_Btn_Click(object sender, RoutedEventArgs e) + { + + var dialog = new Ookii.Dialogs.Wpf.VistaFolderBrowserDialog(); + //dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); + string path = null; - } + var result = dialog.ShowDialog(); + if (result == true) + { + path = dialog.SelectedPath; - private void Export_Mods_Checked(object sender, RoutedEventArgs e) - { - Do_Not_save_Mods = true; - } + } + if (Directory.Exists(path)) + { + SAVE_PATH__ = path; + Profile_Location.Text = SAVE_PATH__; + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + Main.Snackbar.Show("SUCCESS!", "The Path has been set to - " + path); + } + } + + private void Exit_BTN_ADD_Prfl_Click(object sender, RoutedEventArgs e) + { + CancelWork(); + Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + cancel = true; + + } - private void Export_Mods_Unchecked(object sender, RoutedEventArgs e) - { - Do_Not_save_Mods = false; + private void Export_Mods_Checked(object sender, RoutedEventArgs e) + { + Do_Not_save_Mods = true; - } + } - private void Profile_Name_TextChanged(object sender, TextChangedEventArgs e) - { - if (Profile_Name.Text != "Default Profile") - { + private void Export_Mods_Unchecked(object sender, RoutedEventArgs e) + { + Do_Not_save_Mods = false; - Profile_Name.Foreground = Brushes.White; - } - SAVE_NAME__ = Profile_Name.Text; - } + } - private void Exit_BTN_ADD_Prfl_Click_1(object sender, RoutedEventArgs e) + private void Profile_Name_TextChanged(object sender, TextChangedEventArgs e) { - try { - CancelWork(); - Options_Panel.Visibility = Visibility.Hidden; - Export_Profile_Options_Panel.Visibility = Visibility.Hidden; - Loading_Panel.Visibility = Visibility.Hidden; - Add_Profile_Options_Panel.Visibility = Visibility.Hidden; - cancel = true; + if (Profile_Name.Text != "Default Profile") + { - } + Profile_Name.Foreground = Brushes.White; + } + SAVE_NAME__ = Profile_Name.Text; + } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } + private void Exit_BTN_ADD_Prfl_Click_1(object sender, RoutedEventArgs e) + { + try + { + CancelWork(); + Options_Panel.Visibility = Visibility.Hidden; + Export_Profile_Options_Panel.Visibility = Visibility.Hidden; + Loading_Panel.Visibility = Visibility.Hidden; + Add_Profile_Options_Panel.Visibility = Visibility.Hidden; + cancel = true; + + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } - } + } private void Page_Unloaded(object sender, RoutedEventArgs e) { - // _cts.Dispose(); + // _cts.Dispose(); - } + } private void Page_Loaded(object sender, RoutedEventArgs e) { - try { - DispatchIfNecessary(async () => - { - if (Main.Profile_TAG.Content == null || Main.Profile_TAG.Content == "" || Main.Profile_TAG.Content.ToString().Length < 1) - { - Clear_Profile.IsEnabled = false; - - }else if (Properties.Settings.Default.Profile_Name == "" || Properties.Settings.Default.Profile_Name == null || Properties.Settings.Default.Profile_Name.Length < 1) + try + { + DispatchIfNecessary(async () => { - Clear_Profile.IsEnabled = false; + if (Main.Profile_TAG.Content == null || Main.Profile_TAG.Content == "" || Main.Profile_TAG.Content.ToString().Length < 1) + { + Clear_Profile.IsEnabled = false; + + } + else if (Properties.Settings.Default.Profile_Name == "" || Properties.Settings.Default.Profile_Name == null || Properties.Settings.Default.Profile_Name.Length < 1) + { + Clear_Profile.IsEnabled = false; - } - else - { - Clear_Profile.IsEnabled = true; + } + else + { + Clear_Profile.IsEnabled = true; - } - LoadProfiles(); - //PopulateListBoxWithRandomPaths(); - }); + } + LoadProfiles(); + //PopulateListBoxWithRandomPaths(); + }); - } + } - catch (Exception ex) -{ - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } -} - + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } - - private void Profile_List_Box_Loaded(object sender, RoutedEventArgs e) + + + private void Profile_List_Box_Loaded(object sender, RoutedEventArgs e) { - - - } + + + } private void Card___MouseRightButtonDown(object sender, MouseButtonEventArgs e) { - try - { - string Triggger = null; + try + { + string Triggger = null; - if (_Completed_Mod_call == true) - { - Wpf.Ui.Controls.CardControl Card; - if (sender.GetType() == typeof(Wpf.Ui.Controls.CardControl)) - { - Card = sender as Wpf.Ui.Controls.CardControl; + if (_Completed_Mod_call == true) + { + Wpf.Ui.Controls.CardControl Card; + if (sender.GetType() == typeof(Wpf.Ui.Controls.CardControl)) + { + Card = sender as Wpf.Ui.Controls.CardControl; - DockPanel DockPanel_ = FindVisualChild(Card); - Triggger = DockPanel_.Tag.ToString(); + DockPanel DockPanel_ = FindVisualChild(Card); + Triggger = DockPanel_.Tag.ToString(); - if (Triggger != null) - { - if (Triggger == "Hidden") - { + if (Triggger != null) + { + if (Triggger == "Hidden") + { - DoubleAnimation da = new DoubleAnimation - { - From = DockPanel_.Opacity, - To = 1, - Duration = new Duration(TimeSpan.FromSeconds(0.4)), - AutoReverse = false - }; - DockPanel_.BeginAnimation(OpacityProperty, da); - DockPanel_.IsEnabled = true; - Triggger = "Visible"; - DockPanel_.Tag = "Visible"; - DockPanel_.Visibility = Visibility.Visible; + DoubleAnimation da = new DoubleAnimation + { + From = DockPanel_.Opacity, + To = 1, + Duration = new Duration(TimeSpan.FromSeconds(0.4)), + AutoReverse = false + }; + DockPanel_.BeginAnimation(OpacityProperty, da); + DockPanel_.IsEnabled = true; + Triggger = "Visible"; + DockPanel_.Tag = "Visible"; + DockPanel_.Visibility = Visibility.Visible; - } - else if (Triggger == "Visible") - { + } + else if (Triggger == "Visible") + { - DoubleAnimation da = new DoubleAnimation - { - From = DockPanel_.Opacity, - To = 0, - Duration = new Duration(TimeSpan.FromSeconds(0.4)), - AutoReverse = false - }; - DockPanel_.BeginAnimation(OpacityProperty, da); - DockPanel_.IsEnabled = false; - Triggger = "Hidden"; - DockPanel_.Tag = "Hidden"; + DoubleAnimation da = new DoubleAnimation + { + From = DockPanel_.Opacity, + To = 0, + Duration = new Duration(TimeSpan.FromSeconds(0.4)), + AutoReverse = false + }; + DockPanel_.BeginAnimation(OpacityProperty, da); + DockPanel_.IsEnabled = false; + Triggger = "Hidden"; + DockPanel_.Tag = "Hidden"; - } - } + } + } - } + } - } - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } + } - } + } private void CardControl_IsMouseCaptureWithinChanged(object sender, DependencyPropertyChangedEventArgs e) { @@ -2097,62 +2098,62 @@ private void CardControl_GotFocus(object sender, RoutedEventArgs e) { } - private childItem FindVisualChild(DependencyObject obj) + private childItem FindVisualChild(DependencyObject obj) where childItem : DependencyObject - { - try - { - for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) - { - DependencyObject child = VisualTreeHelper.GetChild(obj, i); - if (child != null && child is childItem) - { - return (childItem)child; - } - else - { - childItem childOfChild = FindVisualChild(child); - if (childOfChild != null) - return childOfChild; - } - } - return null; - - } - catch (Exception ex) - { - - } - return null; - } - private void Card___Loaded(object sender, RoutedEventArgs e) - { - try - { - if (_Completed_Mod_call == true) - { - Wpf.Ui.Controls.CardControl Card; - if (sender.GetType() == typeof(Wpf.Ui.Controls.CardControl)) - { - Card = sender as Wpf.Ui.Controls.CardControl; - - DockPanel DockPanel_ = FindVisualChild(Card); - - DockPanel_.Visibility = Visibility.Hidden; - - DockPanel_.Tag = "Hidden"; - DockPanel_.IsEnabled = false; - DockPanel_.Opacity = 0.0; - - } - } - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - - } - } + { + try + { + for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + { + DependencyObject child = VisualTreeHelper.GetChild(obj, i); + if (child != null && child is childItem) + { + return (childItem)child; + } + else + { + childItem childOfChild = FindVisualChild(child); + if (childOfChild != null) + return childOfChild; + } + } + return null; + + } + catch (Exception ex) + { + + } + return null; + } + private void Card___Loaded(object sender, RoutedEventArgs e) + { + try + { + if (_Completed_Mod_call == true) + { + Wpf.Ui.Controls.CardControl Card; + if (sender.GetType() == typeof(Wpf.Ui.Controls.CardControl)) + { + Card = sender as Wpf.Ui.Controls.CardControl; + + DockPanel DockPanel_ = FindVisualChild(Card); + + DockPanel_.Visibility = Visibility.Hidden; + + DockPanel_.Tag = "Hidden"; + DockPanel_.IsEnabled = false; + DockPanel_.Opacity = 0.0; + + } + } + } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + + } + } private void CardControl_MouseMove(object sender, MouseEventArgs e) { @@ -2161,83 +2162,84 @@ private void CardControl_MouseMove(object sender, MouseEventArgs e) private void Delete_Btn_Click(object sender, RoutedEventArgs e) { - try - { + try + { + + if (sender.GetType() == typeof(Wpf.Ui.Controls.Button)) + { - if (sender.GetType() == typeof(Wpf.Ui.Controls.Button)) - { + Wpf.Ui.Controls.Button Button_ = (Wpf.Ui.Controls.Button)sender; + string Name_ = Button_.Tag.ToString(); + if (Name_ != null) + { - Wpf.Ui.Controls.Button Button_ = (Wpf.Ui.Controls.Button)sender; - string Name_ = Button_.Tag.ToString(); - if (Name_ != null) - { + TryDeleteFile(Name_); + DispatchIfNecessary(async () => + { + LoadProfiles(); + //PopulateListBoxWithRandomPaths(); + }); + } + } - TryDeleteFile(Name_); - DispatchIfNecessary(async () => - { - LoadProfiles(); - //PopulateListBoxWithRandomPaths(); - }); - } - } + } - } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - - } - } + } + } private void I_Backup_Mods_Unchecked(object sender, RoutedEventArgs e) { - Backup_Profile_Current = false; + Backup_Profile_Current = false; - } + } private void I_Backup_Mods_Checked(object sender, RoutedEventArgs e) { - Backup_Profile_Current = true; + Backup_Profile_Current = true; - } + } private void Clear_Profile_Click(object sender, RoutedEventArgs e) { - try { - DispatchIfNecessary(async () => - { - Main.Profile_TAG.Content = ""; - Properties.Settings.Default.Profile_Name = ""; - Properties.Settings.Default.Save(); - Main.Profile_TAG.Content = Properties.Settings.Default.Profile_Name; - Main.Profile_TAG.Refresh(); - }); - } - - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - - - } -} + try + { + DispatchIfNecessary(async () => + { + Main.Profile_TAG.Content = ""; + Properties.Settings.Default.Profile_Name = ""; + Properties.Settings.Default.Save(); + Main.Profile_TAG.Content = Properties.Settings.Default.Profile_Name; + Main.Profile_TAG.Refresh(); + }); + } + + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + + + } + } private void Clear_Profile_Initialized(object sender, EventArgs e) { - - } + + } private void Clear_Profile_Loaded(object sender, RoutedEventArgs e) { - - } + + } } - } +} diff --git a/VTOL_2.0.0/Pages/Page_Server.xaml.cs b/VTOL_2.0.0/Pages/Page_Server.xaml.cs index 3d0237af..c2a70e5b 100644 --- a/VTOL_2.0.0/Pages/Page_Server.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Server.xaml.cs @@ -8,25 +8,17 @@ using System.IO; using System.IO.Compression; using System.Linq; -using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; using Wpf.Ui.Common; using Wpf.Ui.Controls; using static VTOL.Pages.Server_Template_Selector; -using MessageBox = System.Windows.MessageBox; using Path = System.IO.Path; using TextBox = System.Windows.Controls.TextBox; @@ -106,7 +98,7 @@ public partial class Page_Server : Page private string Auto_exec = ""; private bool Started_Selection = false; private string _filePath; - public bool init_ = false; + public bool init_ = false; Snackbar SnackBar; public Page_Server() { @@ -165,7 +157,7 @@ private ArrayList Load_Args() Arg_List.Add(new Arg_Set { - Name = items.Name.Trim().ToUpper().Replace("_"," "), + Name = items.Name.Trim().ToUpper().Replace("_", " "), Type = items.Type, Default = items.Default, Description = items.Description_Tooltip, @@ -222,12 +214,12 @@ public async Task saveAsyncFile(string Text, string Filename, bool ForceTxt = tr private void OnKeyDownHandler_Dedi_Arg(object sender, KeyEventArgs e) { - + } private void OnKeyDownHandler_Nrml_Arg(object sender, KeyEventArgs e) { - + } private void Validate_Combo_Box(object sender, SelectionChangedEventArgs e) { @@ -347,7 +339,7 @@ private void Validate_Combo_Box(object sender, SelectionChangedEventArgs e) SnackBar.Show(); Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } } @@ -385,7 +377,7 @@ private void ValidationTextBox(object sender, TextCompositionEventArgs e) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } @@ -414,7 +406,7 @@ public bool IsPort(string value) catch (Exception ex) { Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. } return false; @@ -452,7 +444,7 @@ public IEnumerable GetFile(string directory, string Search) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } return null; @@ -576,7 +568,7 @@ void Write_convar_To_File(string Convar_Name, string Convar_Value, string Descri } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -620,7 +612,7 @@ string Read_Convar_args(string Convar_Name, string File_Root = null) { SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - SnackBar.Message =VTOL.Resources.Languages.Language.Page_Server_Read_Convar_args_CannotSetThePath; + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Server_Read_Convar_args_CannotSetThePath; SnackBar.Show(); } @@ -639,7 +631,7 @@ string Read_Convar_args(string Convar_Name, string File_Root = null) { //Console.WriteLine(String.Format(" array[{0}] = {1}", i, intake[i])); } - + if (Array.Exists(intake, element => element.StartsWith(Convar_Name))) { @@ -658,7 +650,7 @@ string Read_Convar_args(string Convar_Name, string File_Root = null) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -717,7 +709,7 @@ string Read_Startup_args(string Convar_Name, string File_Root = null) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -820,17 +812,17 @@ void Write_Startup_Arg_To_File(string var_Name, string var_Value, bool add_quota String x = String.Join(" ", intermid_.ToArray()); - + using (StreamWriter sw = new StreamWriter(RootFolder, false, Encoding.UTF8, 65536)) { sw.WriteLine(Regex.Replace(x, @"\s+", " ")); } - + } } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -1097,7 +1089,7 @@ void Save_On_Focus_(object sender, KeyEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -1448,7 +1440,7 @@ private void TextBox_Initialized(object sender, EventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -1488,54 +1480,58 @@ private void Check_Args() if (File.Exists(Ns_dedi_File)) { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { //Dedicated_Server_Startup_ARGS.Background = Brushes.White; Arg_Box_Dedi.Text = Read_From_TextFile_OneLine(Ns_dedi_File); }); } else + { + DispatchIfNecessary(async () => { - DispatchIfNecessary(async () => { - //Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND_FILE_SETPATH")); - Arg_Box_Dedi.Text = "Err, File not found - ns_startup_args_dedi.txt"; - //Dedicated_Server_Startup_ARGS.Background = Brushes.Red; - }); + //Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND_FILE_SETPATH")); + Arg_Box_Dedi.Text = "Err, File not found - ns_startup_args_dedi.txt"; + //Dedicated_Server_Startup_ARGS.Background = Brushes.Red; + }); } if (File.Exists(NS_Startup)) - { - DispatchIfNecessary(async () => { - Arg_Box.Text = Read_From_TextFile_OneLine(NS_Startup); - }); + { + DispatchIfNecessary(async () => + { + Arg_Box.Text = Read_From_TextFile_OneLine(NS_Startup); + }); } else - { - DispatchIfNecessary(async () => { - //Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND_FILE_CREATE")); - Arg_Box.Text = "Err, File not found - ns_startup_args.txt"; - }); + { + DispatchIfNecessary(async () => + { + //Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND_FILE_CREATE")); + Arg_Box.Text = "Err, File not found - ns_startup_args.txt"; + }); } if (File.Exists(Convar_File)) { - // Dedicated_Convar_ARGS.Text = Convar_File; + // Dedicated_Convar_ARGS.Text = Convar_File; //Dedicated_Convar_ARGS.Background = Brushes.White; } - - //{ - // Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND_FILE_SETPATH")); - // Dedicated_Convar_ARGS.Background = Brushes.Red; - //Dedicated_Convar_ARGS.Text = "Err, File not found - autoexec_ns_server.cfg"; + //{ + // Send_Error_Notif(GetTextResource("NOTIF_ERROR_CANNOT_FIND_FILE_SETPATH")); + // Dedicated_Convar_ARGS.Background = Brushes.Red; + + //Dedicated_Convar_ARGS.Text = "Err, File not found - autoexec_ns_server.cfg"; } - + else @@ -1618,7 +1614,7 @@ await Task.Run(() => Load_Files.Content = VTOL.Resources.Languages.Language.Page_Server_Load_Files__ReloadArguments; }); - + } @@ -1649,7 +1645,7 @@ await Task.Run(() => }); - } + } private void Load_Files_Click(object sender, RoutedEventArgs e) { init_ = true; @@ -1662,7 +1658,7 @@ private void Load_Files_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -1770,11 +1766,11 @@ private void Import_Server_Config_Click(object sender, RoutedEventArgs e) } Convar_File = GetFile(User_Settings_Vars.NorthstarInstallLocation, "autoexec_ns_server.cfg").First(); Ns_dedi_File = GetFile(User_Settings_Vars.NorthstarInstallLocation, "ns_startup_args_dedi.txt").First(); - + } else { - TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation + @"VTOL_Dedicated_Workspace"); + TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation + @"VTOL_Dedicated_Workspace"); string extractPath = Path.GetFullPath(User_Settings_Vars.NorthstarInstallLocation + @"VTOL_Dedicated_Workspace"); @@ -1840,7 +1836,7 @@ private void Import_Server_Config_Click(object sender, RoutedEventArgs e) } } } - + if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) { Ns_dedi_File = GetFile(User_Settings_Vars.NorthstarInstallLocation, "ns_startup_args_dedi.txt").First(); @@ -1876,7 +1872,7 @@ private void Import_Server_Config_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -1896,7 +1892,7 @@ public void ZIP_LIST(List filesToZip, string sZipFileName, bool deleteEx string x = strRootDirectory + "/" + DateTime.Now.ToString("yyyyMMddhhmmss"); TryCreateDirectory(x); DirectoryInfo dirTemp = new DirectoryInfo(x); - + // Copy all files to the temporary directory foreach (string strFilePath in filesToZip) @@ -1964,7 +1960,7 @@ private void Export_Server_Config_Click(object sender, RoutedEventArgs e) { SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - SnackBar.Message =VTOL.Resources.Languages.Language.Page_Server_Export_Server_Config_Click_PleaseRecheckYourSaveLocation; + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Server_Export_Server_Config_Click_PleaseRecheckYourSaveLocation; SnackBar.Show(); @@ -1973,7 +1969,7 @@ private void Export_Server_Config_Click(object sender, RoutedEventArgs e) } else { - TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation + @"VTOL_Dedicated_Workspace"); + TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation + @"VTOL_Dedicated_Workspace"); if (File.Exists(Ns_dedi_File) && File.Exists(Convar_File)) { @@ -2000,7 +1996,7 @@ private void Export_Server_Config_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -2261,7 +2257,7 @@ public bool TryCopyFile( } private void Launch_Northstar_Advanced_Click(object sender, RoutedEventArgs e) { - string NSExe = Get_And_Set_Filepaths(User_Settings_Vars.NorthstarInstallLocation, "NorthstarLauncher.exe"); + string NSExe = Get_And_Set_Filepaths(User_Settings_Vars.NorthstarInstallLocation, "NorthstarLauncher.exe"); if (File.Exists(NS_Startup)) { saveAsyncFile(Arg_Box.Text, NS_Startup, false, false); @@ -2428,7 +2424,7 @@ private void Arg_Box_Dedi_LostFocus(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; SnackBar.Message = VTOL.Resources.Languages.Language.Page_Server_OnKeyDownHandler_Dedi_Arg_AutoSaveFailed; @@ -2436,7 +2432,7 @@ private void Arg_Box_Dedi_LostFocus(object sender, RoutedEventArgs e) } } - + private void Arg_Box_LostFocus(object sender, RoutedEventArgs e) { @@ -2464,7 +2460,7 @@ private void Arg_Box_LostFocus(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; SnackBar.Message = VTOL.Resources.Languages.Language.Page_Server_OnKeyDownHandler_Dedi_Arg_AutoSaveFailed; diff --git a/VTOL_2.0.0/Pages/Page_Settings.xaml.cs b/VTOL_2.0.0/Pages/Page_Settings.xaml.cs index d4cbb0b7..9ceec0ef 100644 --- a/VTOL_2.0.0/Pages/Page_Settings.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Settings.xaml.cs @@ -1,26 +1,16 @@ -using System; -using System.Collections.Generic; +using Serilog; +using System; using System.ComponentModel; -using System.Linq; -using System.Text; +using System.Diagnostics; +using System.Globalization; +using System.IO; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.IO; -using System.Threading; -using System.Globalization; -using System.Reflection; -using Wpf.Ui.Common; -using System.Diagnostics; using System.Windows.Threading; -using Serilog; +using Wpf.Ui.Common; namespace VTOL.Pages { @@ -38,7 +28,7 @@ public partial class Page_Settings : Page string OLD_MSG; string OLD_TITLE; DispatcherTimer timer = new DispatcherTimer(); - + public enum Language { English, @@ -243,7 +233,7 @@ private void Settings_LostFocus(object sender, RoutedEventArgs e) User_Settings_Vars.Repo = Settings_.Repo; User_Settings_Vars.RepoUrl = Settings_.Repo_Url; User_Settings_Vars.Auto_Update_Northstar = Settings_.Auto_Update_Northstar; - + Properties.Settings.Default.Hide_Console_Window = Settings_.Hide_Console_Window; Properties.Settings.Default.EA_APP_SUPPORT = Settings_.Enable_EA_APP_Usage; Properties.Settings.Default.Backup_arg_Files = Settings_.Do_Not_Overwrite_Config_Files; @@ -273,11 +263,11 @@ private void Settings_LostFocus(object sender, RoutedEventArgs e) } }); - + } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -373,7 +363,7 @@ async void Restart_As_admin() }); return; } - + else { Settings_.Restart_As_Admin = false; @@ -422,12 +412,12 @@ private void Settings_MouseDown(object sender, MouseButtonEventArgs e) private void Settings_MouseUp(object sender, MouseButtonEventArgs e) { - + } private void Settings_ManipulationStarted(object sender, ManipulationStartedEventArgs e) { - + } private void Settings_TargetUpdated(object sender, DataTransferEventArgs e) @@ -442,7 +432,7 @@ private void Settings_IsEnabledChanged(object sender, DependencyPropertyChangedE private void Settings_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { - + timer.Start(); diff --git a/VTOL_2.0.0/Pages/Page_Skins.xaml.cs b/VTOL_2.0.0/Pages/Page_Skins.xaml.cs index 81f40fb2..befdc45e 100644 --- a/VTOL_2.0.0/Pages/Page_Skins.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Skins.xaml.cs @@ -1,29 +1,18 @@ -using System; +using Microsoft.Win32; +using Serilog; +using System; using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; using System.IO; -using System.IO.Compression; using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Threading; -using Serilog; -using System.Globalization; using Path = System.IO.Path; -using Microsoft.Win32; using ZipFile = Ionic.Zip.ZipFile; -using Ionic.Zip; -using System.Diagnostics; -using System.Reflection; namespace VTOL.Pages { @@ -53,19 +42,19 @@ public static bool ZipHasFile(string Search, string zipFullPath) { ZipFile zipFile = new ZipFile(zipFullPath); - - foreach (var entry in zipFile.Entries) + + foreach (var entry in zipFile.Entries) + { + if (entry.FileName.Contains(Search, StringComparison.OrdinalIgnoreCase)) { - if (entry.FileName.Contains(Search, StringComparison.OrdinalIgnoreCase)) - { - return true; - } + return true; } - + } + return false; } - + private int ImageCheck(String ImageName) { int result = -1; @@ -106,7 +95,7 @@ private int ImageCheck(String ImageName) } return result; } - + private bool IsPilot(string Name) { if (Name.Contains("Stim_") || Name.Contains("PhaseShift_") || Name.Contains("HoloPilot_") || Name.Contains("PulseBlade_") || Name.Contains("Grapple_") || Name.Contains("AWall_") || Name.Contains("Cloak_") || Name.Contains("Public_")) @@ -129,140 +118,140 @@ await Task.Run(() => { if (ZipHasFile(".dds", Zip_Path)) - { + { - if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR")) - { + if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR")) + { - current_skin_folder = User_Settings_Vars.NorthstarInstallLocation+ @"Skins_Unpack_Mod_MNGR"; + current_skin_folder = User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR"; ZipFile zipFile = new ZipFile(Zip_Path); - zipFile.ExtractAll(User_Settings_Vars.NorthstarInstallLocation+ @"Skins_Unpack_Mod_MNGR", Ionic.Zip.ExtractExistingFileAction.OverwriteSilently); + zipFile.ExtractAll(User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR", Ionic.Zip.ExtractExistingFileAction.OverwriteSilently); //Skin_Path = Current_Install_Folder + @"\Skins_Unpack_Mod_MNGR"; } - else - { + else + { - TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation+ @"Skins_Unpack_Mod_MNGR"); - current_skin_folder = User_Settings_Vars.NorthstarInstallLocation+ @"Skins_Unpack_Mod_MNGR"; + TryCreateDirectory(User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR"); + current_skin_folder = User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR"; ZipFile zipFile = new ZipFile(Zip_Path); - zipFile.ExtractAll(User_Settings_Vars.NorthstarInstallLocation+ @"Skins_Unpack_Mod_MNGR", Ionic.Zip.ExtractExistingFileAction.OverwriteSilently); + zipFile.ExtractAll(User_Settings_Vars.NorthstarInstallLocation + @"Skins_Unpack_Mod_MNGR", Ionic.Zip.ExtractExistingFileAction.OverwriteSilently); } - } - else - { - //Send_Error_Notif(GetTextResource("NOTIF_ERROR_SKIN_INCOMPATIBLE")); - Log.Error("Issue With Skin Install!"); + } + else + { + //Send_Error_Notif(GetTextResource("NOTIF_ERROR_SKIN_INCOMPATIBLE")); + Log.Error("Issue With Skin Install!"); - } + } - //Block Taken From Skin Tool - List FileList = new List(); - if (current_skin_folder != null) - { - FindSkinFiles(current_skin_folder, FileList, ".dds"); + //Block Taken From Skin Tool + List FileList = new List(); + if (current_skin_folder != null) + { + FindSkinFiles(current_skin_folder, FileList, ".dds"); - } - else + } + else { Log.Error("Issue With Skin Install!"); return; - } + } - var matchingvalues = FileList.FirstOrDefault(stringToCheck => stringToCheck.Contains("")); - for (int i = 0; i < FileList.Count; i++) - { - if (FileList[i].Contains("col")) // (you use the word "contains". either equals or indexof might be appropriate) + var matchingvalues = FileList.FirstOrDefault(stringToCheck => stringToCheck.Contains("")); + for (int i = 0; i < FileList.Count; i++) { + if (FileList[i].Contains("col")) // (you use the word "contains". either equals or indexof might be appropriate) + { - //Console.WriteLine(i); + //Console.WriteLine(i); + } } - } - int DDSFolderExist = 0; - - DDSFolderExist = FileList.Count; - if (DDSFolderExist == 0) - { - Log.Error("Could Not Find Skins in Zip??"); - } + int DDSFolderExist = 0; - foreach (var i in FileList) - { - int FolderLength = current_skin_folder.Length; - String FileString = i.Substring(FolderLength); - int imagecheck = ImageCheck(i); - //the following code is waiting for the custom model - Int64 toseek = 0; - int tolength = 0; - int totype = 0; - switch (GetTextureType(i)) + DDSFolderExist = FileList.Count; + if (DDSFolderExist == 0) { - case 1://Weapon - //Need to recode weapon part - - VTOL.Titanfall2_Requisite.WeaponData.WeaponDataControl wdc = new VTOL.Titanfall2_Requisite.WeaponData.WeaponDataControl(i, imagecheck); - toseek = Convert.ToInt64(wdc.FilePath[0, 1]); - tolength = Convert.ToInt32(wdc.FilePath[0, 2]); - totype = Convert.ToInt32(wdc.FilePath[0, 3]); - - - break; - case 2://Pilot - VTOL.Titanfall2_Requisite.PilotDataControl.PilotDataControl pdc = new VTOL.Titanfall2_Requisite.PilotDataControl.PilotDataControl(i, imagecheck); - toseek = Convert.ToInt64(pdc.Seek); - tolength = Convert.ToInt32(pdc.Length); - totype = Convert.ToInt32(pdc.SeekLength); - break; - case 3://Titan - VTOL.Titanfall2_Requisite.TitanDataControl.TitanDataControl tdc = new VTOL.Titanfall2_Requisite.TitanDataControl.TitanDataControl(i, imagecheck); - toseek = Convert.ToInt64(tdc.Seek); - tolength = Convert.ToInt32(tdc.Length); - totype = Convert.ToInt32(tdc.SeekLength); - break; - - default: - Log.Error("Issue With Skin Install!"); - - break; + Log.Error("Could Not Find Skins in Zip??"); } + foreach (var i in FileList) + { + int FolderLength = current_skin_folder.Length; + String FileString = i.Substring(FolderLength); + int imagecheck = ImageCheck(i); + //the following code is waiting for the custom model + Int64 toseek = 0; + int tolength = 0; + int totype = 0; + switch (GetTextureType(i)) + { + case 1://Weapon + //Need to recode weapon part + + VTOL.Titanfall2_Requisite.WeaponData.WeaponDataControl wdc = new VTOL.Titanfall2_Requisite.WeaponData.WeaponDataControl(i, imagecheck); + toseek = Convert.ToInt64(wdc.FilePath[0, 1]); + tolength = Convert.ToInt32(wdc.FilePath[0, 2]); + totype = Convert.ToInt32(wdc.FilePath[0, 3]); + + + break; + case 2://Pilot + VTOL.Titanfall2_Requisite.PilotDataControl.PilotDataControl pdc = new VTOL.Titanfall2_Requisite.PilotDataControl.PilotDataControl(i, imagecheck); + toseek = Convert.ToInt64(pdc.Seek); + tolength = Convert.ToInt32(pdc.Length); + totype = Convert.ToInt32(pdc.SeekLength); + break; + case 3://Titan + VTOL.Titanfall2_Requisite.TitanDataControl.TitanDataControl tdc = new VTOL.Titanfall2_Requisite.TitanDataControl.TitanDataControl(i, imagecheck); + toseek = Convert.ToInt64(tdc.Seek); + tolength = Convert.ToInt32(tdc.Length); + totype = Convert.ToInt32(tdc.SeekLength); + break; + + default: + Log.Error("Issue With Skin Install!"); + + break; + } - StarpakControl sc = new StarpakControl(i, toseek, tolength, totype, User_Settings_Vars.NorthstarInstallLocation, "Titanfall2", imagecheck, "Replace"); + StarpakControl sc = new StarpakControl(i, toseek, tolength, totype, User_Settings_Vars.NorthstarInstallLocation, "Titanfall2", imagecheck, "Replace"); - } - FileList.Clear(); - DirectoryInfo di = new DirectoryInfo(current_skin_folder); - FileInfo[] files = di.GetFiles(); + } - DispatchIfNecessary(async () => - { - Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; - Main.Snackbar.Show("SUCCESS!", VTOL.Resources.Languages.Language.Page_Skins_Install_Skin_From_Path_TheSkin + Path.GetFileNameWithoutExtension(Zip_Path) + VTOL.Resources.Languages.Language.Page_Skins_Install_Skin_From_Path_HasBeenInstalled); - }); + FileList.Clear(); + DirectoryInfo di = new DirectoryInfo(current_skin_folder); + FileInfo[] files = di.GetFiles(); - foreach (FileInfo file in files) - { - file.Delete(); - } - foreach (DirectoryInfo dir_ in di.GetDirectories()) - { - dir_.Delete(true); - } - TryDeleteDirectory(current_skin_folder); + DispatchIfNecessary(async () => + { + Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; + Main.Snackbar.Show("SUCCESS!", VTOL.Resources.Languages.Language.Page_Skins_Install_Skin_From_Path_TheSkin + Path.GetFileNameWithoutExtension(Zip_Path) + VTOL.Resources.Languages.Language.Page_Skins_Install_Skin_From_Path_HasBeenInstalled); + }); + + foreach (FileInfo file in files) + { + file.Delete(); + } + foreach (DirectoryInfo dir_ in di.GetDirectories()) + { + dir_.Delete(true); + } + TryDeleteDirectory(current_skin_folder); Task.Delay(500).Wait(); @@ -273,7 +262,7 @@ await Task.Run(() => } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -301,7 +290,7 @@ private void FindSkinFiles(string FolderPath, List FileList, string File } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -438,7 +427,7 @@ private void Drag_Drop_Area_Drop(object sender, DragEventArgs e) Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; Main.Snackbar.Show("INFO", VTOL.Resources.Languages.Language.Page_Skins_Drag_Drop_Area_Drop_CompatibleSkinSFound + String.Join(" | ", names)); } - + } if (Skin_List.Count() > 0) { @@ -492,27 +481,27 @@ await Task.Run(async () => //Task.Run automatically unwraps nested Task types! }); await Task.Delay(1500); - + } names.Clear(); Skin_List.Clear(); - DispatchIfNecessary( () => + DispatchIfNecessary(() => { Install_Queue_Label.Content = "Drag to Install"; Skin_Path.Text = "Path"; Skin_Install_Progress.Value = 0; - - clear_queue.Visibility = Visibility.Hidden; - + clear_queue.Visibility = Visibility.Hidden; + + }); }); } - - + + private void Install_Skin_Click(object sender, RoutedEventArgs e) { Skin_Install_Progress.Value = 0; @@ -525,7 +514,7 @@ private void Install_Skin_Click(object sender, RoutedEventArgs e) Skin_Install_Progress.Value = 0; Install_Queue_Label.Content = "Drag to Install"; Skin_Path.Text = "Path"; - + }); @@ -539,14 +528,14 @@ private void Browse_Click(object sender, RoutedEventArgs e) if (openFileDialog.ShowDialog() == true) { - if (openFileDialog.FileName.Contains(".zip") ) + if (openFileDialog.FileName.Contains(".zip")) { if (ZipHasFile(".dds", openFileDialog.FileName)) { Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; - Main.Snackbar.Show("INFO",VTOL.Resources.Languages.Language.Page_Skins_Browse_Click_CompatibleSkinFoundAt + openFileDialog.FileName); + Main.Snackbar.Show("INFO", VTOL.Resources.Languages.Language.Page_Skins_Browse_Click_CompatibleSkinFoundAt + openFileDialog.FileName); Skin_List.Add(openFileDialog.FileName); Skin_Path.Text = openFileDialog.FileName; @@ -556,7 +545,7 @@ private void Browse_Click(object sender, RoutedEventArgs e) else { Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Caution; - Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "File "+ Path.GetFileName(openFileDialog.FileName) + VTOL.Resources.Languages.Language.Page_Skins_Browse_Click_IsNotASkinZip); + Main.Snackbar.Show(VTOL.Resources.Languages.Language.ERROR, "File " + Path.GetFileName(openFileDialog.FileName) + VTOL.Resources.Languages.Language.Page_Skins_Browse_Click_IsNotASkinZip); Install_Queue_Label.Content = VTOL.Resources.Languages.Language.Page_Skins_Drag_Drop_Area_Drop_DragToInstall; Skin_Path.Text = "Path"; @@ -582,12 +571,13 @@ private void Browse_Click(object sender, RoutedEventArgs e) } } - + async Task OPEN_WEBPAGE(string URL) { await Task.Run(() => { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { SnackBar.Message = VTOL.Resources.Languages.Language.Page_Skins_OPEN_WEBPAGE_OpeningTheFollowingURL + URL; SnackBar.Title = "INFO"; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; @@ -602,7 +592,7 @@ await Task.Run(() => }); }); } - + private void Making_Your_Own_Click(object sender, RoutedEventArgs e) { diff --git a/VTOL_2.0.0/Pages/Page_Themes.xaml.cs b/VTOL_2.0.0/Pages/Page_Themes.xaml.cs index f8aba59e..f7baaa8d 100644 --- a/VTOL_2.0.0/Pages/Page_Themes.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Themes.xaml.cs @@ -1,17 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Windows.Controls; namespace VTOL.Pages { diff --git a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs index bc7c635e..b912d759 100644 --- a/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs @@ -1,13 +1,20 @@ -using System; -using System.Collections; +using Downloader; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Serilog; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; -using System.Net; -using System.Text; +using System.Reflection; +using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using System.Timers; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -15,30 +22,11 @@ using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using VTOL; -using Timer = System.Timers.Timer; - -using Downloader; -using Path = System.IO.Path; -using System.IO.Compression; -using Serilog; -using System.Globalization; -using System.Threading.Tasks.Dataflow; -using Threading; using System.Windows.Threading; -using System.Diagnostics; +using Threading; +using Path = System.IO.Path; +using Timer = System.Timers.Timer; using ZipFile = Ionic.Zip.ZipFile; -using System.Reflection; -using System.Timers; -using Newtonsoft.Json.Linq; -using System.Text.RegularExpressions; -using System.Collections.ObjectModel; -using Newtonsoft.Json; -using static VTOL.Pages.Page_Profiles; -using System.Xml.Linq; namespace VTOL.Pages { @@ -670,7 +658,7 @@ public Page_Thunderstore() Options_List.Add("Models"); Search_Filters.ItemsSource = Options_List; - // _timer.Elapsed += TextInput_OnKeyUpDone; + // _timer.Elapsed += TextInput_OnKeyUpDone; InitializeDownloadQueue(); BackgroundWorker worker = new BackgroundWorker(); @@ -1115,7 +1103,7 @@ private void Search_Bar_Suggest_Mods_GotFocus(object sender, RoutedEventArgs e) Sort.SelectedIndex = -1; Search_Bar_Suggest_Mods.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#FFFFFFFF"); - // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#FFFFFFFF"); + // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#FFFFFFFF"); search_a_flag = false; }); } @@ -1127,7 +1115,7 @@ private void Search_Bar_Suggest_Mods_LostFocus(object sender, RoutedEventArgs e) Search_Bar_Suggest_Mods.IsReadOnly = true; search_a_flag = true; Search_Bar_Suggest_Mods.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); - // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); + // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); }); } async Task clear_box() @@ -1185,13 +1173,13 @@ public async Task Call_Ts_Mods() try { - + List List = null; _updater = new Updater("https://northstar.thunderstore.io/api/v1/package/"); var NON_UI = new Thread(() => { - _updater.Download_Cutom_JSON(); + _updater.Download_Cutom_JSON(); if (_updater.Thunderstore != null) { if (_updater.Thunderstore.Count() > 0) @@ -1236,7 +1224,7 @@ public async Task Call_Ts_Mods() } } - + }); NON_UI.IsBackground = true; @@ -1711,139 +1699,140 @@ public async Task TryCopyFile( } return false; - } + } -public void orderlistitems() -{ - List List = itemsList ; - if (Sort.SelectedItem != null && List != null) - { - if (Reverse_ == true) + public void orderlistitems() { - if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Name")) + List List = itemsList; + if (Sort.SelectedItem != null && List != null) { + if (Reverse_ == true) + { + if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Name")) + { - List = List.OrderByDescending(ob => ob.Name).ToList(); + List = List.OrderByDescending(ob => ob.Name).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Rating")) - { - List = List.OrderBy(ob => ob.Rating).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Rating")) + { + List = List.OrderBy(ob => ob.Rating).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Date")) - { - List = List.OrderBy(ob => Convert.ToDateTime(ob.raw_date)).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Date")) + { + List = List.OrderBy(ob => Convert.ToDateTime(ob.raw_date)).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("File Size")) - { + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("File Size")) + { - List = List.OrderBy(ob => Convert.ToInt32(ob.raw_size)).ToList(); + List = List.OrderBy(ob => Convert.ToInt32(ob.raw_size)).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Downloads")) - { - List = List.OrderBy(ob => Convert.ToInt32(ob.Downloads)).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Downloads")) + { + List = List.OrderBy(ob => Convert.ToInt32(ob.Downloads)).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Installed")) - { + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Installed")) + { - // List = List.OrderByDescending(x => x.Button_label.ToString().Contains("Re-Install")).ToList(); - List = List.Where(item => item.Button_label.ToString().Contains("Re-Install")).OrderByDescending(ob => ob.Name).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Update")) - { - //List = List.OrderByDescending(x => x.Button_label.Contains("Update")).ToList(); - List = List.Where(item => item.Button_label.ToString().Contains("Update")).OrderByDescending(ob => ob.Name).ToList(); - if (List.Count == 0) - { - DispatchIfNecessary(async () => { + // List = List.OrderByDescending(x => x.Button_label.ToString().Contains("Re-Install")).ToList(); + List = List.Where(item => item.Button_label.ToString().Contains("Re-Install")).OrderByDescending(ob => ob.Name).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Update")) + { + //List = List.OrderByDescending(x => x.Button_label.Contains("Update")).ToList(); + List = List.Where(item => item.Button_label.ToString().Contains("Update")).OrderByDescending(ob => ob.Name).ToList(); + if (List.Count == 0) + { + DispatchIfNecessary(async () => + { - Mod_Updates_Available.Visibility = Visibility.Hidden; - Mod_Update_Counter = 0; - }); + Mod_Updates_Available.Visibility = Visibility.Hidden; + Mod_Update_Counter = 0; + }); - } - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Favourites")) - { - List = List.Where(item => item.is_Favourite_.ToString().Equals("1")).OrderByDescending(ob => ob.Name).ToList(); + } + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Favourites")) + { + List = List.Where(item => item.is_Favourite_.ToString().Equals("1")).OrderByDescending(ob => ob.Name).ToList(); - } - + } - } - else - { - if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Name")) - { + } + else + { - List = List.OrderBy(ob => ob.Name).ToList(); + if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Name")) + { - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Rating")) - { - List = List.OrderByDescending(ob => ob.Rating).ToList(); + List = List.OrderBy(ob => ob.Name).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Date")) - { - List = List.OrderByDescending(ob => Convert.ToDateTime(ob.raw_date)).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Rating")) + { + List = List.OrderByDescending(ob => ob.Rating).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("File Size")) - { - List = List.OrderByDescending(ob => Convert.ToInt32(ob.raw_size)).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Date")) + { + List = List.OrderByDescending(ob => Convert.ToDateTime(ob.raw_date)).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Downloads")) - { - List = List.OrderByDescending(ob => Convert.ToInt32(ob.Downloads)).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("File Size")) + { + List = List.OrderByDescending(ob => Convert.ToInt32(ob.raw_size)).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Installed")) - { + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Downloads")) + { + List = List.OrderByDescending(ob => Convert.ToInt32(ob.Downloads)).ToList(); - // List = List.OrderByDescending(x => x.Button_label.ToString().Contains("Re-Install")).ToList(); - List = List.Where(item => item.Button_label.ToString().Contains("Re-Install")).OrderBy(ob => ob.Name).ToList(); + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Installed")) + { + // List = List.OrderByDescending(x => x.Button_label.ToString().Contains("Re-Install")).ToList(); + List = List.Where(item => item.Button_label.ToString().Contains("Re-Install")).OrderBy(ob => ob.Name).ToList(); - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Update")) - { - // List = List.OrderBy(x => x.Button_label.Contains("Update")).ToList(); - List = List.Where(item => item.Button_label.ToString().Contains("Update")).OrderBy(ob => ob.Name).ToList(); - if (List.Count == 0) - { - DispatchIfNecessary(async () => + + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Update")) { + // List = List.OrderBy(x => x.Button_label.Contains("Update")).ToList(); + List = List.Where(item => item.Button_label.ToString().Contains("Update")).OrderBy(ob => ob.Name).ToList(); + if (List.Count == 0) + { + DispatchIfNecessary(async () => + { - Mod_Updates_Available.Visibility = Visibility.Hidden; - Mod_Update_Counter = 0; + Mod_Updates_Available.Visibility = Visibility.Hidden; + Mod_Update_Counter = 0; - }); + }); - } + } - } - else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Favourites")) - { - //List = List.Where(item => item.Button_label.ToString().Contains("Favourites")).OrderByDescending(ob => ob.Name).ToList(); - List = List.Where(item => item.is_Favourite_.ToString().Equals("1")).OrderBy(ob => ob.Name).ToList(); - } - + } + else if (Sort.SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem:", "").Trim().Contains("Favourites")) + { + //List = List.Where(item => item.Button_label.ToString().Contains("Favourites")).OrderByDescending(ob => ob.Name).ToList(); + List = List.Where(item => item.is_Favourite_.ToString().Equals("1")).OrderBy(ob => ob.Name).ToList(); + } - } + + } + - @@ -1852,15 +1841,15 @@ public void orderlistitems() } foreach (var TS_MOD in List) - { + { - if (TS_MOD != null) + if (TS_MOD != null) { - Thunderstore_List.Items.Add(TS_MOD); - - } + Thunderstore_List.Items.Add(TS_MOD); } + + } } private Grid_ LoadListViewItem(Thunderstore_V1 updater, bool Search_ = false, string SearchQuery = "#") { @@ -2270,11 +2259,11 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false if (updater.FullName.Contains("r2modman")) { - return ; + return; } if (updater.IsDeprecated == true) { - return ; + return; } int rating = updater.RatingScore; @@ -2309,10 +2298,10 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false if (updater.Name.IndexOf(SearchQuery, StringComparison.OrdinalIgnoreCase) == -1 && updater.Owner.IndexOf(SearchQuery, StringComparison.OrdinalIgnoreCase) == -1) { - - return ; + + return; } downloads = (Downloads.Sum()).ToString(); @@ -2467,11 +2456,11 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false } }); - - } + + } } } - + else { @@ -2492,7 +2481,7 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false }); - return ; + return; } downloads = (Downloads.Sum()).ToString(); @@ -2556,7 +2545,7 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false // is_nsfw = updater.HasNsfwContent ? 100 : 0; if (Card != null) { - Card = (new Grid_ { Name = updater.Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = updater.DateCreated.ToString(), date_created = ConvertDateToString(updater.DateCreated), description = Descrtiption, owner = updater.Owner, Rating = rating, download_url = download_url + "|" + updater.Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = updater.PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = updater.FullName, raw_size = raw_size, Update_data = updater.Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); + Card = (new Grid_ { Name = updater.Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = updater.DateCreated.ToString(), date_created = ConvertDateToString(updater.DateCreated), description = Descrtiption, owner = updater.Owner, Rating = rating, download_url = download_url + "|" + updater.Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = updater.PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = updater.FullName, raw_size = raw_size, Update_data = updater.Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); Thunderstore_List.Items.Add(Card); } @@ -2641,27 +2630,27 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false // is_nsfw = updater.HasNsfwContent ? 100 : 0; if (Card != null) { - Card = (new Grid_ { Name = updater.Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = updater.DateCreated.ToString(), date_created = ConvertDateToString(updater.DateCreated), description = Descrtiption, owner = updater.Owner, Rating = rating, download_url = download_url + "|" + updater.Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = updater.PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = updater.FullName, raw_size = raw_size, Update_data = updater.Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); + Card = (new Grid_ { Name = updater.Name.Replace("_", " ") + "-" + versions.First().VersionNumber, Icon = ICON, raw_date = updater.DateCreated.ToString(), date_created = ConvertDateToString(updater.DateCreated), description = Descrtiption, owner = updater.Owner, Rating = rating, download_url = download_url + "|" + updater.Name + "-" + versions.First().VersionNumber + "|" + Tags + "|" + Dependencies_, Webpage = updater.PackageUrl, File_Size = FileSize, Tag = Tags, Downloads = downloads, Dependencies = Dependencies_, FullName = updater.FullName, raw_size = raw_size, Update_data = updater.Name + "|" + versions.First().VersionNumber, Button_label = label, Button_Color = bg_color, is_Favourite_ = is_favourite }); Thunderstore_List.Items.Add(Card); } }); - } + } } - - return ; + + return; + + - - - } + } void AddLoadingCard() { Grid_ loadingCard = new Grid_ @@ -2700,7 +2689,7 @@ void ReplaceLoadingCardWithMod(Grid_ tsMod) // Replace the loading card with the populated data from TS_MOD Thunderstore_List.Items[loadingCardIndex] = tsMod; } - private void loadConvertItemLazy( bool Search_ = false, string SearchQuery = "#") + private void loadConvertItemLazy(bool Search_ = false, string SearchQuery = "#") { //for (int i = 0; i < _updater.Thunderstore.Length; i++) //{ @@ -2716,12 +2705,12 @@ private void loadConvertItemLazy( bool Search_ = false, string SearchQuery = "#" { //Legacy Grid_ Card = LoadListViewItem(TS_MOD, Search_, SearchQuery.Replace(" ", "_")); AsyncLoadListViewItem(TS_MOD, Search_, SearchQuery.Replace(" ", "_")); - // if (Card != null) - // { - // Thunderstore_List.Items.Add(Card); - // // ReplaceLoadingCardWithMod(Card); + // if (Card != null) + // { + // Thunderstore_List.Items.Add(Card); + // // ReplaceLoadingCardWithMod(Card); - //} + //} } } @@ -3184,7 +3173,8 @@ public static string ConvertDateToString(DateTime date) public string Search_For_Mod_Thunderstore(string SearchQuery = "None") { - try { + try + { _updater = new VTOL.Updater("https://northstar.thunderstore.io/api/v1/package/"); _updater.Download_Cutom_JSON(); @@ -3298,7 +3288,7 @@ private void TextBlock_MouseMove(object sender, MouseEventArgs e) private void ScrollViewer_MouseMove(object sender, MouseEventArgs e) { - } + } private void Dialog_ButtonRightClick(object sender, RoutedEventArgs e) { Dialog.Hide(); @@ -3306,37 +3296,39 @@ private void Dialog_ButtonRightClick(object sender, RoutedEventArgs e) } async void downloader_ProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e, ProgressBar Progress_Bar) { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { Progress_Bar.Value = (e.ProgressPercentage); }); - + } - - async void downloader_DownloadCompleted(object sender, AsyncCompletedEventArgs e, ProgressBar Progress_Bar, string Mod_Name, string Location, bool Skin_Install, bool NS_CANDIDATE_INSTALL) + + async void downloader_DownloadCompleted(object sender, AsyncCompletedEventArgs e, ProgressBar Progress_Bar, string Mod_Name, string Location, bool Skin_Install, bool NS_CANDIDATE_INSTALL) { if (NS_CANDIDATE_INSTALL == true) { - await Unpack_To_Location_Custom(Location, User_Settings_Vars.NorthstarInstallLocation + @"Northstar_TEMP_FILES\", Progress_Bar, true, false, Skin_Install, NS_CANDIDATE_INSTALL,Mod_Name); - + await Unpack_To_Location_Custom(Location, User_Settings_Vars.NorthstarInstallLocation + @"Northstar_TEMP_FILES\", Progress_Bar, true, false, Skin_Install, NS_CANDIDATE_INSTALL, Mod_Name); + } else { - await Unpack_To_Location_Custom(Location, User_Settings_Vars.NorthstarInstallLocation + User_Settings_Vars.Profile_Path + @"\packages\" + Mod_Name, Progress_Bar, true, false, Skin_Install, NS_CANDIDATE_INSTALL,Mod_Name); + await Unpack_To_Location_Custom(Location, User_Settings_Vars.NorthstarInstallLocation + User_Settings_Vars.Profile_Path + @"\packages\" + Mod_Name, Progress_Bar, true, false, Skin_Install, NS_CANDIDATE_INSTALL, Mod_Name); } - - + + } async Task Download_Zip_To_Path(string url, string path, ProgressBar Progress_Bar = null, bool Skin_Install_ = false, bool NS_CANDIDATE_INSTALL = false, CancellationToken cancellationToken = default) { await Task.Run(() => {//Regex.Replace(item, @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-') - DispatchIfNecessary(async () => { - if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) + DispatchIfNecessary(async () => { + if (Directory.Exists(User_Settings_Vars.NorthstarInstallLocation)) + { if (cancellationToken.IsCancellationRequested) { return; @@ -3345,13 +3337,13 @@ await Task.Run(() => string[] words = url.Split("|"); - IDownload downloader = DownloadBuilder.New() - .WithUrl(words[0]) - .WithDirectory(path) - .WithFileName(Regex.Replace(words[1], @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-') + ".zip") - .WithConfiguration(new DownloadConfiguration()) + IDownload downloader = DownloadBuilder.New() + .WithUrl(words[0]) + .WithDirectory(path) + .WithFileName(Regex.Replace(words[1], @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-') + ".zip") + .WithConfiguration(new DownloadConfiguration()) - .Build(); + .Build(); if (Progress_Bar != null) { @@ -3379,12 +3371,12 @@ await Task.Run(() => Clear_Folder(Destinfo.FullName + @"NS_Downloaded_Mods\"); } - downloader.DownloadFileCompleted += delegate (object sender4, AsyncCompletedEventArgs e4) - { - + downloader.DownloadFileCompleted += delegate (object sender4, AsyncCompletedEventArgs e4) + { - downloader_DownloadCompleted(sender4, e4, Progress_Bar, words[1], Destinfo.FullName + @"NS_Downloaded_Mods\" + Regex.Replace(words[1], @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-') + ".zip",Skin_Install_,NS_CANDIDATE_INSTALL); - }; + + downloader_DownloadCompleted(sender4, e4, Progress_Bar, words[1], Destinfo.FullName + @"NS_Downloaded_Mods\" + Regex.Replace(words[1], @"(\d+\.)(\d+\.)(\d)", "").TrimEnd('-') + ".zip", Skin_Install_, NS_CANDIDATE_INSTALL); + }; downloader.StartAsync(); if (cancellationToken.IsCancellationRequested) { @@ -3404,9 +3396,9 @@ await Task.Run(() => - - } + + } bool Is_Valid_URl(string uriName) { @@ -3422,7 +3414,7 @@ public void DispatchIfNecessary(Action action) else action.Invoke(); } - void Dependency_Download( string Dependencies_To_Find_And_Download,ProgressBar Progress_Bar = null) + void Dependency_Download(string Dependencies_To_Find_And_Download, ProgressBar Progress_Bar = null) { Loaded_Async_Handler = true; try @@ -3479,7 +3471,7 @@ void Dependency_Download( string Dependencies_To_Find_And_Download,ProgressBar P } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } Dialog.Hide(); @@ -3487,7 +3479,7 @@ void Dependency_Download( string Dependencies_To_Find_And_Download,ProgressBar P } bool Loaded_Async_Handler = false; string pack = null; - + private void CardAction_Click(object sender, RoutedEventArgs e) { @@ -3498,87 +3490,87 @@ private void CardAction_Click(object sender, RoutedEventArgs e) Progress_Bar = FindVisualChild(_Panel); var Tag_Data_ = ((Wpf.Ui.Controls.CardAction)sender).ToolTip.ToString(); var Name_Data = ((Wpf.Ui.Controls.CardAction)sender).Tag.ToString(); - - string Tag_Data = "\n" + (Tag_Data_.Replace(",", "\n").Replace(" ", "") + "\n\n"+VTOL.Resources.Languages.Language.Page_Thunderstore_CardAction_Click_DoYouWantToInstallTheseAndTheMod+"\n" + Name_Data + "?").Trim(); + + string Tag_Data = "\n" + (Tag_Data_.Replace(",", "\n").Replace(" ", "") + "\n\n" + VTOL.Resources.Languages.Language.Page_Thunderstore_CardAction_Click_DoYouWantToInstallTheseAndTheMod + "\n" + Name_Data + "?").Trim(); if (Tag_Data.Count() > 5) - { - Dialog.Title = Name_Data + " - Dependencies"; - - Dialog.DialogHeight = 350; - Dialog.Message = Tag_Data; - Dialog.ButtonLeftName = "Yes"; - Dialog.ButtonRightName = "Cancel"; - Dialog.ButtonLeftAppearance = Wpf.Ui.Common.ControlAppearance.Success; - Dialog.ButtonRightAppearance = Wpf.Ui.Common.ControlAppearance.Caution; - - - Dialog.Tag = ((Tag_Data_ + " ,"+Name_Data.Trim()).Replace(",", "\n").Replace(" ", "")) ; - - Progress_Cur_Temp = Progress_Bar; - - Dialog.Show(); + { + Dialog.Title = Name_Data + " - Dependencies"; - } + Dialog.DialogHeight = 350; + Dialog.Message = Tag_Data; + Dialog.ButtonLeftName = "Yes"; + Dialog.ButtonRightName = "Cancel"; + Dialog.ButtonLeftAppearance = Wpf.Ui.Common.ControlAppearance.Success; + Dialog.ButtonRightAppearance = Wpf.Ui.Common.ControlAppearance.Caution; - } + + Dialog.Tag = ((Tag_Data_ + " ," + Name_Data.Trim()).Replace(",", "\n").Replace(" ", "")); + + Progress_Cur_Temp = Progress_Bar; + + Dialog.Show(); + + } + + } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } public static bool IsDirectoryEmpty(DirectoryInfo directory) { - - + + FileInfo[] files = directory.GetFiles(); DirectoryInfo[] subdirs = directory.GetDirectories(); return (files.Length == 0 && subdirs.Length == 0); - -} + + } private async Task Clear_Folder(string FolderName, bool overwrite = true, int maxRetries = 10, int millisecondsDelay = 30) { - - if (FolderName == null) - throw new ArgumentNullException(FolderName); - if (maxRetries < 1) - throw new ArgumentOutOfRangeException(nameof(maxRetries)); - if (millisecondsDelay < 1) - throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); - - for (int i = 0; i < maxRetries; ++i) - { - - - - try + + if (FolderName == null) + throw new ArgumentNullException(FolderName); + if (maxRetries < 1) + throw new ArgumentOutOfRangeException(nameof(maxRetries)); + if (millisecondsDelay < 1) + throw new ArgumentOutOfRangeException(nameof(millisecondsDelay)); + + for (int i = 0; i < maxRetries; ++i) { - DirectoryInfo dir = new DirectoryInfo(FolderName); - foreach (FileInfo fi in dir.GetFiles()) - { - fi.Delete(); - } - foreach (DirectoryInfo di in dir.GetDirectories()) + + try { - Clear_Folder(di.FullName); - di.Delete(); + DirectoryInfo dir = new DirectoryInfo(FolderName); + + foreach (FileInfo fi in dir.GetFiles()) + { + fi.Delete(); + } + + foreach (DirectoryInfo di in dir.GetDirectories()) + { + Clear_Folder(di.FullName); + di.Delete(); + } } - } - catch (Exception ex) - { - + catch (Exception ex) + { + return; } } - return; - } + return; + } private async Task CopyFilesRecursively(string sourcePath, string targetPath) { await Task.Run(() => @@ -3732,7 +3724,7 @@ public async Task IsValidPath(string path, bool allowRelativePaths = false } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); isValid = false; } @@ -3770,7 +3762,7 @@ async Task Call_Mods_From_Folder_Lite() Main.Current_Installed_Mods.Add(dirInfo.Name.Trim()); } - + } @@ -3782,10 +3774,11 @@ async Task Call_Mods_From_Folder_Lite() } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } - } public void SlowBlink(Control control, double minimumOpacity) + } + public void SlowBlink(Control control, double minimumOpacity) { DispatchIfNecessary(async () => { @@ -3796,8 +3789,8 @@ async Task Call_Mods_From_Folder_Lite() To = minimumOpacity, Duration = new Duration(TimeSpan.FromSeconds(0.6)), AutoReverse = true, - RepeatBehavior = RepeatBehavior.Forever - + RepeatBehavior = RepeatBehavior.Forever + }; // Apply the animation to the control's Opacity property @@ -3963,12 +3956,12 @@ public static string FindFirstFile(string path, string searchPattern) // simply return string.Empty. return string.Empty; } - public async Task Unpack_To_Location_Custom(string Target_Zip, string Destination, ProgressBar Progress_Bar, bool Clean_Thunderstore = false, bool clean_normal = false, bool Skin_Install = false,bool NS_CANDIDATE_INSTALL = false ,string mod_name ="~") + public async Task Unpack_To_Location_Custom(string Target_Zip, string Destination, ProgressBar Progress_Bar, bool Clean_Thunderstore = false, bool clean_normal = false, bool Skin_Install = false, bool NS_CANDIDATE_INSTALL = false, string mod_name = "~") { //add drag and drop var Action_Card_ = Action_Center.FirstOrDefault(i => { - + return i.Name.ToLower().Contains(mod_name.ToLower()); }); try @@ -4027,8 +4020,8 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio string mod = User_Settings_Vars.NorthstarInstallLocation + User_Settings_Vars.Profile_Path + @"\packages\" + item; if (Directory.Exists(mod)) { - // await Clear_Folder(mod); - // await TryDeleteDirectory(mod, true); + // await Clear_Folder(mod); + // await TryDeleteDirectory(mod, true); } } @@ -4076,15 +4069,16 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio { var File_ = Script1.FirstOrDefault(); - if (File_.Exists == true){ + if (File_.Exists == true) + { string myJsonString = File.ReadAllText(File_.FullName); JObject data = JObject.Parse(myJsonString); string Name = data.SelectToken("Name").Value(); string Version = data.SelectToken("Version").Value(); - - MoveDirectory___(Destination, Destinfo1.Parent + @"\" +(Name.ToString().Replace(".","-")).Replace(" ","_") + "-" + Version.ToString()); + + MoveDirectory___(Destination, Destinfo1.Parent + @"\" + (Name.ToString().Replace(".", "-")).Replace(" ", "_") + "-" + Version.ToString()); string Json_Path = FindFirstFile(User_Settings_Vars.NorthstarInstallLocation + @"R2Northstar\", "enabledmods.json"); @@ -4109,7 +4103,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio } - Update_ActionCard_Progress(Action_Card_,10,true,true); + Update_ActionCard_Progress(Action_Card_, 10, true, true); DispatchIfNecessary(async () => @@ -4118,7 +4112,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio { Progress_Bar.Value = 0; } - Update_ActionCard_Progress(Action_Card_, 40, true,true); + Update_ActionCard_Progress(Action_Card_, 40, true, true); SnackBar.Title = VTOL.Resources.Languages.Language.SUCCESS; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Success; @@ -4215,9 +4209,9 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio //} /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - if(NS_CANDIDATE_INSTALL == true && Skin_Install == false) + + if (NS_CANDIDATE_INSTALL == true && Skin_Install == false) { //if (File.Exists(Path.Combine(Destination, "manifest.json"))) //{ @@ -4324,8 +4318,8 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio string Northstar_VEr_Temp = null; if (Directory.Exists(Destination)) { - - await CopyFilesRecursively(firstFolder, User_Settings_Vars.NorthstarInstallLocation); + + await CopyFilesRecursively(firstFolder, User_Settings_Vars.NorthstarInstallLocation); Update_ActionCard_Progress(Action_Card_, 10); } @@ -4336,8 +4330,8 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio //} Update_ActionCard_Progress(Action_Card_, 5); - - + + if (do_not_overwrite_Ns_file == true) { @@ -4373,7 +4367,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio } } - + DispatchIfNecessary(async () => { Update_ActionCard_Progress(Action_Card_, 10); @@ -4384,7 +4378,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio Progress_Bar.Value = 0; } - }); + }); if (File.Exists(User_Settings_Vars.NorthstarInstallLocation + @"NorthstarLauncher.exe")) { @@ -4434,30 +4428,30 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio } - else - { + else + { //if (File.Exists(Path.Combine(Destination, "manifest.json"))) //{ // // If file found, delete it // await TryDeleteFile(Path.Combine(Destination, "manifest.json")); //} var ext = new List { "zip" }; - var myFiles = Directory.EnumerateFiles(Destination, "*.*", SearchOption.AllDirectories).Where(s => ext.Contains(Path.GetExtension(s).TrimStart('.').ToLowerInvariant())); + var myFiles = Directory.EnumerateFiles(Destination, "*.*", SearchOption.AllDirectories).Where(s => ext.Contains(Path.GetExtension(s).TrimStart('.').ToLowerInvariant())); - await Install_Skin_Async_Starter(myFiles, Destination); - DispatchIfNecessary(async () => - { - if (Progress_Bar != null) - { - Progress_Bar.Value = 0; - } - }); - } + await Install_Skin_Async_Starter(myFiles, Destination); + DispatchIfNecessary(async () => + { + if (Progress_Bar != null) + { + Progress_Bar.Value = 0; + } + }); + } } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. DispatchIfNecessary(async () => { @@ -4472,7 +4466,7 @@ public async Task Unpack_To_Location_Custom(string Target_Zip, string Destinatio Progress_Bar.Value = 0; } }); - Console.WriteLine(ex+ $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Console.WriteLine(ex + $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -4488,7 +4482,7 @@ public string ProductVersion } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } return "0.0.0"; @@ -4507,38 +4501,39 @@ private string Find_Folder(string searchQuery, string folderPath) } async Task Install_Skin_Async_Starter(IEnumerable in_, string Destination = "") { - try { - - await Task.Run(async () => //Task.Run automatically unwraps nested Task types! + try { - - foreach (string i in in_) + await Task.Run(async () => //Task.Run automatically unwraps nested Task types! { - DispatchIfNecessary(async () => + + + foreach (string i in in_) { - Skin_Processor_ Skinp = new Skin_Processor_(); + DispatchIfNecessary(async () => + { + Skin_Processor_ Skinp = new Skin_Processor_(); - Skinp.Install_Skin_From_Path(i); + Skinp.Install_Skin_From_Path(i); - - }); - await Task.Delay(1500); + }); + await Task.Delay(1500); - } - if (Directory.Exists(Destination) && Destination != "") - { - TryDeleteDirectory(Destination, true); - } - }); + } + + if (Directory.Exists(Destination) && Destination != "") + { + TryDeleteDirectory(Destination, true); + } + }); } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -4548,9 +4543,9 @@ await Task.Run(async () => //Task.Run automatically unwraps nested Task types! private void ScrollViewer_MouseEnter(object sender, MouseEventArgs e) { - - } + + } public class DownloadQueueItem { @@ -4589,30 +4584,30 @@ public async void Enqueue(DownloadQueueItem item) - Main.DispatchIfNecessary(async () => - { - Main.Action_Center.ItemsSource = null; - _myClass.Action_Center.RemoveAll(i => i.Name.ToLower().Contains(item.Name.ToLower())); - Main.Action_Center.ItemsSource = _myClass.Action_Center; - _inProgress.Remove(item.DownloadUrl); - _queue.RemoveAll(item => item.Name.ToLower().Contains(item.Name.ToLower())); - _queue_List_Clear.RemoveAll(item => item.Name.ToLower().Contains(item.Name.ToLower())); - Main.Action_Center.Refresh(); + Main.DispatchIfNecessary(async () => + { + Main.Action_Center.ItemsSource = null; + _myClass.Action_Center.RemoveAll(i => i.Name.ToLower().Contains(item.Name.ToLower())); + Main.Action_Center.ItemsSource = _myClass.Action_Center; + _inProgress.Remove(item.DownloadUrl); + _queue.RemoveAll(item => item.Name.ToLower().Contains(item.Name.ToLower())); + _queue_List_Clear.RemoveAll(item => item.Name.ToLower().Contains(item.Name.ToLower())); + Main.Action_Center.Refresh(); - Main.Snackbar.Message = "Download with the same URL is was already in progress or queued."; + Main.Snackbar.Message = "Download with the same URL is was already in progress or queued."; Main.Snackbar.Title = "INFO"; Main.Snackbar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; Main.Snackbar.Show(); - await Task.Delay(2000); + await Task.Delay(2000); }); } - - _inProgress.Add(item.DownloadUrl); - _queue.Add(item); - _queue_List_Clear.Add(item); - await ExecuteQueueAsync(); - - + + _inProgress.Add(item.DownloadUrl); + _queue.Add(item); + _queue_List_Clear.Add(item); + await ExecuteQueueAsync(); + + } private async Task ExecuteQueueAsync() @@ -4638,9 +4633,9 @@ private async Task ExecuteQueueAsync() } finally { - // _myClass.Action_Center.RemoveAll(card => card.Description == item.DestinationPath); + // _myClass.Action_Center.RemoveAll(card => card.Description == item.DestinationPath); - // _inProgress.Remove(item.DownloadUrl); + // _inProgress.Remove(item.DownloadUrl); } } } @@ -4651,7 +4646,7 @@ private async Task DownloadZipAsync(DownloadQueueItem item, CancellationToken ca { string name = ""; string URl = ""; - + string[] parts = item.DownloadUrl.Split('|'); if (parts.Length >= 2) // check if there are at least two parts { @@ -4661,7 +4656,7 @@ private async Task DownloadZipAsync(DownloadQueueItem item, CancellationToken ca Main.DispatchIfNecessary(() => { Main.Action_Center.ItemsSource = null; - + Main.Action_Center_Progress_Text.Text = name; _myClass.Action_Center.Add(new Action_Card @@ -4678,22 +4673,23 @@ private async Task DownloadZipAsync(DownloadQueueItem item, CancellationToken ca Main.Action_Center.Refresh(); }); await Task.Run(() => _myClass.Download_Zip_To_Path(item.DownloadUrl, item.DestinationPath, item.Progress, item.Extract, item.IsNorthstarRelease, cancellationToken)); - - } + + } catch (Exception ex) { // log error } } - public void CancelDownload(string name,bool clear_all = false) + public void CancelDownload(string name, bool clear_all = false) { - try { + try + { if (clear_all) { List removedCards = _myClass.Action_Center - .Where(card => card.Completed != "Dismiss16" && card.Progress > 90) + .Where(card => card.Completed != "Dismiss16" && card.Progress > 90) .ToList(); Main.DispatchIfNecessary(() => @@ -4702,21 +4698,21 @@ public void CancelDownload(string name,bool clear_all = false) Main.Action_Center_Progress_Text.Text = null; - _myClass.Action_Center.RemoveAll(card => card.Completed != "Dismiss16" && card.Progress > 90); + _myClass.Action_Center.RemoveAll(card => card.Completed != "Dismiss16" && card.Progress > 90); Main.Action_Center.ItemsSource = _myClass.Action_Center; Main.Action_Center.Refresh(); }); - foreach(var mod in removedCards) + foreach (var mod in removedCards) { _inProgress.RemoveWhere(item => item == mod.URL); _queue.RemoveAll(item => item.Name.ToLower().Contains(mod.Name.ToLower())); _queue_List_Clear.RemoveAll(item => item.Name.ToLower().Contains(mod.Name.ToLower())); } - + return; } @@ -4725,33 +4721,33 @@ public void CancelDownload(string name,bool clear_all = false) { return i.Name.ToLower().Contains(name.ToLower()); }); - + if (item != null) { Action_Card card = _myClass.Action_Center.FirstOrDefault(c => c.GetType() == typeof(Action_Card) && c.Name.ToLower() == item.Name.ToLower()); if (card != null) { - if (card.Completed == "Dismiss16" + if (card.Completed == "Dismiss16" || card.Progress < 90) { return; } - - Main.DispatchIfNecessary(() => - { - Main.Action_Center.ItemsSource = null; - Main.Action_Center_Progress_Text.Text = null; - // _myClass.Action_Center.RemoveAll(card => card.Name == item.Name); - _myClass.Action_Center.Remove(card); - Main.Action_Center.ItemsSource = _myClass.Action_Center; - Main.Action_Center.Refresh(); - }); - _inProgress.Remove(item.DownloadUrl); - _queue.Remove(item); - _queue_List_Clear.Remove(item); + Main.DispatchIfNecessary(() => + { + Main.Action_Center.ItemsSource = null; + Main.Action_Center_Progress_Text.Text = null; + // _myClass.Action_Center.RemoveAll(card => card.Name == item.Name); + _myClass.Action_Center.Remove(card); + Main.Action_Center.ItemsSource = _myClass.Action_Center; + Main.Action_Center.Refresh(); + }); + + _inProgress.Remove(item.DownloadUrl); + _queue.Remove(item); + _queue_List_Clear.Remove(item); + - } } @@ -4760,7 +4756,7 @@ public void CancelDownload(string name,bool clear_all = false) { // log error } - } + } } // Inside the class containing the Install_Bttn_Thunderstore_Click method: @@ -4772,7 +4768,7 @@ public void InitializeDownloadQueue() } // create a new DownloadQueueItem for each download and add to the queue - + private void Install_Bttn_Thunderstore_Click(object sender, RoutedEventArgs e) @@ -4784,7 +4780,7 @@ private void Install_Bttn_Thunderstore_Click(object sender, RoutedEventArgs e) ProgressBar Progress_Bar = null; HandyControl.Controls.SimplePanel _Panel = (HandyControl.Controls.SimplePanel)((Button)sender).Parent; Progress_Bar = FindVisualChild(_Panel); - if(Progress_Bar.Tag != Button.Tag) + if (Progress_Bar.Tag != Button.Tag) { Progress_Bar = null; @@ -4839,9 +4835,9 @@ private void Install_Bttn_Thunderstore_Click(object sender, RoutedEventArgs e) - - + + @@ -4849,7 +4845,7 @@ private void Install_Bttn_Thunderstore_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. @@ -4888,7 +4884,7 @@ private void TextInput_OnKeyUpDone(object sender, ElapsedEventArgs e) - // Call_Ts_Mods(true, Search_: true, SearchQuery: Search_Bar_Suggest_Mods.Text); + // Call_Ts_Mods(true, Search_: true, SearchQuery: Search_Bar_Suggest_Mods.Text); if (_updater.Thunderstore != null) @@ -4912,7 +4908,7 @@ private void TextInput_OnKeyUpDone(object sender, ElapsedEventArgs e) } - + @@ -4927,18 +4923,18 @@ private void TextInput_OnKeyUpDone(object sender, ElapsedEventArgs e) worker.RunWorkerAsync(); - + } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } - private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEventArgs e) + private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEventArgs e) { BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += (sender, e) => @@ -4950,7 +4946,7 @@ private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEvent { if (Search_Bar_Suggest_Mods.Text.Trim() != "" && Search_Bar_Suggest_Mods.Text != null && Search_Bar_Suggest_Mods.Text.Length != 0) { - + if (_updater.Thunderstore != null) { if (_updater.Thunderstore.Count() > 0) @@ -4986,7 +4982,7 @@ private void Search_Bar_Suggest_Mods_TextChanged(object sender, TextChangedEvent worker.RunWorkerAsync(); - + } @@ -4997,18 +4993,19 @@ private void Grid_Unloaded(object sender, RoutedEventArgs e) private void Dialog_ButtonLeftClick(object sender, RoutedEventArgs e) { - - - Dependency_Download( Dialog.Tag.ToString(), Progress_Cur_Temp); + + + Dependency_Download(Dialog.Tag.ToString(), Progress_Cur_Temp); } - + private void Search_Filters_SelectionChanged(object sender, SelectionChangedEventArgs e) { - try { - if (page_loaded == true) + try { - if (sender.GetType() == typeof(HandyControl.Controls.CheckComboBox)) + if (page_loaded == true) + { + if (sender.GetType() == typeof(HandyControl.Controls.CheckComboBox)) { HandyControl.Controls.CheckComboBox comboBox = (HandyControl.Controls.CheckComboBox)sender; Current_Mod_Filter_Tags = null; @@ -5020,53 +5017,53 @@ private void Search_Filters_SelectionChanged(object sender, SelectionChangedEven Search_Bar_Suggest_Mods.IsReadOnly = true; search_a_flag = true; Search_Bar_Suggest_Mods.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); - // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); + // Search_Bar_Suggest_Mods.IconForeground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); }); Current_Mod_Filter_Tags = String.Join(",", comboBox.SelectedItems.Cast()).Split(',').ToList(); } - if (Search_Filters.SelectedItems != null && Search_Filters.SelectedItems.Count > 0) /*|| Options_List.Contains(Search_Filters.SelectedItem))*/ - { - + if (Search_Filters.SelectedItems != null && Search_Filters.SelectedItems.Count > 0) /*|| Options_List.Contains(Search_Filters.SelectedItem))*/ + { + Sort.SelectedIndex = -1; Category_Label.Visibility = Visibility.Hidden; - } - else - { - Category_Label.Visibility = Visibility.Visible; + } + else + { + Category_Label.Visibility = Visibility.Visible; - } + } - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += (sender, e) => - { + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += (sender, e) => + { - if (_updater.Thunderstore != null) - { - if (_updater.Thunderstore.Count() > 0) + if (_updater.Thunderstore != null) { - DispatchIfNecessary(async () => + if (_updater.Thunderstore.Count() > 0) { - Thunderstore_List.Items.Clear(); + DispatchIfNecessary(async () => + { + Thunderstore_List.Items.Clear(); - loadConvertItemLazy(); + loadConvertItemLazy(); - }); + }); + } } - } - // Call_Ts_Mods(); + // Call_Ts_Mods(); - }; - worker.RunWorkerCompleted += (sender, eventArgs) => - { + }; + worker.RunWorkerCompleted += (sender, eventArgs) => + { - //Thunderstore_List.Refresh(); + //Thunderstore_List.Refresh(); - }; - worker.RunWorkerAsync(); + }; + worker.RunWorkerAsync(); @@ -5079,12 +5076,12 @@ private void Search_Filters_SelectionChanged(object sender, SelectionChangedEven + } } } - } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -5093,43 +5090,45 @@ private void Search_Filters_SelectionChanged(object sender, SelectionChangedEven } async Task OPEN_WEBPAGE(string URL) { - try { - await Task.Run(() => + try { - DispatchIfNecessary(async () => { - SnackBar.Message = "Opening the Following URL - " + URL; - SnackBar.Title = "INFO"; - SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; - SnackBar.Show(); - }); + await Task.Run(() => + { + DispatchIfNecessary(async () => + { + SnackBar.Message = "Opening the Following URL - " + URL; + SnackBar.Title = "INFO"; + SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; + SnackBar.Show(); + }); - Thread.Sleep(2000); - System.Diagnostics.Process.Start(new ProcessStartInfo - { - FileName = URL, - UseShellExecute = true - }); - }); + Thread.Sleep(2000); + System.Diagnostics.Process.Start(new ProcessStartInfo + { + FileName = URL, + UseShellExecute = true + }); + }); - } + } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } + } -} + } private void Open_Webpage_Click(object sender, RoutedEventArgs e) { - - + + var URL = ((System.Windows.Controls.Button)sender).Tag.ToString(); OPEN_WEBPAGE(URL); - + } private void ScrollViewer_MouseMove_1(object sender, MouseEventArgs e) @@ -5189,65 +5188,66 @@ public static Size MeasureTextSize(string text, FontFamily fontFamily, FontStyle Brushes.Black); return new Size(ft.Width, ft.Height); } - + private void canMain_IsVisibleChanged(object sender, RoutedEventArgs e) { - + } private void Sort_SelectionChanged(object sender, SelectionChangedEventArgs e) { - try { - if (Sort.SelectedItem != null && Sort.SelectedItem.ToString().Length > 1) - { - Sort_Label.Visibility = Visibility.Hidden; - } - else - { - Sort_Label.Visibility = Visibility.Visible; - - } - if (page_loaded == true) + try { - //Thunderstore_List.ItemsSource = null; - + if (Sort.SelectedItem != null && Sort.SelectedItem.ToString().Length > 1) + { + Sort_Label.Visibility = Visibility.Hidden; + } + else + { + Sort_Label.Visibility = Visibility.Visible; - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += (sender, e) => + } + if (page_loaded == true) { - + //Thunderstore_List.ItemsSource = null; - //Call_Ts_Mods(); - if (_updater.Thunderstore != null) + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += (sender, e) => { - if (_updater.Thunderstore.Count() > 0) + + + //Call_Ts_Mods(); + + if (_updater.Thunderstore != null) { - DispatchIfNecessary(async () => + if (_updater.Thunderstore.Count() > 0) { - Thunderstore_List.Items.Clear(); + DispatchIfNecessary(async () => + { + Thunderstore_List.Items.Clear(); - orderlistitems(); - }); + orderlistitems(); + }); + } } - } - }; - worker.RunWorkerCompleted += (sender, eventArgs) => - { + }; + worker.RunWorkerCompleted += (sender, eventArgs) => + { - Thunderstore_List.Refresh(); + Thunderstore_List.Refresh(); - }; - worker.RunWorkerAsync(); + }; + worker.RunWorkerAsync(); - } + } } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -5257,8 +5257,8 @@ private void Sort_SelectionChanged(object sender, SelectionChangedEventArgs e) private void Search_Bar_Suggest_Mods_KeyUp(object sender, KeyEventArgs e) { - - + + } private void Grid_GotFocus(object sender, RoutedEventArgs e) @@ -5271,41 +5271,42 @@ private void Sort_LostFocus(object sender, RoutedEventArgs e) } private void Grid_Loaded(object sender, RoutedEventArgs e) - {try + { + try { - - if (page_loaded == true) - { - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += (sender, e) => + + if (page_loaded == true) { + BackgroundWorker worker = new BackgroundWorker(); + worker.DoWork += (sender, e) => + { - Call_Mods_From_Folder_Lite(); - // Call_Ts_Mods(); + Call_Mods_From_Folder_Lite(); + // Call_Ts_Mods(); - - }; - worker.RunWorkerCompleted += (sender, eventArgs) => - { - Thunderstore_List.Refresh(); + }; + worker.RunWorkerCompleted += (sender, eventArgs) => + { + + Thunderstore_List.Refresh(); - }; - - - - worker.RunWorkerAsync(); - } + }; + + + + worker.RunWorkerAsync(); + } } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -5316,79 +5317,81 @@ private void Grid_Loaded(object sender, RoutedEventArgs e) private void Page_Loaded_1(object sender, RoutedEventArgs e) { - + } private void Thunderstore_Grid_Panel_Loaded(object sender, RoutedEventArgs e) - {try { - DispatchIfNecessary(async () => + { + try { - - - - Grid Card; - if (sender.GetType() == typeof(Grid)) + DispatchIfNecessary(async () => { - Card = sender as Grid; - HandyControl.Controls.SimplePanel GridPanel_ = FindVisualChild(Card); - Wpf.Ui.Controls.CardAction Card_Action = FindVisualChild(Card); - UIElement childElement = FindVisualChild(Card); - if (childElement != null && childElement is Border border && border.Name == "IMG_PNL") - { - if (border.Tag.ToString() == "1") - { - border.BorderBrush = Brushes.DarkGoldenrod; // ... - } - border.Refresh(); - - } - if (Card != null && GridPanel_ != null && Card_Action != null) + Grid Card; + if (sender.GetType() == typeof(Grid)) { + Card = sender as Grid; + HandyControl.Controls.SimplePanel GridPanel_ = FindVisualChild(Card); + Wpf.Ui.Controls.CardAction Card_Action = FindVisualChild(Card); + UIElement childElement = FindVisualChild(Card); + if (childElement != null && childElement is Border border && border.Name == "IMG_PNL") + { + if (border.Tag.ToString() == "1") + { + border.BorderBrush = Brushes.DarkGoldenrod; // ... + } + border.Refresh(); - string tooltip_string = Card_Action.ToolTip.ToString().Replace("northstar-Northstar", "").Replace("ebkr-r2modman-", ""); - if (tooltip_string.Count() > 5 && tooltip_string.Length > 5 && Card_Action.ToolTip.ToString().Length > 5) - { - Card_Action.IsEnabled = true; - Card_Action.Icon = Wpf.Ui.Common.SymbolRegular.BoxMultipleCheckmark20; - Card_Action.IconForeground = Brushes.LawnGreen; - SlowBlink(Card_Action, 0.3); } - else + + if (Card != null && GridPanel_ != null && Card_Action != null) { - DoubleAnimation x = new DoubleAnimation + + + string tooltip_string = Card_Action.ToolTip.ToString().Replace("northstar-Northstar", "").Replace("ebkr-r2modman-", ""); + + if (tooltip_string.Count() > 5 && tooltip_string.Length > 5 && Card_Action.ToolTip.ToString().Length > 5) + { + Card_Action.IsEnabled = true; + Card_Action.Icon = Wpf.Ui.Common.SymbolRegular.BoxMultipleCheckmark20; + Card_Action.IconForeground = Brushes.LawnGreen; + SlowBlink(Card_Action, 0.3); + } + else { + DoubleAnimation x = new DoubleAnimation + { - }; - Card_Action.BeginAnimation(OpacityProperty, x); - Card_Action.IsEnabled = false; - Card_Action.Icon = Wpf.Ui.Common.SymbolRegular.BoxMultiple20; + }; + Card_Action.BeginAnimation(OpacityProperty, x); + Card_Action.IsEnabled = false; + Card_Action.Icon = Wpf.Ui.Common.SymbolRegular.BoxMultiple20; - } + } - } + } - } + } - if (Mod_Update_Counter > 0) - { - Mod_Updates_Available.Visibility = Visibility.Visible; - } - else - { - Mod_Updates_Available.Visibility = Visibility.Hidden; - } - }); + if (Mod_Update_Counter > 0) + { + Mod_Updates_Available.Visibility = Visibility.Visible; + } + else + { + Mod_Updates_Available.Visibility = Visibility.Hidden; + } + }); } catch (Exception ex) { - //Removed PaperTrailSystem Due to lack of reliability. + //Removed PaperTrailSystem Due to lack of reliability. Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy-MM- dd-HH-mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); @@ -5403,19 +5406,20 @@ private void SymbolIcon_MouseEnter(object sender, MouseEventArgs e) DispatchIfNecessary(async () => { - Wpf.Ui.Controls.SymbolIcon Favourite_ = sender as Wpf.Ui.Controls.SymbolIcon; - if (Favourite_.IsManipulationEnabled == true) - { - if (Favourite_.Filled == false){ - Favourite_.Filled = true; - } - } + Wpf.Ui.Controls.SymbolIcon Favourite_ = sender as Wpf.Ui.Controls.SymbolIcon; + if (Favourite_.IsManipulationEnabled == true) + { + if (Favourite_.Filled == false) + { + Favourite_.Filled = true; + } + } }); } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -5433,9 +5437,9 @@ private void Favourite_MouseLeave(object sender, MouseEventArgs e) HandyControl.Controls.SimplePanel _Panel = (HandyControl.Controls.SimplePanel)((Wpf.Ui.Controls.SymbolIcon)sender).Parent; if (Favourite_.IsManipulationEnabled == false) { - - Favourite_.Filled = false; - + + Favourite_.Filled = false; + } @@ -5443,12 +5447,12 @@ private void Favourite_MouseLeave(object sender, MouseEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } - + private void SymbolIcon_MouseDown(object sender, MouseButtonEventArgs e) { try @@ -5486,7 +5490,7 @@ private void SymbolIcon_MouseDown(object sender, MouseButtonEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -5518,7 +5522,7 @@ private void SymbolIcon_Loaded(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -5538,7 +5542,7 @@ public static async Task WriteToLogFileAsync(string Destination, string director string fileName = name + ".mc"; string filePath = Path.Combine(Destination, fileName); - string fileContent = directory + Environment.NewLine; + string fileContent = directory + Environment.NewLine; if (File.Exists(filePath) && !overwrite) { @@ -5549,18 +5553,19 @@ public static async Task WriteToLogFileAsync(string Destination, string director { await writer.WriteAsync(fileContent); } - }catch(Exception ex) + } + catch (Exception ex) { } } - + private void LIKEBTTN_SourceUpdated(object sender, DataTransferEventArgs e) { - + } } - + } diff --git a/VTOL_2.0.0/Pages/Page_Tools.xaml.cs b/VTOL_2.0.0/Pages/Page_Tools.xaml.cs index 1a007969..211aeeaa 100644 --- a/VTOL_2.0.0/Pages/Page_Tools.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Tools.xaml.cs @@ -1,11 +1,26 @@ -using System; +using BCnEncoder.Encoder; +using Downloader; +using ImageMagick; +using ImageMagick.Formats; +using Microsoft.Win32; +using Pfim; +using Serilog; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; +using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; -using System.Text; +using System.Net; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using System.Windows; @@ -14,41 +29,17 @@ using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ZipFile_ = Ionic.Zip.ZipFile; -using System.Drawing.Imaging; -using Microsoft.Win32; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.PixelFormats; -using SixLabors.ImageSharp.Processing; +using System.Windows.Threading; using Wpf.Ui.Common; using Brushes = System.Windows.Media.Brushes; +using Exception = System.Exception; using Image = SixLabors.ImageSharp.Image; using Path = System.IO.Path; -using ZipFile = System.IO.Compression.ZipFile; -using BCnEncoder.Encoder; -using ImageMagick; -using ImageMagick.Formats; -using Serilog; -using System.Globalization; -using Pfim; using PixelFormat = System.Drawing.Imaging.PixelFormat; -using System.Diagnostics; -using System.Windows.Media.Animation; -using System.Text.RegularExpressions; -using System.Reflection; -using Downloader; -using System.ComponentModel; -using System.Runtime.InteropServices; -using System.Text.Json; -using System.Windows.Threading; -using System.Collections.ObjectModel; -using System.Security.Policy; -using Lsj.Util.Win32.Structs; -using System.Net; -using Exception = System.Exception; +using ZipFile = System.IO.Compression.ZipFile; +using ZipFile_ = Ionic.Zip.ZipFile; namespace VTOL.Pages { @@ -1401,7 +1392,8 @@ private void Image_Icon_MouseDown(object sender, MouseButtonEventArgs e) private void Image_Icon_Drop(object sender, DragEventArgs e) { - try { + try + { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { HandyControl.Controls.DashedBorder DashedBorder = (HandyControl.Controls.DashedBorder)sender; @@ -1882,7 +1874,8 @@ private void Output_Bt_W_Progress_Click(object sender, RoutedEventArgs e) private string GetSkinPackRootPath() { string f = null; - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { f = Output_Directory.Text + "\\" + SelectedWeapon + "_" + Skin_Name.Text + ".zip"; }); return f; @@ -2650,7 +2643,8 @@ private void Button_Click(object sender, RoutedEventArgs e) private bool DdsToPng(string imagePath, string outputPath) { - try { + try + { // yoinked from pfim usage example using (var image = Pfimage.FromFile(imagePath)) { @@ -3066,7 +3060,8 @@ private void Tabs_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { - if (!Directory.Exists(Tools_Dir)) { + if (!Directory.Exists(Tools_Dir)) + { TryCreateDirectory(Tools_Dir); if (!Directory.Exists(Tools_Dir)) @@ -3248,89 +3243,89 @@ private void Image_Icon_Advocate_MouseDown(object sender, MouseButtonEventArgs e // Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); // } - // } - } + // } + } - private void Image_Icon_Advocate_Drop(object sender, DragEventArgs e) - { - try + private void Image_Icon_Advocate_Drop(object sender, DragEventArgs e) { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) + try { - HandyControl.Controls.DashedBorder DashedBorder = (HandyControl.Controls.DashedBorder)sender; - Console.WriteLine(DashedBorder.Name); + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + { + HandyControl.Controls.DashedBorder DashedBorder = (HandyControl.Controls.DashedBorder)sender; + Console.WriteLine(DashedBorder.Name); - // Note that you can have more than one file. - string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); - string map_Path = files.FirstOrDefault(); + // Note that you can have more than one file. + string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); + string map_Path = files.FirstOrDefault(); - if (!File.Exists(map_Path)) - { + if (!File.Exists(map_Path)) + { - SnackBar.Icon = SymbolRegular.ErrorCircle20; - SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_NotAValidPNGImage; - SnackBar.Show(); - return; + SnackBar.Icon = SymbolRegular.ErrorCircle20; + SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_NotAValidPNGImage; + SnackBar.Show(); + return; - } - else - { - if (Path.GetExtension(map_Path).Contains("png")) + } + else { - int imgwidth; - int imgheight; - - using (var image = SixLabors.ImageSharp.Image.Load(map_Path)) + if (Path.GetExtension(map_Path).Contains("png")) { - imgwidth = image.Width; - imgheight = image.Height; - } + int imgwidth; + int imgheight; + using (var image = SixLabors.ImageSharp.Image.Load(map_Path)) + { + imgwidth = image.Width; + imgheight = image.Height; + } - if (imgwidth == 256 && imgheight == 256) - { - BitmapImage map_ = new BitmapImage(); - map_.BeginInit(); + if (imgwidth == 256 && imgheight == 256) + { - map_.UriSource = new Uri(map_Path); - map_.EndInit(); + BitmapImage map_ = new BitmapImage(); + map_.BeginInit(); - DashedBorder.Background = new ImageBrush(map_); - Mod_Adv_Icon_Path = map_Path; - } - else - { - SnackBar.Icon = SymbolRegular.ErrorCircle20; - SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_InvalidImageSizeMustBe256x256; - SnackBar.Show(); - DashedBorder.Background = new ImageBrush(); - return; + map_.UriSource = new Uri(map_Path); + map_.EndInit(); + + DashedBorder.Background = new ImageBrush(map_); + Mod_Adv_Icon_Path = map_Path; + } + else + { + SnackBar.Icon = SymbolRegular.ErrorCircle20; + SnackBar.Appearance = ControlAppearance.Danger; SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Icon_Image_MouseDown_InvalidImageSizeMustBe256x256; + SnackBar.Show(); + DashedBorder.Background = new ImageBrush(); + return; + + } } } - } + } } + catch (Exception ex) + { + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); - } - catch (Exception ex) - { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + } } - - } private void Locate_Repak_Exe_Click(object sender, RoutedEventArgs e) { try @@ -3343,7 +3338,7 @@ private void Locate_Repak_Exe_Click(object sender, RoutedEventArgs e) if (openFileDialog.ShowDialog() == true) { Mod_Adv_Repak_Path = openFileDialog.FileName; - + if (!File.Exists(Mod_Adv_Repak_Path)) { @@ -3374,7 +3369,7 @@ private void Locate_Repak_Exe_Click(object sender, RoutedEventArgs e) } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } } @@ -3410,7 +3405,7 @@ private void Save_Mod_Advocate_Click(object sender, RoutedEventArgs e) { //Convert(); } - async void Start_Exe(string path , string args = null) + async void Start_Exe(string path, string args = null) { try { @@ -3432,7 +3427,7 @@ await Task.Run(() => SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; SnackBar.Show(); }); - if (args != null && args.Trim() != "") + if (args != null && args.Trim() != "") { Process.Start(new ProcessStartInfo { @@ -3461,7 +3456,7 @@ await Task.Run(() => } public bool Check_Python_Installation() { - string result = "" ; + string result = ""; ProcessStartInfo pycheck = new ProcessStartInfo(); pycheck.FileName = "@python.exe"; @@ -3488,7 +3483,7 @@ public bool Check_Python_Installation() } return false; } - async void Start_Command_Line(string path,string working_dir,bool Custom_ = false, string args = "") + async void Start_Command_Line(string path, string working_dir, bool Custom_ = false, string args = "") { try { @@ -3546,7 +3541,7 @@ await Task.Run(() => } catch (Exception ex) { - Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); + Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}"); } @@ -3572,34 +3567,34 @@ void Open_Folder(string Folder) } } - + public bool UrlIsValid(string url) { try { - - HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest; - request.Timeout = 5000; //set the timeout to 5 seconds to keep the user from waiting too long for the page to load - request.Method = "HEAD"; //Get only the header information -- no need to download any content - using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) + HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest; + request.Timeout = 5000; //set the timeout to 5 seconds to keep the user from waiting too long for the page to load + request.Method = "HEAD"; //Get only the header information -- no need to download any content + + using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) + { + int statusCode = (int)response.StatusCode; + if (statusCode >= 100 && statusCode < 400) //Good requests { - int statusCode = (int)response.StatusCode; - if (statusCode >= 100 && statusCode < 400) //Good requests - { - return true; - } - else if (statusCode >= 500 && statusCode <= 510) //Server Errors + return true; + } + else if (statusCode >= 500 && statusCode <= 510) //Server Errors { - - SnackBar.Message = String.Format("The remote server has thrown an internal error. Url is not valid: {0}", url); - SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; - SnackBar.Show(); + + SnackBar.Message = String.Format("The remote server has thrown an internal error. Url is not valid: {0}", url); + SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; + SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; + SnackBar.Show(); return false; - } } - + } + } catch (WebException ex) { @@ -3609,22 +3604,22 @@ public bool UrlIsValid(string url) } else { - - SnackBar.Message = String.Format("Unhandled status [{0}] returned for url: {1}", ex.Status, url); + + SnackBar.Message = String.Format("Unhandled status [{0}] returned for url: {1}", ex.Status, url); SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; SnackBar.Show(); - + } } catch (Exception ex) { - - SnackBar.Message = String.Format("Could not test url {0}.", url); + + SnackBar.Message = String.Format("Could not test url {0}.", url); SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; SnackBar.Show(); - + } return false; } @@ -3632,52 +3627,52 @@ async Task Download_Zip_To_Path(string Sub_Name, string URL) { try { - - await Task.Run(() => + + await Task.Run(() => + { + DispatchIfNecessary(async () => { - DispatchIfNecessary(async () => + if (!UrlIsValid(URL)) { - if (!UrlIsValid(URL)) + SnackBar.Message = " Url is not valid"; + SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; + SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; + SnackBar.Show(); + return; + } + SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Download_Zip_To_Path_DownloadingAndInstalling + Sub_Name; + SnackBar.Title = "INFO"; + SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; + SnackBar.Show(); + if (Directory.Exists(Tools_Dir)) + { + if (!Directory.Exists(Tools_Dir + Sub_Name)) { - SnackBar.Message = " Url is not valid"; - SnackBar.Title = VTOL.Resources.Languages.Language.ERROR; - SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Danger; - SnackBar.Show(); - return; + TryCreateDirectory(Tools_Dir + Sub_Name); } - SnackBar.Message = VTOL.Resources.Languages.Language.Page_Tools_Download_Zip_To_Path_DownloadingAndInstalling + Sub_Name; - SnackBar.Title = "INFO"; - SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; - SnackBar.Show(); - if (Directory.Exists(Tools_Dir)) + IDownload downloader = DownloadBuilder.New() + .WithUrl(URL) + .WithDirectory(Tools_Dir + Sub_Name) + .WithFileName(Sub_Name + ".zip") + .WithConfiguration(new DownloadConfiguration()) + + .Build(); + downloader.DownloadFileCompleted += delegate (object sender, AsyncCompletedEventArgs e) { - if (!Directory.Exists(Tools_Dir + Sub_Name)) - { - TryCreateDirectory(Tools_Dir + Sub_Name); - } - IDownload downloader = DownloadBuilder.New() - .WithUrl(URL) - .WithDirectory(Tools_Dir + Sub_Name) - .WithFileName(Sub_Name + ".zip") - .WithConfiguration(new DownloadConfiguration()) - - .Build(); - downloader.DownloadFileCompleted += delegate (object sender, AsyncCompletedEventArgs e) - { - downloader_DownloadCompleted(sender, e, Sub_Name, URL); - }; + downloader_DownloadCompleted(sender, e, Sub_Name, URL); + }; - downloader.StartAsync(); + downloader.StartAsync(); - } - }); + } }); - - + }); + + } catch (Exception ex) { @@ -3687,12 +3682,12 @@ await Task.Run(() => } void downloader_DownloadCompleted(object sender, AsyncCompletedEventArgs e, string Sub_Name, string URL) { - ZipFile_ zipFile = new ZipFile_(Tools_Dir + Sub_Name+@"\" +Sub_Name + ".zip"); + ZipFile_ zipFile = new ZipFile_(Tools_Dir + Sub_Name + @"\" + Sub_Name + ".zip"); + + zipFile.ExtractAll(Tools_Dir, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently); - zipFile.ExtractAll(Tools_Dir, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently); - Check_For_Tools(); - + if (File.Exists(Tools_Dir + Sub_Name + @"\" + Sub_Name + ".zip")) { @@ -3703,7 +3698,8 @@ async Task OPEN_WEBPAGE(string URL) { await Task.Run(() => { - DispatchIfNecessary(async () => { + DispatchIfNecessary(async () => + { SnackBar.Message = VTOL.Resources.Languages.Language.Page_Skins_OPEN_WEBPAGE_OpeningTheFollowingURL + URL; SnackBar.Title = "INFO"; SnackBar.Appearance = Wpf.Ui.Common.ControlAppearance.Info; @@ -3726,11 +3722,11 @@ await Task.Run(async () => //Task.Run automatically unwraps nested Task types! { DispatchIfNecessary(async () => { - + if (Directory.Exists(Tools_Dir)) { //Legion+ - if(Directory.Exists(Tools_Dir + @"LEGION+") && File.Exists(Tools_Dir + @"LEGION+\" + "LegionPlus.exe")) + if (Directory.Exists(Tools_Dir + @"LEGION+") && File.Exists(Tools_Dir + @"LEGION+\" + "LegionPlus.exe")) { LEGION_INSTALL.Content = VTOL.Resources.Languages.Language.Page_Tools_Check_For_Tools_Launch; LEGION_INSTALL.Icon = SymbolRegular.Open28; @@ -3908,7 +3904,7 @@ await Task.Run(async () => //Task.Run automatically unwraps nested Task types! else { - TryCreateDirectory(Tools_Dir); + TryCreateDirectory(Tools_Dir); Check_For_Tools(); } @@ -3917,11 +3913,11 @@ await Task.Run(async () => //Task.Run automatically unwraps nested Task types! }); } - + private void LEGION_INSTALL_FOLDER_Click(object sender, RoutedEventArgs e) { - if (Directory.Exists(Tools_Dir + @"LEGION+") ) + if (Directory.Exists(Tools_Dir + @"LEGION+")) { Open_Folder(Tools_Dir + @"LEGION+"); } @@ -4022,7 +4018,7 @@ private void REPAK_INSTALL_Click(object sender, RoutedEventArgs e) if (Directory.Exists(Tools_Dir + @"RePak") && File.Exists(Tools_Dir + @"RePak\" + "RePak.exe")) { Start_Exe(Tools_Dir + @"RePak\" + "RePak.exe", Properties.Settings.Default.RePak_Launch_Args); - // Start_Command_Line(Tools_Dir + @"RePak\" + "RePak.exe", Tools_Dir + @"RePak",true, Properties.Settings.Default.RePak_Launch_Args); + // Start_Command_Line(Tools_Dir + @"RePak\" + "RePak.exe", Tools_Dir + @"RePak",true, Properties.Settings.Default.RePak_Launch_Args); } else @@ -4133,13 +4129,13 @@ private void Advanced_Repak_Click(object sender, RoutedEventArgs e) private void Startup_Args_RpAk_LostFocus(object sender, RoutedEventArgs e) { Startup_Args_RpAk.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#34FFFFFF"); - + } private void Startup_Args_RpAk_GotFocus(object sender, RoutedEventArgs e) { Startup_Args_RpAk.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#FFFFFFFF"); - + } private void MDL_TOOL_INSTALL_Click(object sender, RoutedEventArgs e) @@ -4179,10 +4175,10 @@ private void ESMT_TOOL_FOLDER_Click(object sender, RoutedEventArgs e) } } - - - + + + private void ESMT_TOOL_INSTALL_Click(object sender, RoutedEventArgs e) { if (Directory.Exists(Tools_Dir + @"ESMT_Easy_sound_modding_tool") && File.Exists(Tools_Dir + @"ESMT_Easy_sound_modding_tool\" + "main.py")) diff --git a/VTOL_2.0.0/Pages/Page_Updates.xaml.cs b/VTOL_2.0.0/Pages/Page_Updates.xaml.cs index 543c719e..a2333f6a 100644 --- a/VTOL_2.0.0/Pages/Page_Updates.xaml.cs +++ b/VTOL_2.0.0/Pages/Page_Updates.xaml.cs @@ -1,17 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using System.Windows.Controls; namespace VTOL.Pages { diff --git a/VTOL_2.0.0/Pages/Window_Tool_Image_Editor_Wizard.xaml.cs b/VTOL_2.0.0/Pages/Window_Tool_Image_Editor_Wizard.xaml.cs index 0ffdada9..ee4a1a3b 100644 --- a/VTOL_2.0.0/Pages/Window_Tool_Image_Editor_Wizard.xaml.cs +++ b/VTOL_2.0.0/Pages/Window_Tool_Image_Editor_Wizard.xaml.cs @@ -1,16 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; namespace VTOL.Pages { @@ -25,7 +14,7 @@ public partial class Window_Tool_Image_Editor_Wizard : Window public Window_Tool_Image_Editor_Wizard() { InitializeComponent(); - + } private void Window_Closed(object sender, EventArgs e) @@ -37,7 +26,7 @@ private void Window_Closed(object sender, EventArgs e) //{ // Last_Saved_Skin_Path = e.Location; // Console.WriteLine("Saved To - " + e.Location); - + //} } diff --git a/VTOL_2.0.0/Scripts/Advocate/DDSImage.cs b/VTOL_2.0.0/Scripts/Advocate/DDSImage.cs index c97e30a2..20f3c3c9 100644 --- a/VTOL_2.0.0/Scripts/Advocate/DDSImage.cs +++ b/VTOL_2.0.0/Scripts/Advocate/DDSImage.cs @@ -1,9 +1,8 @@ -using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.PixelFormats; using System; using System.IO; -using SixLabors.ImageSharp; using Image = SixLabors.ImageSharp.Image; -using System.Windows; namespace VTOL { public class DDSImage diff --git a/VTOL_2.0.0/Scripts/Advocate/Header.cs b/VTOL_2.0.0/Scripts/Advocate/Header.cs index 9f7670d3..ea6e46ee 100644 --- a/VTOL_2.0.0/Scripts/Advocate/Header.cs +++ b/VTOL_2.0.0/Scripts/Advocate/Header.cs @@ -1,338 +1,334 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace VTOL.Advocate.DDS { - internal class Header - { + internal class Header + { - // public variables for getting information about the header - public string Magic { get { return magic.ToString(); } } - public int Size { get { return (int)size; } } + // public variables for getting information about the header + public string Magic { get { return magic.ToString(); } } + public int Size { get { return (int)size; } } - public uint Flags { get; set; } - public int Width { get { return (int)width; } } - public int Height { get { return (int)height; } } - public int PitchOrLinearSize { get { return (int)pitchOrLinearSize; } set { pitchOrLinearSize = (uint)value; } } - public int MipMapCount { get { return (int)mipMapCount; } set { mipMapCount = (uint)value; } } + public uint Flags { get; set; } + public int Width { get { return (int)width; } } + public int Height { get { return (int)height; } } + public int PitchOrLinearSize { get { return (int)pitchOrLinearSize; } set { pitchOrLinearSize = (uint)value; } } + public int MipMapCount { get { return (int)mipMapCount; } set { mipMapCount = (uint)value; } } - public string FourCC { get { return new string(pixel_FourCC); } } - public bool isDX10 { get; private set; } - public DXGI_FORMAT DXGIFormat { get { return dxgiFormat; } } + public string FourCC { get { return new string(pixel_FourCC); } } + public bool isDX10 { get; private set; } + public DXGI_FORMAT DXGIFormat { get { return dxgiFormat; } } - // dds file structure - char[] magic = new char[4]; - // header - uint size; - uint flags; - uint height; - uint width; - uint pitchOrLinearSize; - uint depth; - uint mipMapCount; - char[] reserved = new char[44]; - // header -> pixel format - uint pixel_Size; - uint pixel_Flags; - char[] pixel_FourCC = new char[4]; - uint pixel_RGBBitCount; - uint pixel_rBitMask; - uint pixel_gBitMask; - uint pixel_bBitMask; - uint pixel_aBitMask; - // header again - uint caps; - uint caps2; - uint caps3; - uint caps4; - uint reserved1; - // dx10 header - DXGI_FORMAT dxgiFormat; - DX10ResourceDimension resourceDimension; - uint miscFlags; - uint arraySize; - DX10AlphaMode alphaMode; + // dds file structure + char[] magic = new char[4]; + // header + uint size; + uint flags; + uint height; + uint width; + uint pitchOrLinearSize; + uint depth; + uint mipMapCount; + char[] reserved = new char[44]; + // header -> pixel format + uint pixel_Size; + uint pixel_Flags; + char[] pixel_FourCC = new char[4]; + uint pixel_RGBBitCount; + uint pixel_rBitMask; + uint pixel_gBitMask; + uint pixel_bBitMask; + uint pixel_aBitMask; + // header again + uint caps; + uint caps2; + uint caps3; + uint caps4; + uint reserved1; + // dx10 header + DXGI_FORMAT dxgiFormat; + DX10ResourceDimension resourceDimension; + uint miscFlags; + uint arraySize; + DX10AlphaMode alphaMode; - public Header(BinaryReader reader) - { - // read magic - magic = reader.ReadChars(4); - if (new string(magic) != "DDS ") - { - throw new Exception("File is not a valid DDS file!"); - } - // read header - size = reader.ReadUInt32(); - flags = reader.ReadUInt32(); - height = reader.ReadUInt32(); - width = reader.ReadUInt32(); - pitchOrLinearSize = reader.ReadUInt32(); - depth = reader.ReadUInt32(); - mipMapCount = reader.ReadUInt32(); - reserved = reader.ReadChars(44); - pixel_Size = reader.ReadUInt32(); - pixel_Flags = reader.ReadUInt32(); - pixel_FourCC = reader.ReadChars(4); - pixel_RGBBitCount = reader.ReadUInt32(); - pixel_rBitMask = reader.ReadUInt32(); - pixel_gBitMask = reader.ReadUInt32(); - pixel_bBitMask = reader.ReadUInt32(); - pixel_aBitMask = reader.ReadUInt32(); - caps = reader.ReadUInt32(); - caps2 = reader.ReadUInt32(); - caps3 = reader.ReadUInt32(); - caps4 = reader.ReadUInt32(); - reserved1 = reader.ReadUInt32(); - // read extra header if needed - isDX10 = new string(pixel_FourCC) == "DX10"; - if (isDX10) - { - //Logging.Logger.Debug("DDS file is using DX10"); - dxgiFormat = (DXGI_FORMAT)reader.ReadUInt32(); - resourceDimension = (DX10ResourceDimension)reader.ReadUInt32(); - miscFlags = reader.ReadUInt32(); - arraySize = reader.ReadUInt32(); - alphaMode = (DX10AlphaMode)reader.ReadUInt32(); - } - } + public Header(BinaryReader reader) + { + // read magic + magic = reader.ReadChars(4); + if (new string(magic) != "DDS ") + { + throw new Exception("File is not a valid DDS file!"); + } + // read header + size = reader.ReadUInt32(); + flags = reader.ReadUInt32(); + height = reader.ReadUInt32(); + width = reader.ReadUInt32(); + pitchOrLinearSize = reader.ReadUInt32(); + depth = reader.ReadUInt32(); + mipMapCount = reader.ReadUInt32(); + reserved = reader.ReadChars(44); + pixel_Size = reader.ReadUInt32(); + pixel_Flags = reader.ReadUInt32(); + pixel_FourCC = reader.ReadChars(4); + pixel_RGBBitCount = reader.ReadUInt32(); + pixel_rBitMask = reader.ReadUInt32(); + pixel_gBitMask = reader.ReadUInt32(); + pixel_bBitMask = reader.ReadUInt32(); + pixel_aBitMask = reader.ReadUInt32(); + caps = reader.ReadUInt32(); + caps2 = reader.ReadUInt32(); + caps3 = reader.ReadUInt32(); + caps4 = reader.ReadUInt32(); + reserved1 = reader.ReadUInt32(); + // read extra header if needed + isDX10 = new string(pixel_FourCC) == "DX10"; + if (isDX10) + { + //Logging.Logger.Debug("DDS file is using DX10"); + dxgiFormat = (DXGI_FORMAT)reader.ReadUInt32(); + resourceDimension = (DX10ResourceDimension)reader.ReadUInt32(); + miscFlags = reader.ReadUInt32(); + arraySize = reader.ReadUInt32(); + alphaMode = (DX10AlphaMode)reader.ReadUInt32(); + } + } - public void Convert() - { - string str_fourCC = new(pixel_FourCC); + public void Convert() + { + string str_fourCC = new(pixel_FourCC); - switch (str_fourCC) - { - case "DXT1": - ToDX10(DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB); - break; - case "ATI2": - //Logging.Logger.Debug($"DDS file is using ATI2, changing to BC5U"); - pixel_FourCC = new char[4] { 'B', 'C', '5', 'U' }; - goto case "BC5U"; - case "BC5U": - if ((flags & 0x000A0000) != 0x000A0000) - flags |= 0x000A0000; - break; - case "BC4U": - //ToDX10(DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM); - if ((flags & 0x000A0000) != 0x000A0000) - flags |= 0x000A0000; - if ((caps & 0x00400000) != 0x00400000) - caps |= 0x00400000; - if ((caps & 0x00000008) != 0x00000008) - caps |= 0x00000008; - break; - case "DX10": - // some DXGI formats arent in their SRGB variants, but we need them to be - dxgiFormat = dxgiFormat switch - { - DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM => DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM_SRGB, - _ => dxgiFormat - }; - break; + switch (str_fourCC) + { + case "DXT1": + ToDX10(DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB); + break; + case "ATI2": + //Logging.Logger.Debug($"DDS file is using ATI2, changing to BC5U"); + pixel_FourCC = new char[4] { 'B', 'C', '5', 'U' }; + goto case "BC5U"; + case "BC5U": + if ((flags & 0x000A0000) != 0x000A0000) + flags |= 0x000A0000; + break; + case "BC4U": + //ToDX10(DXGI_FORMAT.DXGI_FORMAT_BC4_UNORM); + if ((flags & 0x000A0000) != 0x000A0000) + flags |= 0x000A0000; + if ((caps & 0x00400000) != 0x00400000) + caps |= 0x00400000; + if ((caps & 0x00000008) != 0x00000008) + caps |= 0x00000008; + break; + case "DX10": + // some DXGI formats arent in their SRGB variants, but we need them to be + dxgiFormat = dxgiFormat switch + { + DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM => DXGI_FORMAT.DXGI_FORMAT_BC7_UNORM_SRGB, + _ => dxgiFormat + }; + break; - default: - //Logging.Logger.Debug($"DDS file is using {str_fourCC}, which is unsupported."); - throw new NotImplementedException("DDS fourCC not supported: " + str_fourCC); - } - } + default: + //Logging.Logger.Debug($"DDS file is using {str_fourCC}, which is unsupported."); + throw new NotImplementedException("DDS fourCC not supported: " + str_fourCC); + } + } - public void ToDX10(DXGI_FORMAT format) - { - dxgiFormat = format; - arraySize = 1; - resourceDimension = DX10ResourceDimension.Texture2D; - alphaMode = DX10AlphaMode.Unknown; - miscFlags = 0; - pixel_FourCC = new char[4] { 'D', 'X', '1', '0' }; - isDX10 = true; - } + public void ToDX10(DXGI_FORMAT format) + { + dxgiFormat = format; + arraySize = 1; + resourceDimension = DX10ResourceDimension.Texture2D; + alphaMode = DX10AlphaMode.Unknown; + miscFlags = 0; + pixel_FourCC = new char[4] { 'D', 'X', '1', '0' }; + isDX10 = true; + } - public void Save(BinaryWriter writer) - { - // write magic - writer.Write(magic); - // write header - writer.Write(size); - writer.Write(flags); - writer.Write(height); - writer.Write(width); - writer.Write(pitchOrLinearSize); - writer.Write(depth); - writer.Write(mipMapCount); - writer.Write(reserved); - writer.Write(pixel_Size); - writer.Write(pixel_Flags); - writer.Write(pixel_FourCC); - writer.Write(pixel_RGBBitCount); - writer.Write(pixel_rBitMask); - writer.Write(pixel_gBitMask); - writer.Write(pixel_bBitMask); - writer.Write(pixel_aBitMask); - writer.Write(caps); - writer.Write(caps2); - writer.Write(caps3); - writer.Write(caps4); - writer.Write(reserved1); - // write dx10 header if needed - if (isDX10) - { - writer.Write((uint)dxgiFormat); - writer.Write((uint)resourceDimension); - writer.Write(miscFlags); - writer.Write(arraySize); - writer.Write((uint)alphaMode); - } - } - } + public void Save(BinaryWriter writer) + { + // write magic + writer.Write(magic); + // write header + writer.Write(size); + writer.Write(flags); + writer.Write(height); + writer.Write(width); + writer.Write(pitchOrLinearSize); + writer.Write(depth); + writer.Write(mipMapCount); + writer.Write(reserved); + writer.Write(pixel_Size); + writer.Write(pixel_Flags); + writer.Write(pixel_FourCC); + writer.Write(pixel_RGBBitCount); + writer.Write(pixel_rBitMask); + writer.Write(pixel_gBitMask); + writer.Write(pixel_bBitMask); + writer.Write(pixel_aBitMask); + writer.Write(caps); + writer.Write(caps2); + writer.Write(caps3); + writer.Write(caps4); + writer.Write(reserved1); + // write dx10 header if needed + if (isDX10) + { + writer.Write((uint)dxgiFormat); + writer.Write((uint)resourceDimension); + writer.Write(miscFlags); + writer.Write(arraySize); + writer.Write((uint)alphaMode); + } + } + } #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member - public enum DXGI_FORMAT : uint - { - DXGI_FORMAT_UNKNOWN, - DXGI_FORMAT_R32G32B32A32_TYPELESS, - DXGI_FORMAT_R32G32B32A32_FLOAT, - DXGI_FORMAT_R32G32B32A32_UINT, - DXGI_FORMAT_R32G32B32A32_SINT, - DXGI_FORMAT_R32G32B32_TYPELESS, - DXGI_FORMAT_R32G32B32_FLOAT, - DXGI_FORMAT_R32G32B32_UINT, - DXGI_FORMAT_R32G32B32_SINT, - DXGI_FORMAT_R16G16B16A16_TYPELESS, - DXGI_FORMAT_R16G16B16A16_FLOAT, - DXGI_FORMAT_R16G16B16A16_UNORM, - DXGI_FORMAT_R16G16B16A16_UINT, - DXGI_FORMAT_R16G16B16A16_SNORM, - DXGI_FORMAT_R16G16B16A16_SINT, - DXGI_FORMAT_R32G32_TYPELESS, - DXGI_FORMAT_R32G32_FLOAT, - DXGI_FORMAT_R32G32_UINT, - DXGI_FORMAT_R32G32_SINT, - DXGI_FORMAT_R32G8X24_TYPELESS, - DXGI_FORMAT_D32_FLOAT_S8X24_UINT, - DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, - DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, - DXGI_FORMAT_R10G10B10A2_TYPELESS, - DXGI_FORMAT_R10G10B10A2_UNORM, - DXGI_FORMAT_R10G10B10A2_UINT, - DXGI_FORMAT_R11G11B10_FLOAT, - DXGI_FORMAT_R8G8B8A8_TYPELESS, - DXGI_FORMAT_R8G8B8A8_UNORM, - DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, - DXGI_FORMAT_R8G8B8A8_UINT, - DXGI_FORMAT_R8G8B8A8_SNORM, - DXGI_FORMAT_R8G8B8A8_SINT, - DXGI_FORMAT_R16G16_TYPELESS, - DXGI_FORMAT_R16G16_FLOAT, - DXGI_FORMAT_R16G16_UNORM, - DXGI_FORMAT_R16G16_UINT, - DXGI_FORMAT_R16G16_SNORM, - DXGI_FORMAT_R16G16_SINT, - DXGI_FORMAT_R32_TYPELESS, - DXGI_FORMAT_D32_FLOAT, - DXGI_FORMAT_R32_FLOAT, - DXGI_FORMAT_R32_UINT, - DXGI_FORMAT_R32_SINT, - DXGI_FORMAT_R24G8_TYPELESS, - DXGI_FORMAT_D24_UNORM_S8_UINT, - DXGI_FORMAT_R24_UNORM_X8_TYPELESS, - DXGI_FORMAT_X24_TYPELESS_G8_UINT, - DXGI_FORMAT_R8G8_TYPELESS, - DXGI_FORMAT_R8G8_UNORM, - DXGI_FORMAT_R8G8_UINT, - DXGI_FORMAT_R8G8_SNORM, - DXGI_FORMAT_R8G8_SINT, - DXGI_FORMAT_R16_TYPELESS, - DXGI_FORMAT_R16_FLOAT, - DXGI_FORMAT_D16_UNORM, - DXGI_FORMAT_R16_UNORM, - DXGI_FORMAT_R16_UINT, - DXGI_FORMAT_R16_SNORM, - DXGI_FORMAT_R16_SINT, - DXGI_FORMAT_R8_TYPELESS, - DXGI_FORMAT_R8_UNORM, - DXGI_FORMAT_R8_UINT, - DXGI_FORMAT_R8_SNORM, - DXGI_FORMAT_R8_SINT, - DXGI_FORMAT_A8_UNORM, - DXGI_FORMAT_R1_UNORM, - DXGI_FORMAT_R9G9B9E5_SHAREDEXP, - DXGI_FORMAT_R8G8_B8G8_UNORM, - DXGI_FORMAT_G8R8_G8B8_UNORM, - DXGI_FORMAT_BC1_TYPELESS, - DXGI_FORMAT_BC1_UNORM, - DXGI_FORMAT_BC1_UNORM_SRGB, - DXGI_FORMAT_BC2_TYPELESS, - DXGI_FORMAT_BC2_UNORM, - DXGI_FORMAT_BC2_UNORM_SRGB, - DXGI_FORMAT_BC3_TYPELESS, - DXGI_FORMAT_BC3_UNORM, - DXGI_FORMAT_BC3_UNORM_SRGB, - DXGI_FORMAT_BC4_TYPELESS, - DXGI_FORMAT_BC4_UNORM, - DXGI_FORMAT_BC4_SNORM, - DXGI_FORMAT_BC5_TYPELESS, - DXGI_FORMAT_BC5_UNORM, - DXGI_FORMAT_BC5_SNORM, - DXGI_FORMAT_B5G6R5_UNORM, - DXGI_FORMAT_B5G5R5A1_UNORM, - DXGI_FORMAT_B8G8R8A8_UNORM, - DXGI_FORMAT_B8G8R8X8_UNORM, - DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, - DXGI_FORMAT_B8G8R8A8_TYPELESS, - DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, - DXGI_FORMAT_B8G8R8X8_TYPELESS, - DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, - DXGI_FORMAT_BC6H_TYPELESS, - DXGI_FORMAT_BC6H_UF16, - DXGI_FORMAT_BC6H_SF16, - DXGI_FORMAT_BC7_TYPELESS, - DXGI_FORMAT_BC7_UNORM, - DXGI_FORMAT_BC7_UNORM_SRGB, - DXGI_FORMAT_AYUV, - DXGI_FORMAT_Y410, - DXGI_FORMAT_Y416, - DXGI_FORMAT_NV12, - DXGI_FORMAT_P010, - DXGI_FORMAT_P016, - DXGI_FORMAT_420_OPAQUE, - DXGI_FORMAT_YUY2, - DXGI_FORMAT_Y210, - DXGI_FORMAT_Y216, - DXGI_FORMAT_NV11, - DXGI_FORMAT_AI44, - DXGI_FORMAT_IA44, - DXGI_FORMAT_P8, - DXGI_FORMAT_A8P8, - DXGI_FORMAT_B4G4R4A4_UNORM, - DXGI_FORMAT_P208, - DXGI_FORMAT_V208, - DXGI_FORMAT_V408, - DXGI_FORMAT_FORCE_UINT, - }; + public enum DXGI_FORMAT : uint + { + DXGI_FORMAT_UNKNOWN, + DXGI_FORMAT_R32G32B32A32_TYPELESS, + DXGI_FORMAT_R32G32B32A32_FLOAT, + DXGI_FORMAT_R32G32B32A32_UINT, + DXGI_FORMAT_R32G32B32A32_SINT, + DXGI_FORMAT_R32G32B32_TYPELESS, + DXGI_FORMAT_R32G32B32_FLOAT, + DXGI_FORMAT_R32G32B32_UINT, + DXGI_FORMAT_R32G32B32_SINT, + DXGI_FORMAT_R16G16B16A16_TYPELESS, + DXGI_FORMAT_R16G16B16A16_FLOAT, + DXGI_FORMAT_R16G16B16A16_UNORM, + DXGI_FORMAT_R16G16B16A16_UINT, + DXGI_FORMAT_R16G16B16A16_SNORM, + DXGI_FORMAT_R16G16B16A16_SINT, + DXGI_FORMAT_R32G32_TYPELESS, + DXGI_FORMAT_R32G32_FLOAT, + DXGI_FORMAT_R32G32_UINT, + DXGI_FORMAT_R32G32_SINT, + DXGI_FORMAT_R32G8X24_TYPELESS, + DXGI_FORMAT_D32_FLOAT_S8X24_UINT, + DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, + DXGI_FORMAT_X32_TYPELESS_G8X24_UINT, + DXGI_FORMAT_R10G10B10A2_TYPELESS, + DXGI_FORMAT_R10G10B10A2_UNORM, + DXGI_FORMAT_R10G10B10A2_UINT, + DXGI_FORMAT_R11G11B10_FLOAT, + DXGI_FORMAT_R8G8B8A8_TYPELESS, + DXGI_FORMAT_R8G8B8A8_UNORM, + DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, + DXGI_FORMAT_R8G8B8A8_UINT, + DXGI_FORMAT_R8G8B8A8_SNORM, + DXGI_FORMAT_R8G8B8A8_SINT, + DXGI_FORMAT_R16G16_TYPELESS, + DXGI_FORMAT_R16G16_FLOAT, + DXGI_FORMAT_R16G16_UNORM, + DXGI_FORMAT_R16G16_UINT, + DXGI_FORMAT_R16G16_SNORM, + DXGI_FORMAT_R16G16_SINT, + DXGI_FORMAT_R32_TYPELESS, + DXGI_FORMAT_D32_FLOAT, + DXGI_FORMAT_R32_FLOAT, + DXGI_FORMAT_R32_UINT, + DXGI_FORMAT_R32_SINT, + DXGI_FORMAT_R24G8_TYPELESS, + DXGI_FORMAT_D24_UNORM_S8_UINT, + DXGI_FORMAT_R24_UNORM_X8_TYPELESS, + DXGI_FORMAT_X24_TYPELESS_G8_UINT, + DXGI_FORMAT_R8G8_TYPELESS, + DXGI_FORMAT_R8G8_UNORM, + DXGI_FORMAT_R8G8_UINT, + DXGI_FORMAT_R8G8_SNORM, + DXGI_FORMAT_R8G8_SINT, + DXGI_FORMAT_R16_TYPELESS, + DXGI_FORMAT_R16_FLOAT, + DXGI_FORMAT_D16_UNORM, + DXGI_FORMAT_R16_UNORM, + DXGI_FORMAT_R16_UINT, + DXGI_FORMAT_R16_SNORM, + DXGI_FORMAT_R16_SINT, + DXGI_FORMAT_R8_TYPELESS, + DXGI_FORMAT_R8_UNORM, + DXGI_FORMAT_R8_UINT, + DXGI_FORMAT_R8_SNORM, + DXGI_FORMAT_R8_SINT, + DXGI_FORMAT_A8_UNORM, + DXGI_FORMAT_R1_UNORM, + DXGI_FORMAT_R9G9B9E5_SHAREDEXP, + DXGI_FORMAT_R8G8_B8G8_UNORM, + DXGI_FORMAT_G8R8_G8B8_UNORM, + DXGI_FORMAT_BC1_TYPELESS, + DXGI_FORMAT_BC1_UNORM, + DXGI_FORMAT_BC1_UNORM_SRGB, + DXGI_FORMAT_BC2_TYPELESS, + DXGI_FORMAT_BC2_UNORM, + DXGI_FORMAT_BC2_UNORM_SRGB, + DXGI_FORMAT_BC3_TYPELESS, + DXGI_FORMAT_BC3_UNORM, + DXGI_FORMAT_BC3_UNORM_SRGB, + DXGI_FORMAT_BC4_TYPELESS, + DXGI_FORMAT_BC4_UNORM, + DXGI_FORMAT_BC4_SNORM, + DXGI_FORMAT_BC5_TYPELESS, + DXGI_FORMAT_BC5_UNORM, + DXGI_FORMAT_BC5_SNORM, + DXGI_FORMAT_B5G6R5_UNORM, + DXGI_FORMAT_B5G5R5A1_UNORM, + DXGI_FORMAT_B8G8R8A8_UNORM, + DXGI_FORMAT_B8G8R8X8_UNORM, + DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, + DXGI_FORMAT_B8G8R8A8_TYPELESS, + DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, + DXGI_FORMAT_B8G8R8X8_TYPELESS, + DXGI_FORMAT_B8G8R8X8_UNORM_SRGB, + DXGI_FORMAT_BC6H_TYPELESS, + DXGI_FORMAT_BC6H_UF16, + DXGI_FORMAT_BC6H_SF16, + DXGI_FORMAT_BC7_TYPELESS, + DXGI_FORMAT_BC7_UNORM, + DXGI_FORMAT_BC7_UNORM_SRGB, + DXGI_FORMAT_AYUV, + DXGI_FORMAT_Y410, + DXGI_FORMAT_Y416, + DXGI_FORMAT_NV12, + DXGI_FORMAT_P010, + DXGI_FORMAT_P016, + DXGI_FORMAT_420_OPAQUE, + DXGI_FORMAT_YUY2, + DXGI_FORMAT_Y210, + DXGI_FORMAT_Y216, + DXGI_FORMAT_NV11, + DXGI_FORMAT_AI44, + DXGI_FORMAT_IA44, + DXGI_FORMAT_P8, + DXGI_FORMAT_A8P8, + DXGI_FORMAT_B4G4R4A4_UNORM, + DXGI_FORMAT_P208, + DXGI_FORMAT_V208, + DXGI_FORMAT_V408, + DXGI_FORMAT_FORCE_UINT, + }; - public enum DX10ResourceDimension : uint - { - Unknown = 0, - Buffer = 1, - Texture1D = 2, - Texture2D = 3, - Texture3D = 4, - }; + public enum DX10ResourceDimension : uint + { + Unknown = 0, + Buffer = 1, + Texture1D = 2, + Texture2D = 3, + Texture3D = 4, + }; - public enum DX10AlphaMode : uint - { - Unknown = 0, - Straight = 1, - PreMultiplied = 2, - Opaque = 3, - Custom = 4, - }; + public enum DX10AlphaMode : uint + { + Unknown = 0, + Straight = 1, + PreMultiplied = 2, + Opaque = 3, + Custom = 4, + }; #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } diff --git a/VTOL_2.0.0/Scripts/Advocate/JSON/Manifest.cs b/VTOL_2.0.0/Scripts/Advocate/JSON/Manifest.cs index 3870c000..a00a5bc7 100644 --- a/VTOL_2.0.0/Scripts/Advocate/JSON/Manifest.cs +++ b/VTOL_2.0.0/Scripts/Advocate/JSON/Manifest.cs @@ -1,19 +1,15 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace VTOL.Advocate.Conversion.JSON { #pragma warning disable IDE1006 // Naming Styles - internal class Manifest - { - public string name { get; set; } - public string version_number { get; set; } - public string website_url { get; set; } - public string[] dependencies { get; set; } = Array.Empty(); - public string description { get; set; } - } + internal class Manifest + { + public string name { get; set; } + public string version_number { get; set; } + public string website_url { get; set; } + public string[] dependencies { get; set; } = Array.Empty(); + public string description { get; set; } + } #pragma warning restore IDE1006 // Naming Styles } diff --git a/VTOL_2.0.0/Scripts/Advocate/JSON/Map.cs b/VTOL_2.0.0/Scripts/Advocate/JSON/Map.cs index d5a8104f..01821a6d 100644 --- a/VTOL_2.0.0/Scripts/Advocate/JSON/Map.cs +++ b/VTOL_2.0.0/Scripts/Advocate/JSON/Map.cs @@ -1,57 +1,52 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; +using System.Collections.Generic; using System.Text.Json.Serialization; -using System.Threading.Tasks; namespace VTOL.Advocate.Conversion.JSON { - internal class Map - { - [JsonPropertyName("name")] - public string Name { get; init; } - - [JsonPropertyName("assetsDir")] - public string AssetsDir { get; init; } - - [JsonPropertyName("outputDir")] - public string OutputDir { get; init; } - - [JsonPropertyName("version")] - public int Version { get; init; } = 7; // defaults to 7 (titanfall 2) - - // this could in theory have non-texture assets, but this will do for now - [JsonPropertyName("files")] - public List Files { get; private set; } = new(); - - public Map(string name, string assetsDir, string outputDir) - { - Name = name; - AssetsDir = assetsDir; - OutputDir = outputDir; - } - - public void AddTextureAsset(string path, string? starpakPath = null) - { - TextureAsset asset = new() { Path = path, DisableStreaming = starpakPath == null }; - Files.Add(asset); - } - } - - internal class TextureAsset - { - [JsonPropertyName("$type")] - public string Type { get; } = "txtr"; - - [JsonPropertyName("path")] - public string Path { get; init; } = ""; - - [JsonPropertyName("disableStreaming")] - public bool DisableStreaming { get; init; } = true; - - [JsonPropertyName("saveDebugName")] - public bool SaveDebugName { get; init; } = true; - } + internal class Map + { + [JsonPropertyName("name")] + public string Name { get; init; } + + [JsonPropertyName("assetsDir")] + public string AssetsDir { get; init; } + + [JsonPropertyName("outputDir")] + public string OutputDir { get; init; } + + [JsonPropertyName("version")] + public int Version { get; init; } = 7; // defaults to 7 (titanfall 2) + + // this could in theory have non-texture assets, but this will do for now + [JsonPropertyName("files")] + public List Files { get; private set; } = new(); + + public Map(string name, string assetsDir, string outputDir) + { + Name = name; + AssetsDir = assetsDir; + OutputDir = outputDir; + } + + public void AddTextureAsset(string path, string? starpakPath = null) + { + TextureAsset asset = new() { Path = path, DisableStreaming = starpakPath == null }; + Files.Add(asset); + } + } + + internal class TextureAsset + { + [JsonPropertyName("$type")] + public string Type { get; } = "txtr"; + + [JsonPropertyName("path")] + public string Path { get; init; } = ""; + + [JsonPropertyName("disableStreaming")] + public bool DisableStreaming { get; init; } = true; + + [JsonPropertyName("saveDebugName")] + public bool SaveDebugName { get; init; } = true; + } } diff --git a/VTOL_2.0.0/Scripts/Advocate/JSON/Mod.cs b/VTOL_2.0.0/Scripts/Advocate/JSON/Mod.cs index 98b0a5c9..30b59b59 100644 --- a/VTOL_2.0.0/Scripts/Advocate/JSON/Mod.cs +++ b/VTOL_2.0.0/Scripts/Advocate/JSON/Mod.cs @@ -1,19 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Advocate.Conversion.JSON +namespace VTOL.Advocate.Conversion.JSON { - internal class Mod - { - public string Name { get; set; } - public string Description { get; set; } - public string Version { get; set; } - public int LoadPriority { get; set; } + internal class Mod + { + public string Name { get; set; } + public string Description { get; set; } + public string Version { get; set; } + public int LoadPriority { get; set; } - // there are more fields here but we dont need them for a simple skin mod - } + // there are more fields here but we dont need them for a simple skin mod + } } diff --git a/VTOL_2.0.0/Scripts/Advocate/JSON/RPak.cs b/VTOL_2.0.0/Scripts/Advocate/JSON/RPak.cs index 60dd9f35..c66b03e0 100644 --- a/VTOL_2.0.0/Scripts/Advocate/JSON/RPak.cs +++ b/VTOL_2.0.0/Scripts/Advocate/JSON/RPak.cs @@ -1,14 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; namespace VTOL.Advocate.Conversion.JSON { - internal class RPak - { - public Dictionary Preload { get; set; } - // there is also Postload and Aliases but we dont need them for now - } + internal class RPak + { + public Dictionary Preload { get; set; } + // there is also Postload and Aliases but we dont need them for now + } } diff --git a/VTOL_2.0.0/Scripts/Advocate/Manager.cs b/VTOL_2.0.0/Scripts/Advocate/Manager.cs index f2453ae6..c12d3d21 100644 --- a/VTOL_2.0.0/Scripts/Advocate/Manager.cs +++ b/VTOL_2.0.0/Scripts/Advocate/Manager.cs @@ -4,13 +4,12 @@ using System.IO; using System.Linq; using System.Text; -using System.Threading.Tasks; namespace VTOL.Advocate.DDS { - internal class Manager - { - /* the purpose of this class is: + internal class Manager + { + /* the purpose of this class is: * 1. to store the raw dds images for a texture * 2. to delegate mipmap generation * 3. to act as the way that other classes interact with DDS files @@ -18,201 +17,201 @@ internal class Manager * */ - // holds the different images used to create the single image with mipmaps - // the key is the number of pixels in the mip level (width * height) - private SortedList mipmaps = new(); - - public int MipMapCount { get { return mipmaps.Count; } } - - private Header lastHeader; - - public void LoadImage(BinaryReader reader) - { - // load the header - Header hdr = new(reader); - // override lastHeader if this dds is higher resolution (should make my life easier) - if (lastHeader == null || hdr.Width * hdr.Height > lastHeader.Width * lastHeader.Height) - { - lastHeader = hdr; - } - - // if the fourCC does not match up, skip this image - if (lastHeader.FourCC != hdr.FourCC) - { - //Logging.Logger.Debug($"fourCC ({hdr.FourCC}) for added image does not match existing images ({lastHeader.FourCC})"); - return; - } - // if the DXGI format does not match up, also skip this image - if (lastHeader.isDX10 == hdr.isDX10 && lastHeader.DXGIFormat != hdr.DXGIFormat) - { - //Logging.Logger.Debug($"{lastHeader.isDX10} != {hdr.isDX10} or {lastHeader.DXGIFormat} == {hdr.DXGIFormat}"); - //Logging.Logger.Debug($"DXGI format for added image ({hdr.DXGIFormat}) does not match existing images ({lastHeader.DXGIFormat})"); - return; - } - - // read the image data into mipmaps dictionary - for (int i = 0; i < hdr.MipMapCount || i == 0; i++) - { - int width = hdr.Width / (int)Math.Pow(2, i); - int height = hdr.Height / (int)Math.Pow(2, i); - int numPixels = width * height; - // if we already have a mip for this resolution, dont do anything - if (mipmaps.ContainsKey(numPixels)) - { - continue; - } - - // sometimes dds files dont have this set (WHICH IS ANNOYING) - // to "fix" this, just assume its all one mip level - if (hdr.PitchOrLinearSize == 0) - { - //Logging.Logger.Debug($"DDS file did not have pitchOrLinearSize set, assuming the DDS file has no mipmaps"); - mipmaps[numPixels] = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position)); - break; - } - else - { - int actualSize = Math.Max(hdr.PitchOrLinearSize / (int)Math.Pow(4, i), 16); - mipmaps[numPixels] = reader.ReadBytes(actualSize); - //Logging.Logger.Debug($"Found mip level:\n Width: {width} Height: {height}"); - } - } - } - - public void SaveImage(BinaryWriter writer) - { - // edit the header to work - lastHeader.PitchOrLinearSize = mipmaps.Values.Last().Length; - lastHeader.MipMapCount = mipmaps.Count; - // make sure that the mipmap flag is set if we have more than 1 mip level - if (lastHeader.MipMapCount > 0) - { - lastHeader.Flags |= 0x20000; - } - - // write the header - lastHeader.Save(writer); - // write the image data (bigger mips first so iterate backwards) - for (int i = mipmaps.Count - 1; i >= 0; --i) - { - writer.Write(mipmaps.Values[i]); - } - } - - public void SaveImage_NoMipMaps(BinaryWriter writer) - { - // edit the header to work - lastHeader.PitchOrLinearSize = mipmaps.Values.Last().Length; - lastHeader.MipMapCount = 1; - // make sure that the mipmap flag is set if we have more than 1 mip level - if (lastHeader.MipMapCount > 0) - { - lastHeader.Flags |= 0x20000; - } - - // write the header - lastHeader.Save(writer); - // write the image data (only the biggest mip) - writer.Write(mipmaps.Values.Last()); - } - - public bool HasMissingMips() - { - // if there are 0 missing mips, return true - return GetMissingMips().Count != 0; - } - - public List GetMissingMips() - { - List ret = new(); - // if the highest resolution key is a square number then the image is a square, if not, assume its 2:1/1:2 - // floating point precision will eventually make this break, but that shouldnt be the case with numbers as small as 268435456 (16384^2) - // i doubt we will get larger images than that, thats 16k resolution. If we do end up having this be a problem, i swear to god - bool isSquare = Math.Sqrt(mipmaps.Last().Key) % 1 == 0; - - int curKey = mipmaps.Last().Key; - // square images will have their final mipmap be 1x1, non square will get down to 1x2 and then have a 1x1 as well (for some reason) - // we check the 1x1 for non-square images separately - while (curKey != (isSquare ? 1 : 2)) - { - // the total area of the next mipmap is 1/4 of the area of the current mipmap - curKey /= 4; - - // if we dont have a mipmap entry for this key, we are missing a mip - if (!mipmaps.ContainsKey(curKey)) - ret.Add(curKey); - } - - // check for non-square images having a 1x1 mip - if (!isSquare && !mipmaps.ContainsKey(1)) - ret.Add(1); - - return ret; - } - - public void GenerateMissingMips(string texconvPath) - { - // find which mips we need to generate - List missing = GetMissingMips(); - - // no missing mips, just return - if (missing.Count == 0) - return; - - // create a temp file and make a DDS with no mipmaps there - string temp = Guid.NewGuid().ToString() + ".dds"; - //string temp2 = $"{Converter.tempFolderPath}\\TexConv\\Before"; - //string temp3 = $"{Converter.tempFolderPath}\\TexConv\\After"; - // Directory.CreateDirectory(temp2); - // Directory.CreateDirectory(temp3); - // BinaryWriter writer = new(new FileStream($"{temp2}\\{temp}", FileMode.Create)); - // SaveImage_NoMipMaps(writer); - // writer.Close(); - - // use texconv - - string format; - if (lastHeader.isDX10) - { - format = Enum.GetName(typeof(DXGI_FORMAT), lastHeader.DXGIFormat).Replace("DXGI_FORMAT_", "") + " -dx10"; - } - else - { - format = lastHeader.FourCC; - - // fix some format aliases that texcov does not support - format = format switch - { - "BC4U" => "BC4_UNORM", - "ATI2" => "BC5_UNORM", - _ => format - }; - } - - // convert the dds into a dds with mipmaps using texconv - StringBuilder sb = new(); - Process proc = new(); - proc.StartInfo.RedirectStandardOutput = true; - proc.StartInfo.RedirectStandardError = true; - proc.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); - proc.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); - proc.StartInfo.UseShellExecute = false; - proc.StartInfo.CreateNoWindow = true; - proc.StartInfo.FileName = texconvPath; - // proc.StartInfo.Arguments = $"-f {format} -nologo -m 0 -bc d -o {temp3} -y {temp2}\\{temp}"; - proc.Start(); - proc.WaitForExit(); - - //Logging.Logger.Debug(sb.ToString()); - - // BinaryReader reader = new(new FileStream($"{temp3}\\{temp}", FileMode.Open)); - // LoadImage(reader); - // reader.Close(); - } - - public void Convert() - { - lastHeader.Convert(); - } - } + // holds the different images used to create the single image with mipmaps + // the key is the number of pixels in the mip level (width * height) + private SortedList mipmaps = new(); + + public int MipMapCount { get { return mipmaps.Count; } } + + private Header lastHeader; + + public void LoadImage(BinaryReader reader) + { + // load the header + Header hdr = new(reader); + // override lastHeader if this dds is higher resolution (should make my life easier) + if (lastHeader == null || hdr.Width * hdr.Height > lastHeader.Width * lastHeader.Height) + { + lastHeader = hdr; + } + + // if the fourCC does not match up, skip this image + if (lastHeader.FourCC != hdr.FourCC) + { + //Logging.Logger.Debug($"fourCC ({hdr.FourCC}) for added image does not match existing images ({lastHeader.FourCC})"); + return; + } + // if the DXGI format does not match up, also skip this image + if (lastHeader.isDX10 == hdr.isDX10 && lastHeader.DXGIFormat != hdr.DXGIFormat) + { + //Logging.Logger.Debug($"{lastHeader.isDX10} != {hdr.isDX10} or {lastHeader.DXGIFormat} == {hdr.DXGIFormat}"); + //Logging.Logger.Debug($"DXGI format for added image ({hdr.DXGIFormat}) does not match existing images ({lastHeader.DXGIFormat})"); + return; + } + + // read the image data into mipmaps dictionary + for (int i = 0; i < hdr.MipMapCount || i == 0; i++) + { + int width = hdr.Width / (int)Math.Pow(2, i); + int height = hdr.Height / (int)Math.Pow(2, i); + int numPixels = width * height; + // if we already have a mip for this resolution, dont do anything + if (mipmaps.ContainsKey(numPixels)) + { + continue; + } + + // sometimes dds files dont have this set (WHICH IS ANNOYING) + // to "fix" this, just assume its all one mip level + if (hdr.PitchOrLinearSize == 0) + { + //Logging.Logger.Debug($"DDS file did not have pitchOrLinearSize set, assuming the DDS file has no mipmaps"); + mipmaps[numPixels] = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position)); + break; + } + else + { + int actualSize = Math.Max(hdr.PitchOrLinearSize / (int)Math.Pow(4, i), 16); + mipmaps[numPixels] = reader.ReadBytes(actualSize); + //Logging.Logger.Debug($"Found mip level:\n Width: {width} Height: {height}"); + } + } + } + + public void SaveImage(BinaryWriter writer) + { + // edit the header to work + lastHeader.PitchOrLinearSize = mipmaps.Values.Last().Length; + lastHeader.MipMapCount = mipmaps.Count; + // make sure that the mipmap flag is set if we have more than 1 mip level + if (lastHeader.MipMapCount > 0) + { + lastHeader.Flags |= 0x20000; + } + + // write the header + lastHeader.Save(writer); + // write the image data (bigger mips first so iterate backwards) + for (int i = mipmaps.Count - 1; i >= 0; --i) + { + writer.Write(mipmaps.Values[i]); + } + } + + public void SaveImage_NoMipMaps(BinaryWriter writer) + { + // edit the header to work + lastHeader.PitchOrLinearSize = mipmaps.Values.Last().Length; + lastHeader.MipMapCount = 1; + // make sure that the mipmap flag is set if we have more than 1 mip level + if (lastHeader.MipMapCount > 0) + { + lastHeader.Flags |= 0x20000; + } + + // write the header + lastHeader.Save(writer); + // write the image data (only the biggest mip) + writer.Write(mipmaps.Values.Last()); + } + + public bool HasMissingMips() + { + // if there are 0 missing mips, return true + return GetMissingMips().Count != 0; + } + + public List GetMissingMips() + { + List ret = new(); + // if the highest resolution key is a square number then the image is a square, if not, assume its 2:1/1:2 + // floating point precision will eventually make this break, but that shouldnt be the case with numbers as small as 268435456 (16384^2) + // i doubt we will get larger images than that, thats 16k resolution. If we do end up having this be a problem, i swear to god + bool isSquare = Math.Sqrt(mipmaps.Last().Key) % 1 == 0; + + int curKey = mipmaps.Last().Key; + // square images will have their final mipmap be 1x1, non square will get down to 1x2 and then have a 1x1 as well (for some reason) + // we check the 1x1 for non-square images separately + while (curKey != (isSquare ? 1 : 2)) + { + // the total area of the next mipmap is 1/4 of the area of the current mipmap + curKey /= 4; + + // if we dont have a mipmap entry for this key, we are missing a mip + if (!mipmaps.ContainsKey(curKey)) + ret.Add(curKey); + } + + // check for non-square images having a 1x1 mip + if (!isSquare && !mipmaps.ContainsKey(1)) + ret.Add(1); + + return ret; + } + + public void GenerateMissingMips(string texconvPath) + { + // find which mips we need to generate + List missing = GetMissingMips(); + + // no missing mips, just return + if (missing.Count == 0) + return; + + // create a temp file and make a DDS with no mipmaps there + string temp = Guid.NewGuid().ToString() + ".dds"; + //string temp2 = $"{Converter.tempFolderPath}\\TexConv\\Before"; + //string temp3 = $"{Converter.tempFolderPath}\\TexConv\\After"; + // Directory.CreateDirectory(temp2); + // Directory.CreateDirectory(temp3); + // BinaryWriter writer = new(new FileStream($"{temp2}\\{temp}", FileMode.Create)); + // SaveImage_NoMipMaps(writer); + // writer.Close(); + + // use texconv + + string format; + if (lastHeader.isDX10) + { + format = Enum.GetName(typeof(DXGI_FORMAT), lastHeader.DXGIFormat).Replace("DXGI_FORMAT_", "") + " -dx10"; + } + else + { + format = lastHeader.FourCC; + + // fix some format aliases that texcov does not support + format = format switch + { + "BC4U" => "BC4_UNORM", + "ATI2" => "BC5_UNORM", + _ => format + }; + } + + // convert the dds into a dds with mipmaps using texconv + StringBuilder sb = new(); + Process proc = new(); + proc.StartInfo.RedirectStandardOutput = true; + proc.StartInfo.RedirectStandardError = true; + proc.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data); + proc.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data); + proc.StartInfo.UseShellExecute = false; + proc.StartInfo.CreateNoWindow = true; + proc.StartInfo.FileName = texconvPath; + // proc.StartInfo.Arguments = $"-f {format} -nologo -m 0 -bc d -o {temp3} -y {temp2}\\{temp}"; + proc.Start(); + proc.WaitForExit(); + + //Logging.Logger.Debug(sb.ToString()); + + // BinaryReader reader = new(new FileStream($"{temp3}\\{temp}", FileMode.Open)); + // LoadImage(reader); + // reader.Close(); + } + + public void Convert() + { + lastHeader.Convert(); + } + } } diff --git a/VTOL_2.0.0/Scripts/BugsRadar.cs b/VTOL_2.0.0/Scripts/BugsRadar.cs index c3097d91..dc773b06 100644 --- a/VTOL_2.0.0/Scripts/BugsRadar.cs +++ b/VTOL_2.0.0/Scripts/BugsRadar.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.IO; namespace VTOL.Scripts { diff --git a/VTOL_2.0.0/Scripts/FileInputMonitor.cs b/VTOL_2.0.0/Scripts/FileInputMonitor.cs index 90c06ed9..c030c55b 100644 --- a/VTOL_2.0.0/Scripts/FileInputMonitor.cs +++ b/VTOL_2.0.0/Scripts/FileInputMonitor.cs @@ -1,25 +1,23 @@ using System; using System.IO; -using System.Text; using System.Threading; -using System.Windows; namespace VTOL.Scripts { -public class FileInputMonitor -{ - - private FileSystemWatcher fileSystemWatcher; - - - public FileInputMonitor(string folderToWatchFor) + public class FileInputMonitor { - - fileSystemWatcher = new FileSystemWatcher(folderToWatchFor); - fileSystemWatcher.EnableRaisingEvents = true; + + private FileSystemWatcher fileSystemWatcher; + + + public FileInputMonitor(string folderToWatchFor) + { + + fileSystemWatcher = new FileSystemWatcher(folderToWatchFor); + fileSystemWatcher.EnableRaisingEvents = true; fileSystemWatcher.NotifyFilter = NotifyFilters.DirectoryName; fileSystemWatcher.Filter = " *.*"; @@ -29,39 +27,39 @@ public FileInputMonitor(string folderToWatchFor) fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.Created += new FileSystemEventHandler(FileCreated); - - } // end FileInputMonitor() + + } // end FileInputMonitor() private void OnChanged(object source, FileSystemEventArgs e) { } private void FileCreated(Object sender, FileSystemEventArgs e) - { + { } // end public void FileCreated(Object sender, FileSystemEventArgs e) private void ProcessFile(String fileName) - { - FileStream inputFileStream; - while (true) { - try - { - inputFileStream = new FileStream(fileName, - FileMode.Open, FileAccess.ReadWrite); - StreamReader reader = new StreamReader(inputFileStream); - Console.WriteLine(reader.ReadToEnd()); - // Break out from the endless loop - break; - } - catch (IOException) + FileStream inputFileStream; + while (true) { - // Sleep for 3 seconds before trying - Thread.Sleep(3000); - } // end try - } // end while(true) - } // end private void ProcessFile(String fileName) - -} // end public class FileInputMonitor - } + try + { + inputFileStream = new FileStream(fileName, + FileMode.Open, FileAccess.ReadWrite); + StreamReader reader = new StreamReader(inputFileStream); + Console.WriteLine(reader.ReadToEnd()); + // Break out from the endless loop + break; + } + catch (IOException) + { + // Sleep for 3 seconds before trying + Thread.Sleep(3000); + } // end try + } // end while(true) + } // end private void ProcessFile(String fileName) + + } // end public class FileInputMonitor +} diff --git a/VTOL_2.0.0/Scripts/IOExtensions/AccessRightsChecker.cs b/VTOL_2.0.0/Scripts/IOExtensions/AccessRightsChecker.cs index 8fcdc269..7b28818b 100644 --- a/VTOL_2.0.0/Scripts/IOExtensions/AccessRightsChecker.cs +++ b/VTOL_2.0.0/Scripts/IOExtensions/AccessRightsChecker.cs @@ -31,10 +31,10 @@ public static bool ItemHasPermision(string itemPath, FileSystemRights accessRigh } else { - + rules = FileSystemAclExtensions.GetAccessControl(dInfo).GetAccessRules(true, true, typeof(SecurityIdentifier)); } - + var identity = WindowsIdentity.GetCurrent(); string userSID = identity.User.Value; diff --git a/VTOL_2.0.0/Scripts/IOExtensions/FileTransferManager.cs b/VTOL_2.0.0/Scripts/IOExtensions/FileTransferManager.cs index be1c7eb1..d9a10361 100644 --- a/VTOL_2.0.0/Scripts/IOExtensions/FileTransferManager.cs +++ b/VTOL_2.0.0/Scripts/IOExtensions/FileTransferManager.cs @@ -37,7 +37,7 @@ public static TransferResult MoveWithProgress(string source, string destination, } }; - if(cancellationToken.IsCancellationRequested) + if (cancellationToken.IsCancellationRequested) { return TransferResult.Cancelled; } @@ -106,13 +106,13 @@ public static TransferResult CopyWithProgress(string source, string destination, } else { - if(cancellationToken.IsCancellationRequested) + if (cancellationToken.IsCancellationRequested) { return TransferResult.Cancelled; } var destinationFile = Helpers.CorrectFileDestinationPath(source, destination); - + return CopyFileWithProgress(source, destinationFile, progress, cancellationToken); } } @@ -131,14 +131,14 @@ private static TransferResult CopyDirectoryWithProgress(string sourceDirectory, { destinationNewRootDir = Directory.CreateDirectory(Path.Combine(destinationDirectory, rootSource.Name)); } - + foreach (var directory in rootSource.EnumerateDirectories("*", SearchOption.AllDirectories)) { - if(cancellationToken.IsCancellationRequested) + if (cancellationToken.IsCancellationRequested) { return TransferResult.Cancelled; } - var newName = directory.FullName.Substring(rootSourceLength+1); + var newName = directory.FullName.Substring(rootSourceLength + 1); Directory.CreateDirectory(Path.Combine(destinationNewRootDir.FullName, newName)); } @@ -149,7 +149,7 @@ private static TransferResult CopyDirectoryWithProgress(string sourceDirectory, return TransferResult.Cancelled; } - var newName = file.FullName.Substring(rootSourceLength+1); + var newName = file.FullName.Substring(rootSourceLength + 1); var fileCopyStartTimestamp = DateTime.Now; var result = CopyFileWithProgress(file.FullName, Path.Combine(destinationNewRootDir.FullName, newName), (partialProgress) => { @@ -168,7 +168,7 @@ private static TransferResult CopyDirectoryWithProgress(string sourceDirectory, { return TransferResult.Failed; } - else if(result == TransferResult.Cancelled) + else if (result == TransferResult.Cancelled) { return TransferResult.Cancelled; } @@ -211,15 +211,15 @@ private static TransferResult CopyFileWithProgress(string sourceFile, string new return NativeMethods.CopyProgressResult.PROGRESS_STOP; } }; - if(cancellationToken.IsCancellationRequested) + if (cancellationToken.IsCancellationRequested) { return TransferResult.Cancelled; } - + var ctr = cancellationToken.Register(() => pbCancel = 1); var result = NativeMethods.CopyFileEx(sourceFile, newFile, lpProgressRoutine, IntPtr.Zero, ref pbCancel, NativeMethods.CopyFileFlags.COPY_FILE_FAIL_IF_EXISTS); - if(cancellationToken.IsCancellationRequested) + if (cancellationToken.IsCancellationRequested) { return TransferResult.Cancelled; } diff --git a/VTOL_2.0.0/Scripts/Northstar_Json_Mods.cs b/VTOL_2.0.0/Scripts/Northstar_Json_Mods.cs index e26d7ca5..16328875 100644 --- a/VTOL_2.0.0/Scripts/Northstar_Json_Mods.cs +++ b/VTOL_2.0.0/Scripts/Northstar_Json_Mods.cs @@ -1,12 +1,7 @@ //using System.Text.Json; -using System.Text.Json.Serialization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; //using Utf8Json; using Newtonsoft.Json; +using System.Collections.Generic; //using Json.Net; namespace VTOL diff --git a/VTOL_2.0.0/Scripts/ParallaxEffect.cs b/VTOL_2.0.0/Scripts/ParallaxEffect.cs index b96cdb3e..3dc8311a 100644 --- a/VTOL_2.0.0/Scripts/ParallaxEffect.cs +++ b/VTOL_2.0.0/Scripts/ParallaxEffect.cs @@ -1,9 +1,4 @@ using Microsoft.Xaml.Behaviors; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; diff --git a/VTOL_2.0.0/Scripts/ProfileManager.cs b/VTOL_2.0.0/Scripts/ProfileManager.cs index f01bea4a..0508ab30 100644 --- a/VTOL_2.0.0/Scripts/ProfileManager.cs +++ b/VTOL_2.0.0/Scripts/ProfileManager.cs @@ -4,15 +4,13 @@ using System.ComponentModel; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace VTOL.Scripts { - //RUN PROFILES AFTER -//I REPEAT -//AFTER! -//INIT(); + //RUN PROFILES AFTER + //I REPEAT + //AFTER! + //INIT(); class Profile { public string name = "Northstar"; @@ -50,11 +48,11 @@ class ProfileManager public ProfileManager() { - + } - + // Initialize the whole thing, which accepts a predefined Default Profile for NorthstarCN maybe - public bool InitializeProfiles(Profile FallbackProfile) + public bool InitializeProfiles(Profile FallbackProfile) { files_p = FindFirstFiles(DocumentsFolder + @"\VTOL_DATA\Profiles\", "Profile.Json"); //Construct a default profile here, just for testing @@ -65,13 +63,13 @@ public bool InitializeProfiles(Profile FallbackProfile) LoadProfiles();// Just load the profile to memory if local config is found. return true; } - else + else { // Create structures for C# to not panic about folders and files not found. if (InitializeLocalProfileConfig()) { // If no profile is found, use the fallback profile or create a new one if no fallback specified. - if (FallbackProfile == null ) + if (FallbackProfile == null) { Profile defaultprofile = new Profile( "Northstar", @@ -84,7 +82,8 @@ public bool InitializeProfiles(Profile FallbackProfile) m_LoadedProfiles.Add(defaultprofile); } - else { + else + { m_LoadedProfiles.Add(FallbackProfile); } @@ -92,11 +91,11 @@ public bool InitializeProfiles(Profile FallbackProfile) WriteProfiles(); return true; } - else + else { // whoa harddrive go boom? how could this fail? } - + } @@ -170,31 +169,31 @@ public string[] FindFirstFiles(string path, string searchPattern) // simply return string.Empty. return null; } - public void SelectProfile(int profileidx) + public void SelectProfile(int profileidx) { currentProfile = (m_LoadedProfiles[profileidx]); ExecuteProfile(); } - public void SelectProfile(string profilename) + public void SelectProfile(string profilename) { - for (int i = 0; i < m_LoadedProfiles.Count; i++) + for (int i = 0; i < m_LoadedProfiles.Count; i++) { - if (m_LoadedProfiles[i].name == profilename) + if (m_LoadedProfiles[i].name == profilename) { - currentProfile=(m_LoadedProfiles[i]); + currentProfile = (m_LoadedProfiles[i]); ExecuteProfile(); } } - + } - public void ExecuteProfile() + public void ExecuteProfile() { // Do post profile selection things with currentProfile here. Console.WriteLine("Do post profile selection things with currentProfile here."); } - public bool ProfileConfigExists() + public bool ProfileConfigExists() { Console.WriteLine("Test some file structures and config file integrity"); @@ -277,7 +276,7 @@ public void LoadProfiles() } } - // m_LoadedProfiles.Clear(); + // m_LoadedProfiles.Clear(); Console.WriteLine("Loading Profiles from disk"); Console.WriteLine(string.Join(",", m_LoadedProfiles)); diff --git a/VTOL_2.0.0/Scripts/SerialQueue/SerialQueue.cs b/VTOL_2.0.0/Scripts/SerialQueue/SerialQueue.cs index 5a00f331..268fe33b 100644 --- a/VTOL_2.0.0/Scripts/SerialQueue/SerialQueue.cs +++ b/VTOL_2.0.0/Scripts/SerialQueue/SerialQueue.cs @@ -23,7 +23,7 @@ public Task Enqueue(Func function) { Task lastTask; Task resultTask; - + if (_lastTask.TryGetTarget(out lastTask)) { resultTask = lastTask.ContinueWith(_ => function(), TaskContinuationOptions.ExecuteSynchronously); @@ -34,7 +34,7 @@ public Task Enqueue(Func function) } _lastTask.SetTarget(resultTask); - + return resultTask; } } @@ -45,7 +45,7 @@ public Task Enqueue(Func asyncAction) { Task lastTask; Task resultTask; - + if (_lastTask.TryGetTarget(out lastTask)) { resultTask = lastTask.ContinueWith(_ => asyncAction(), TaskContinuationOptions.ExecuteSynchronously).Unwrap(); @@ -56,7 +56,7 @@ public Task Enqueue(Func asyncAction) } _lastTask.SetTarget(resultTask); - + return resultTask; } } @@ -67,7 +67,7 @@ public Task Enqueue(Func> asyncFunction) { Task lastTask; Task resultTask; - + if (_lastTask.TryGetTarget(out lastTask)) { resultTask = lastTask.ContinueWith(_ => asyncFunction(), TaskContinuationOptions.ExecuteSynchronously).Unwrap(); @@ -78,7 +78,7 @@ public Task Enqueue(Func> asyncFunction) } _lastTask.SetTarget(resultTask); - + return resultTask; } } diff --git a/VTOL_2.0.0/Scripts/Server_Setup.cs b/VTOL_2.0.0/Scripts/Server_Setup.cs index c9051d53..5920c8ed 100644 --- a/VTOL_2.0.0/Scripts/Server_Setup.cs +++ b/VTOL_2.0.0/Scripts/Server_Setup.cs @@ -1,16 +1,12 @@ -using System.Text.Json; +using System.Collections.Generic; +using System.Text.Json; using System.Text.Json.Serialization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace VTOL { public partial class Server_Setup { - + [JsonPropertyName("Startup_Arguments")] public List Startup_Arguments { get; set; } [JsonPropertyName("Convar_Arguments")] @@ -68,7 +64,7 @@ public partial class Server_Setup public static Server_Setup FromJson(string json) { - return JsonSerializer.Deserialize(json); + return JsonSerializer.Deserialize(json); } diff --git a/VTOL_2.0.0/Scripts/StarpakControl.cs b/VTOL_2.0.0/Scripts/StarpakControl.cs index 184f316a..3416ec01 100644 --- a/VTOL_2.0.0/Scripts/StarpakControl.cs +++ b/VTOL_2.0.0/Scripts/StarpakControl.cs @@ -1,16 +1,12 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; //Created By zxcPandora at https://github.com/zxcPandora/Titanfall2-SkinTool namespace VTOL { class StarpakControl { public StarpakControl(string name, long seek, int length, int type, string GamePath, string SelectedGame, int imagecheck, string Action) - { + { string FileName = null; string ControlPath = null; byte[] byData = new byte[length]; diff --git a/VTOL_2.0.0/Scripts/Thunderstore.cs b/VTOL_2.0.0/Scripts/Thunderstore.cs index 1c0cf683..17a5c2fc 100644 --- a/VTOL_2.0.0/Scripts/Thunderstore.cs +++ b/VTOL_2.0.0/Scripts/Thunderstore.cs @@ -1,10 +1,6 @@ -using System.Text.Json; +using System; +using System.Text.Json; using System.Text.Json.Serialization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace VTOL_DEPRECEATED { diff --git a/VTOL_2.0.0/Scripts/Thunderstore_V1.cs b/VTOL_2.0.0/Scripts/Thunderstore_V1.cs index c527a88b..34c36888 100644 --- a/VTOL_2.0.0/Scripts/Thunderstore_V1.cs +++ b/VTOL_2.0.0/Scripts/Thunderstore_V1.cs @@ -1,12 +1,8 @@ //using System.Text.Json; -using System.Text.Json.Serialization; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; //using Utf8Json; using Newtonsoft.Json; +using System; +using System.Collections.Generic; //using Json.Net; namespace VTOL @@ -96,7 +92,7 @@ public class versions public int FileSize { get; set; } } - + public partial class Thunderstore_V1 diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/AWall.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/AWall.cs index f3232a65..4cf7aa70 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/AWall.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/AWall.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/fbody.cs index 77a526c7..50e0b4e9 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall.Part { @@ -47,7 +43,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gauntlet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gauntlet.cs index 4ae07097..b6dda840 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gauntlet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gauntlet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall.Part { @@ -47,7 +43,7 @@ public gauntlet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gear.cs index 05d69348..4a3d5249 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall.Part { @@ -51,7 +47,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/helmet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/helmet.cs index 953675eb..d01fedae 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/helmet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/helmet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall.Part { @@ -51,7 +47,7 @@ public helmet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/jumpkit.cs index 85420fb7..f86fe45f 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall.Part { @@ -51,7 +47,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/mbody.cs index 193e90c5..35e1d17f 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/AWall/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.AWall.Part { @@ -47,7 +43,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } @@ -112,7 +108,7 @@ private void spcData(int ImageResolution) { int i = 1; ReallyData[] ReallyDatas = new ReallyData[4]; - ReallyDatas[0].seek =964497408; + ReallyDatas[0].seek = 964497408; ReallyDatas[0].length = 131072; ReallyDatas[0].seeklength = 148; while (i <= 3) diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Cloak.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Cloak.cs index 2726fa62..87eb0d50 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Cloak.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Cloak.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak { @@ -67,11 +63,11 @@ public Cloak(String PilotPart, int imagecheck) else if (str.Contains("cards")) { //wtf this part,texture the same with ghillie? - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } else { - throw new Exception("BUG!"+"\n"+ "In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/cards.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/cards.cs index 3a420775..80aea6a3 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/cards.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/cards.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part +namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { class cards { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/fbody.cs index 23e861b5..ffc455e9 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gauntlet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gauntlet.cs index 2baae3ef..70fe92bb 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gauntlet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gauntlet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public gauntlet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gear.cs index 92f47f9a..898aa690 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/ghillie.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/ghillie.cs index 9c6603db..8faccaa5 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/ghillie.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/ghillie.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public ghillie(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/helmet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/helmet.cs index 01a91254..1056c2b1 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/helmet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/helmet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public helmet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/jumpkit.cs index c2fd4690..15742d2b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/mbody.cs index 23583e59..f1c6ac20 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Cloak/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Cloak.Part { @@ -51,7 +47,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Grapple.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Grapple.cs index baf06e6d..d18a3986 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Grapple.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Grapple.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple { @@ -59,7 +55,7 @@ public Grapple(String PilotPart, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+ "In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/fbody.cs index 99a7f4af..6071795a 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple.Part { @@ -47,7 +43,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gauntlet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gauntlet.cs index 6c3f4fe8..6ab424b0 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gauntlet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gauntlet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple.Part { @@ -47,7 +43,7 @@ public gauntlet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gear.cs index 3e9daafa..ea1c04d8 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple.Part { @@ -47,7 +43,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/helmet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/helmet.cs index dd499d4f..c0c34983 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/helmet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/helmet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple.Part { @@ -47,7 +43,7 @@ public helmet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/jumpkit.cs index 9dfb5888..25153fe2 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple.Part { @@ -47,7 +43,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/mbody.cs index 168bdd5e..e3b34838 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Grapple/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Grapple.Part { @@ -43,7 +39,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/HoloPilot.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/HoloPilot.cs index 8070c8b3..fb553e3f 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/HoloPilot.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/HoloPilot.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot { @@ -59,7 +55,7 @@ public HoloPilot(String PilotPart, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+ "In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/fbody.cs index 477dd840..758045d4 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot.Part { @@ -51,7 +47,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/gear.cs index 46023a83..d89beb56 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot.Part { @@ -47,7 +43,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/helmet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/helmet.cs index 0ecea2a8..40f02615 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/helmet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/helmet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot.Part { @@ -51,7 +47,7 @@ public helmet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/jumpkit.cs index bab374a7..eb8b3141 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot.Part { @@ -51,7 +47,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/mbody.cs index 8990ed49..c24b861d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot.Part { @@ -51,7 +47,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/viewhand.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/viewhand.cs index 8373652b..2bb7753b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/viewhand.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/HoloPilot/Part/viewhand.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.HoloPilot.Part { @@ -47,7 +43,7 @@ public viewhand(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Jack.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Jack.cs index 68597d8b..d1205de9 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Jack.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Jack.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Jack { @@ -12,9 +8,9 @@ class Jack public string Length { get; private set; } public string SeekLength { get; private set; } //Jack Cooper Hands LOL - public Jack(String PilotPart,int imagecheck) + public Jack(String PilotPart, int imagecheck) { - String str = PilotPart.Substring(1,PilotPart.Length-5); + String str = PilotPart.Substring(1, PilotPart.Length - 5); if (str.Contains("gauntlet")) { Part.gauntlet ga = new Part.gauntlet(str, imagecheck); @@ -31,7 +27,7 @@ public Jack(String PilotPart,int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntlet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntlet.cs index 038dd90c..d80948ba 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntlet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntlet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Jack.Part { @@ -51,7 +47,7 @@ public gauntlet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } //Jack Cooper col layer use BC7U Compression diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntletr.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntletr.cs index dfd44245..fed62d2d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntletr.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Jack/Part/gauntletr.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Jack.Part { @@ -53,7 +49,7 @@ public gauntletr(String PartName, int imagecheck) */ else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } //Jack Cooper col layer use BC7U Compression @@ -75,120 +71,120 @@ private void colData(int ImageResolution) Length = Convert.ToString(ReallyDatas[ImageResolution].length); SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); } - /* - private void nmlData(int ImageResolution) - { - int i = 1; - ReallyData[] ReallyDatas = new ReallyData[3]; - ReallyDatas[0].seek = 241831936; - ReallyDatas[0].length = 262144; - ReallyDatas[0].seeklength = 128; - while (i <= 1) - { - ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; - ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; - ReallyDatas[i].seeklength = 128; - i++; - } - Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); - Length = Convert.ToString(ReallyDatas[ImageResolution].length); - SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); - } + /* + private void nmlData(int ImageResolution) + { + int i = 1; + ReallyData[] ReallyDatas = new ReallyData[3]; + ReallyDatas[0].seek = 241831936; + ReallyDatas[0].length = 262144; + ReallyDatas[0].seeklength = 128; + while (i <= 1) + { + ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; + ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; + ReallyDatas[i].seeklength = 128; + i++; + } + Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); + Length = Convert.ToString(ReallyDatas[ImageResolution].length); + SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); + } - private void glsData(int ImageResolution) - { - int i = 1; - ReallyData[] ReallyDatas = new ReallyData[3]; - ReallyDatas[0].seek = 247336960; - ReallyDatas[0].length = 131072; - ReallyDatas[0].seeklength = 128; - while (i <= 1) - { - ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; - ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; - ReallyDatas[i].seeklength = 128; - i++; - } - Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); - Length = Convert.ToString(ReallyDatas[ImageResolution].length); - SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); - } + private void glsData(int ImageResolution) + { + int i = 1; + ReallyData[] ReallyDatas = new ReallyData[3]; + ReallyDatas[0].seek = 247336960; + ReallyDatas[0].length = 131072; + ReallyDatas[0].seeklength = 128; + while (i <= 1) + { + ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; + ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; + ReallyDatas[i].seeklength = 128; + i++; + } + Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); + Length = Convert.ToString(ReallyDatas[ImageResolution].length); + SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); + } - private void spcData(int ImageResolution) - { - int i = 1; - ReallyData[] ReallyDatas = new ReallyData[3]; - ReallyDatas[0].seek = 250089472; - ReallyDatas[0].length = 131072; - ReallyDatas[0].seeklength = 128; - while (i <= 1) - { - ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; - ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; - ReallyDatas[i].seeklength = 128; - i++; - } - Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); - Length = Convert.ToString(ReallyDatas[ImageResolution].length); - SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); - } + private void spcData(int ImageResolution) + { + int i = 1; + ReallyData[] ReallyDatas = new ReallyData[3]; + ReallyDatas[0].seek = 250089472; + ReallyDatas[0].length = 131072; + ReallyDatas[0].seeklength = 128; + while (i <= 1) + { + ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; + ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; + ReallyDatas[i].seeklength = 128; + i++; + } + Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); + Length = Convert.ToString(ReallyDatas[ImageResolution].length); + SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); + } - private void ilmData(int ImageResolution) - { - int i = 1; - ReallyData[] ReallyDatas = new ReallyData[3]; - ReallyDatas[0].seek = 252841984; - ReallyDatas[0].length = 131072; - ReallyDatas[0].seeklength = 128; - while (i <= 1) - { - ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; - ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; - ReallyDatas[i].seeklength = 128; - i++; - } - Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); - Length = Convert.ToString(ReallyDatas[ImageResolution].length); - SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); - } + private void ilmData(int ImageResolution) + { + int i = 1; + ReallyData[] ReallyDatas = new ReallyData[3]; + ReallyDatas[0].seek = 252841984; + ReallyDatas[0].length = 131072; + ReallyDatas[0].seeklength = 128; + while (i <= 1) + { + ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; + ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; + ReallyDatas[i].seeklength = 128; + i++; + } + Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); + Length = Convert.ToString(ReallyDatas[ImageResolution].length); + SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); + } - private void aoData(int ImageResolution) - { - int i = 1; - ReallyData[] ReallyDatas = new ReallyData[3]; - ReallyDatas[0].seek = 255594496; - ReallyDatas[0].length = 131072; - ReallyDatas[0].seeklength = 128; - while (i <= 1) - { - ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; - ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; - ReallyDatas[i].seeklength = 128; - i++; - } - Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); - Length = Convert.ToString(ReallyDatas[ImageResolution].length); - SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); - } + private void aoData(int ImageResolution) + { + int i = 1; + ReallyData[] ReallyDatas = new ReallyData[3]; + ReallyDatas[0].seek = 255594496; + ReallyDatas[0].length = 131072; + ReallyDatas[0].seeklength = 128; + while (i <= 1) + { + ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; + ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; + ReallyDatas[i].seeklength = 128; + i++; + } + Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); + Length = Convert.ToString(ReallyDatas[ImageResolution].length); + SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); + } - private void cavData(int ImageResolution) - { - int i = 1; - ReallyData[] ReallyDatas = new ReallyData[3]; - ReallyDatas[0].seek = 258347008; - ReallyDatas[0].length = 131072; - ReallyDatas[0].seeklength = 128; - while (i <= 1) - { - ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; - ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; - ReallyDatas[i].seeklength = 128; - i++; - } - Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); - Length = Convert.ToString(ReallyDatas[ImageResolution].length); - SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); - } - */ + private void cavData(int ImageResolution) + { + int i = 1; + ReallyData[] ReallyDatas = new ReallyData[3]; + ReallyDatas[0].seek = 258347008; + ReallyDatas[0].length = 131072; + ReallyDatas[0].seeklength = 128; + while (i <= 1) + { + ReallyDatas[i].seek = ReallyDatas[i - 1].seek + ReallyDatas[i - 1].length; + ReallyDatas[i].length = ReallyDatas[i - 1].length * 4; + ReallyDatas[i].seeklength = 128; + i++; + } + Seek = Convert.ToString(ReallyDatas[ImageResolution].seek); + Length = Convert.ToString(ReallyDatas[ImageResolution].length); + SeekLength = Convert.ToString(ReallyDatas[ImageResolution].seeklength); + } + */ } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/fbody.cs index 5b19622a..11b1cb4b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -51,7 +47,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/gear.cs index 949e9489..6dc92f77 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -47,7 +43,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/hair.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/hair.cs index 45571115..8a719556 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/hair.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/hair.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -43,7 +39,7 @@ public hair(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/helmet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/helmet.cs index 8a2bd311..ead745e2 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/helmet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/helmet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -51,7 +47,7 @@ public helmet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/jumpkit.cs index ad8e02b6..d1bf0486 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -51,7 +47,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/mbody.cs index f97fc813..6a75f72b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -51,7 +47,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/viewhand.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/viewhand.cs index 2dec78df..c6649c56 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/viewhand.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/Part/viewhand.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift.Part { @@ -47,7 +43,7 @@ public viewhand(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/PhaseShift.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/PhaseShift.cs index b6680b6c..d57c211f 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/PhaseShift.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PhaseShift/PhaseShift.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PhaseShift { @@ -66,7 +62,7 @@ public PhaseShift(String PilotPart, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+ "In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/fbody.cs index de53b081..e2191ba9 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade.Part { @@ -39,7 +35,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gauntlet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gauntlet.cs index 3bd04d44..df4f5248 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gauntlet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gauntlet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade.Part { @@ -51,7 +47,7 @@ public gauntlet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gear.cs index 73cf72b9..97f993d0 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade.Part { @@ -43,7 +39,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/helmet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/helmet.cs index ed251a8a..1113e969 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/helmet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/helmet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade.Part { @@ -51,7 +47,7 @@ public helmet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/jumpkit.cs index 84ccf37e..1bf2429c 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade.Part { @@ -51,7 +47,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/mbody.cs index 979be707..e2b2a76a 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade.Part { @@ -39,7 +35,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/PulseBlade.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/PulseBlade.cs index 4ab5092f..958549f3 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/PulseBlade.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/PulseBlade/PulseBlade.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.PulseBlade { @@ -59,7 +55,7 @@ public PulseBlade(String PilotPart, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+ "In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fbody.cs index abce55c8..d1d4af0e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public fbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fgear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fgear.cs index ce9d29bb..c797e357 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fgear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fgear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public fgear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fjumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fjumpkit.cs index bbd08323..7af84592 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fjumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/fjumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public fjumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gauntlet.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gauntlet.cs index 173ac507..d8b1d2c5 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gauntlet.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gauntlet.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -48,7 +44,7 @@ public gauntlet(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gear.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gear.cs index 198a45f7..8f9ecb06 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gear.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/gear.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public gear(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/head.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/head.cs index cca1ef23..451bc644 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/head.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/head.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public head(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/jumpkit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/jumpkit.cs index 78e6ee72..26495078 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/jumpkit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/jumpkit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public jumpkit(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/mbody.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/mbody.cs index 5fd88abc..73875086 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/mbody.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Part/mbody.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim.Part { @@ -51,7 +47,7 @@ public mbody(String PartName, int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Texture Part."); + throw new Exception("BUG!" + "\n" + "In Texture Part."); } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Stim.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Stim.cs index 1f6d4cf4..0e780910 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Stim.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Normal Pilot/Stim/Stim.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Normal_Pilot.Stim { @@ -12,12 +8,12 @@ class Stim public string Length { get; private set; } public string SeekLength { get; private set; } //兴奋剂铁驭 - public Stim(String PilotPart,int imagecheck) + public Stim(String PilotPart, int imagecheck) { - String str = PilotPart.Substring(1,PilotPart.Length-5); + String str = PilotPart.Substring(1, PilotPart.Length - 5); if (str.Contains("fbody")) { - Part.fbody fb = new Part.fbody(str,imagecheck); + Part.fbody fb = new Part.fbody(str, imagecheck); Seek = fb.Seek; Length = fb.Length; SeekLength = fb.SeekLength; @@ -73,7 +69,7 @@ public Stim(String PilotPart,int imagecheck) } else { - throw new Exception("BUG!"+"\n"+"In Pilot Part."); + throw new Exception("BUG!" + "\n" + "In Pilot Part."); } } } diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/PilotDataControl.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/PilotDataControl.cs index 19e94b4c..1edc0f00 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/PilotDataControl.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/PilotDataControl.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using VTOL; namespace VTOL.Titanfall2_Requisite.PilotDataControl { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/head.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/head.cs index a51dd28e..c3020550 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/head.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/head.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Public_Data.Part { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/skeleton.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/skeleton.cs index c633f063..93aadd39 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/skeleton.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Part/skeleton.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Titanfall2_SkinTool.Titanfall2.PilotData.Public_Data.Part +namespace Titanfall2_SkinTool.Titanfall2.PilotData.Public_Data.Part { class skeleton { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Public.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Public.cs index d7fb0bc8..0369b909 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Public.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/PilotData/Public Data/Public.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.PilotData.Public_Data { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Cockpit.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Cockpit.cs index b795f234..d70efa17 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Cockpit.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Cockpit.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.TitanData.Cockpit { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Console.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Console.cs index 29de37f3..5185db63 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Console.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Console.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.TitanData.Cockpit { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Screen.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Screen.cs index 48ac3230..0730769b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Screen.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Cockpit/Screen.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Titanfall2_SkinTool.Titanfall2.TitanData.Cockpit +namespace Titanfall2_SkinTool.Titanfall2.TitanData.Cockpit { class Screen { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Public.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Public.cs index e73e64e2..735d5271 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Public.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/Public Data/Public.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Titanfall2_SkinTool.Titanfall2.TitanData.Public_Data { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/TitanDataControl.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/TitanDataControl.cs index d19f271d..9ac875ef 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/TitanDataControl.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/TitanData/TitanDataControl.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using VTOL; namespace VTOL.Titanfall2_Requisite.TitanDataControl { class TitanDataControl diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Archer.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Archer.cs index 6251ad6a..ab42b019 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Archer.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Archer.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Archer { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ChargeRifle.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ChargeRifle.cs index ca656e30..b39e6f63 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ChargeRifle.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ChargeRifle.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class ChargeRifle { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ION.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ION.cs index cd875d34..759df2c0 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ION.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/ION.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class ION { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Legion.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Legion.cs index 9515f142..9a8d0685 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Legion.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Legion.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Legion { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/MGL.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/MGL.cs index fdb4488e..c5c36e73 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/MGL.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/MGL.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class MGL { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Monarch.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Monarch.cs index c5f3d102..a2862d7d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Monarch.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Monarch.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Monarch { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Northstar.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Northstar.cs index a22e3381..59792cf2 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Northstar.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Northstar.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Northstar { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeION.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeION.cs index 45f521a6..98268e09 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeION.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeION.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class PrimeION { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeLegion.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeLegion.cs index a2961858..76129cc8 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeLegion.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeLegion.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class PrimeLegion { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeNorthstar.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeNorthstar.cs index 0994e6d7..9d491da6 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeNorthstar.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeNorthstar.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class PrimeNorthstar { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeRonin.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeRonin.cs index 6a4ca675..3b002c72 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeRonin.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeRonin.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class PrimeRonin { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeScorch.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeScorch.cs index 46b28e51..a96d25e8 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeScorch.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeScorch.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class PrimeScorch { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeTone.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeTone.cs index a00b710a..03d6b744 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeTone.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/PrimeTone.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class PrimeTone { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Ronin.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Ronin.cs index ad3e3c7b..431d00da 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Ronin.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Ronin.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Ronin { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Scorch.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Scorch.cs index 748c6a5d..4d3211fb 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Scorch.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Scorch.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Scorch { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Thunderbolt.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Thunderbolt.cs index 191f63f3..24e2c781 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Thunderbolt.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Thunderbolt.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Thunderbolt { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Tone.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Tone.cs index 156ed919..b955960b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Tone.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AntiTitan/Tone.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan { class Tone { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/G2A5.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/G2A5.cs index 827f622c..f49d1d60 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/G2A5.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/G2A5.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle { class G2A5 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/HemlokBFR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/HemlokBFR.cs index 0c325ea8..9c0f8cf9 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/HemlokBFR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/HemlokBFR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle { class HemlokBFR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R101.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R101.cs index e220ec02..692a5eff 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R101.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R101.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle { class R101 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R201.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R201.cs index 90a4c754..267dee96 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R201.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/R201.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle { class R201 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/V47Flatline.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/V47Flatline.cs index 7b490759..6e48135d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/V47Flatline.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/AssaultRifle/V47Flatline.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle { class V47Flatline { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AcogSight.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AcogSight.cs index e390e65a..3aa2131a 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AcogSight.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AcogSight.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class AcogSight { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AogSight.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AogSight.cs index 483b6646..81b41b65 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AogSight.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/AogSight.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class AogSight { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Hcog.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Hcog.cs index f28b8123..35c48147 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Hcog.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Hcog.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class Hcog { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/HoloReflexSight.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/HoloReflexSight.cs index 16f25c42..15fec03d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/HoloReflexSight.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/HoloReflexSight.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class HoloReflexSight { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ProScreen.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ProScreen.cs index d20b5725..e257f425 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ProScreen.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ProScreen.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class ProScreen { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScope.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScope.cs index 2074b2f3..9ac1afdc 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScope.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScope.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class SniperScope { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScopeX4.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScopeX4.cs index c3db7c4e..35fef9e3 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScopeX4.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/SniperScopeX4.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class SniperScopeX4 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Supressor.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Supressor.cs index ec7b7399..c80ec8b8 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Supressor.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/Supressor.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class Supressor { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScope.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScope.cs index b4c6c7ae..0678745d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScope.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScope.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class ThreatScope { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScopeSniper.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScopeSniper.cs index 89dd32a1..5af89355 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScopeSniper.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Attachment/ThreatScopeSniper.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment { class ThreatScopeSniper { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/ColdWar.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/ColdWar.cs index 8192e907..6c9bf19f 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/ColdWar.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/ColdWar.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier { class ColdWar { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/EPG.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/EPG.cs index 5ccbdc88..60eed970 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/EPG.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/EPG.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier { class EPG { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/SMR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/SMR.cs index 7ac6e1a6..697f55c1 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/SMR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/SMR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier { class SMR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/Softball.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/Softball.cs index 31f22153..76e6603e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/Softball.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Grenadier/Softball.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Grenadier { class Softball { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandL.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandL.cs index 79d2a7fb..f5caaf30 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandL.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandL.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.JackParts +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.JackParts { class JackHandL { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandR.cs index 9e4685d7..4ab36059 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/JackParts/JackHandR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.JackParts +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.JackParts { class JackHandR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Devotion.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Devotion.cs index 539b6522..cbf45def 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Devotion.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Devotion.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun { class Devotion { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/LSTAR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/LSTAR.cs index 664d2f1f..50b57dfe 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/LSTAR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/LSTAR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun { class LSTAR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Spitfire.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Spitfire.cs index 754271c6..3a15846e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Spitfire.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/LightMachineGun/Spitfire.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun { class Spitfire { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Kunai.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Kunai.cs index 5812ee16..57961a97 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Kunai.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Kunai.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Melee +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Melee { class Kunai { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Sword.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Sword.cs index 1ad9fc7a..059eedb9 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Sword.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Melee/Sword.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Melee +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Melee { class Sword { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Mozambique.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Mozambique.cs index a9aa7226..8ed5bdc7 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Mozambique.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Mozambique.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol { class Mozambique { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/P2016.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/P2016.cs index d0c564cc..76c89dce 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/P2016.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/P2016.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol { class P2016 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/RE45.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/RE45.cs index b0de9a17..843753b6 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/RE45.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/RE45.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol { class RE45 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/SmartPistol.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/SmartPistol.cs index d042885f..d2f9d34e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/SmartPistol.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/SmartPistol.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol { class SmartPistol { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Wingman.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Wingman.cs index 5ac5f084..3b1a7daf 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Wingman.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/Wingman.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol { class Wingman { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/WingmanElite.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/WingmanElite.cs index b3153108..7ca58748 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/WingmanElite.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Pistol/WingmanElite.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Pistol { class WingmanElite { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/EVA8.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/EVA8.cs index c094a3d9..936a5972 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/EVA8.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/EVA8.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Shotgun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Shotgun { class EVA8 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/Mastiff.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/Mastiff.cs index 04c088b0..9b34839b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/Mastiff.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Shotgun/Mastiff.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Shotgun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Shotgun { class Mastiff { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/DoubleTake.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/DoubleTake.cs index 3aef2a1c..d42452e0 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/DoubleTake.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/DoubleTake.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Sniper +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Sniper { class DoubleTake { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/Kraber.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/Kraber.cs index b0bdb6a2..e89ff1b0 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/Kraber.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/Kraber.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Sniper +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Sniper { class Kraber { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/LongbowDMR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/LongbowDMR.cs index 14bfbd16..d862fa5d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/LongbowDMR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Sniper/LongbowDMR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Sniper +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Sniper { class LongbowDMR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Alternator.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Alternator.cs index d0bdacb9..d9804940 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Alternator.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Alternator.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun { class Alternator { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/CAR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/CAR.cs index e22dab5d..b579d042 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/CAR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/CAR.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun { class CAR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/R97.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/R97.cs index 61111d54..fe652131 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/R97.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/R97.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun { class R97 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Volt.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Volt.cs index e8700db2..b4f7566e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Volt.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/SubmachineGun/Volt.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun { class Volt { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/BroadSword.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/BroadSword.cs index 4a99c38f..129a13b8 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/BroadSword.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/BroadSword.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class BroadSword { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/LeadWall.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/LeadWall.cs index d50dd1ba..34a981bc 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/LeadWall.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/LeadWall.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class LeadWall { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PlasmaRailgun.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PlasmaRailgun.cs index f7e5d61c..5d748133 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PlasmaRailgun.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PlasmaRailgun.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class PlasmaRailgun { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PredatorCannon.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PredatorCannon.cs index ed37d67b..a0248d56 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PredatorCannon.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PredatorCannon.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class PredatorCannon { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PrimeSword.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PrimeSword.cs index 19710d30..ec2fa23f 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PrimeSword.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/PrimeSword.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class PrimeSword { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/SplitterRifle.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/SplitterRifle.cs index 48141ef7..60484784 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/SplitterRifle.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/SplitterRifle.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class SplitterRifle { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/ThermiteLauncher.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/ThermiteLauncher.cs index eb614bbb..7c459261 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/ThermiteLauncher.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/ThermiteLauncher.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class ThermiteLauncher { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/TrackerCannon.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/TrackerCannon.cs index 00c926f1..7b4bbbf7 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/TrackerCannon.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/TrackerCannon.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class TrackerCannon { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/XO16.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/XO16.cs index d0b833d8..840cc852 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/XO16.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Default/Titan/XO16.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan +namespace VTOL.Titanfall2_Requisite.WeaponData.Default.Titan { class XO16 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Archer.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Archer.cs index 2b90eba8..f80d92c7 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Archer.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Archer.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan { class Archer { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/ChargeRifle.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/ChargeRifle.cs index 82526c9a..1e4569c4 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/ChargeRifle.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/ChargeRifle.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan { class ChargeRifle { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/MGL.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/MGL.cs index 94b3f1b9..541f93b2 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/MGL.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/MGL.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan { class MGL { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Thunderbolt.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Thunderbolt.cs index 28558167..3598908d 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Thunderbolt.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AntiTitan/Thunderbolt.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AntiTitan { class Thunderbolt { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/G2A5.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/G2A5.cs index 2793bee4..ed05fdb3 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/G2A5.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/G2A5.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle { class G2A5 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/HemlokBFR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/HemlokBFR.cs index 8c2493c3..fac7e7f7 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/HemlokBFR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/HemlokBFR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle { class Hemlock { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R101.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R101.cs index 9758152c..cb0c9ad2 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R101.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R101.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle { class R101 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R201.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R201.cs index 1780b579..fd38c429 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R201.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/R201.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle { class R201 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/V47Flatline.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/V47Flatline.cs index dab272f8..27208f77 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/V47Flatline.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/AssaultRifle/V47Flatline.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.AssaultRifle { class V47 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/ColdWar.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/ColdWar.cs index f0771237..6a9b1187 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/ColdWar.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/ColdWar.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier { class ColdWar { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/EPG.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/EPG.cs index ce5f2745..06325d57 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/EPG.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/EPG.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier { class EPG { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/SMR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/SMR.cs index 75c4d551..2a92f107 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/SMR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/SMR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier { class SMR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/Softball.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/Softball.cs index 2c618d2d..1498420e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/Softball.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Grenadier/Softball.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Grenadier { class Softball { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Devotion.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Devotion.cs index 586b3d1c..47c30426 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Devotion.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Devotion.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.LightMachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.LightMachineGun { class Devotion { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/LSTAR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/LSTAR.cs index 015cabed..21eec62e 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/LSTAR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/LSTAR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.LightMachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.LightMachineGun { class LSTAR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Spitfire.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Spitfire.cs index 1f11f7a2..d43f8fa2 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Spitfire.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/LightMachineGun/Spitfire.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.LightMachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.LightMachineGun { class Spitfire { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Mozambique.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Mozambique.cs index b34133cc..60b49276 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Mozambique.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Mozambique.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol { class Mozambique { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/P2016.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/P2016.cs index 4deddf8e..40cea3c7 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/P2016.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/P2016.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol { class P2016 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/RE45.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/RE45.cs index b1201539..16bb3b27 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/RE45.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/RE45.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol { class RE45 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/SmartPistol.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/SmartPistol.cs index d8b1b372..b39b15e4 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/SmartPistol.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/SmartPistol.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol { class SmartPistol { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Wingman.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Wingman.cs index 92f8761c..21c5eab4 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Wingman.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/Wingman.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol { class Wingman { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/WingmanElite.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/WingmanElite.cs index c94c0fcc..c2763380 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/WingmanElite.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Pistol/WingmanElite.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Pistol { class WingmanElite { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/EVA8.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/EVA8.cs index 2a5cef0b..9ff2e231 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/EVA8.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/EVA8.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Shotgun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Shotgun { class EVA8Auto { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/Mastiff.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/Mastiff.cs index cc8efc6c..188fd770 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/Mastiff.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Shotgun/Mastiff.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Shotgun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Shotgun { class Mastiff { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/DoubleTake.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/DoubleTake.cs index 1db47be2..e0641114 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/DoubleTake.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/DoubleTake.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Sniper +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Sniper { class DoubleTake { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/Kraber.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/Kraber.cs index 63c16806..a4acd3bd 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/Kraber.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/Kraber.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Sniper +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Sniper { class Kraber { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/LongbowDMR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/LongbowDMR.cs index 1ecd4958..eb462810 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/LongbowDMR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/Sniper/LongbowDMR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Sniper +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.Sniper { class LongbowDMR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Alternator.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Alternator.cs index 67c94ded..6892973b 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Alternator.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Alternator.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun { class Alternator { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/CAR.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/CAR.cs index 98bd2821..936d68c8 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/CAR.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/CAR.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun { class CAR { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/R97.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/R97.cs index 29e1732b..1d045cec 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/R97.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/R97.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun { class R97 { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Volt.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Volt.cs index 5f690d63..66ac9f80 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Volt.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/Skin31/SubmachineGun/Volt.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun +namespace VTOL.Titanfall2_Requisite.WeaponData.Skin31.SubmachineGun { class Volt { diff --git a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/WeaponDataControl.cs b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/WeaponDataControl.cs index b62c97d4..1d5f0754 100644 --- a/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/WeaponDataControl.cs +++ b/VTOL_2.0.0/Scripts/Titanfall2_Requisite/WeaponData/WeaponDataControl.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using VTOL.Titanfall2_Requisite.WeaponData.Default.SubmachineGun; using VTOL.Titanfall2_Requisite.WeaponData.Default.AntiTitan; using VTOL.Titanfall2_Requisite.WeaponData.Default.AssaultRifle; using VTOL.Titanfall2_Requisite.WeaponData.Default.Attachment; @@ -11,7 +6,6 @@ using VTOL.Titanfall2_Requisite.WeaponData.Default.JackParts; using VTOL.Titanfall2_Requisite.WeaponData.Default.LightMachineGun; using VTOL.Titanfall2_Requisite.WeaponData.Default.Titan; -using VTOL.Titanfall2_Requisite.WeaponData.Default; namespace VTOL.Titanfall2_Requisite.WeaponData { @@ -5274,7 +5268,7 @@ public WeaponDataControl(string WeaponName, int imagecheck) } else if (WeaponName.Contains("Skin31")) { - //Custom Skin Slots here. + //Custom Skin Slots here. } } } diff --git a/VTOL_2.0.0/Scripts/Updater.cs b/VTOL_2.0.0/Scripts/Updater.cs index 548f64ea..8e105be3 100644 --- a/VTOL_2.0.0/Scripts/Updater.cs +++ b/VTOL_2.0.0/Scripts/Updater.cs @@ -1,17 +1,11 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Net; using System.Reflection; //using System.Text.Json; using System.Threading.Tasks; -using System.Windows.Forms; -using Newtonsoft.Json; -using Windows.Web.Http; -using System.Windows.Documents; using VTOL._EventArgs; namespace VTOL @@ -167,7 +161,7 @@ public void GetRepository_Custom() using (StreamReader reader = new StreamReader(stream)) { - + json = reader.ReadToEnd(); } @@ -231,7 +225,7 @@ public async Task Download_Cutom_JSON(bool _call_from_file = false) Thunderstore = Thunderstore_V1.FromJson(json); } - + } else { @@ -257,7 +251,7 @@ public async Task Download_Cutom_JSON(bool _call_from_file = false) // File.Delete(AppDataFolder + @"\VTOL_DATA\VARS\Thunderstore.json"); //} } - + @@ -297,7 +291,7 @@ public async Task CheckForUpdateAsync() if (currentVersion < newestVersion) { - UpdateAvailable?.Invoke(this, new VersionEventArgs(newestVersion, currentVersion)); + UpdateAvailable?.Invoke(this, new VersionEventArgs(newestVersion, currentVersion)); State = UpdaterState.Idle; return true; } @@ -334,36 +328,37 @@ public bool CheckForUpdate(bool custom = false) } - try { - if (custom == true) + try { + if (custom == true) + { - if (currentVersion < newestVersion && (Convert.ToInt32(currentVersion.ToString().Replace(".", "")) < Convert.ToInt32(newestVersion.ToString().Replace(".", "")))) - { + if (currentVersion < newestVersion && (Convert.ToInt32(currentVersion.ToString().Replace(".", "")) < Convert.ToInt32(newestVersion.ToString().Replace(".", "")))) + { - UpdateAvailable?.Invoke(this, new VersionEventArgs(newestVersion, currentVersion)); - State = UpdaterState.Idle; - return true; + UpdateAvailable?.Invoke(this, new VersionEventArgs(newestVersion, currentVersion)); + State = UpdaterState.Idle; + return true; + } } - } - else - { - if (currentVersion < newestVersion) + else { + if (currentVersion < newestVersion) + { - UpdateAvailable?.Invoke(this, new VersionEventArgs(newestVersion, currentVersion)); - State = UpdaterState.Idle; - return true; - } + UpdateAvailable?.Invoke(this, new VersionEventArgs(newestVersion, currentVersion)); + State = UpdaterState.Idle; + return true; + } + } } - } - catch (Exception ex) + catch (Exception ex) { - return false; + return false; } - State = UpdaterState.Idle; + State = UpdaterState.Idle; return false; } diff --git a/VTOL_2.0.0/Scripts/UpdaterState.cs b/VTOL_2.0.0/Scripts/UpdaterState.cs index 426e9a77..7d50018a 100644 --- a/VTOL_2.0.0/Scripts/UpdaterState.cs +++ b/VTOL_2.0.0/Scripts/UpdaterState.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace VTOL +namespace VTOL { public enum UpdaterState { diff --git a/VTOL_2.0.0/Scripts/User_Settings.cs b/VTOL_2.0.0/Scripts/User_Settings.cs index 0ccbb78e..43c5d2f8 100644 --- a/VTOL_2.0.0/Scripts/User_Settings.cs +++ b/VTOL_2.0.0/Scripts/User_Settings.cs @@ -1,10 +1,6 @@ namespace VTOL { - using System; - using System.Collections.Generic; - using System.Globalization; using Newtonsoft.Json; - using Newtonsoft.Json.Converters; public partial class User_Settings { diff --git a/VTOL_2.0.0/Scripts/VersionEventArgs.cs b/VTOL_2.0.0/Scripts/VersionEventArgs.cs index b6a327bb..81679a4b 100644 --- a/VTOL_2.0.0/Scripts/VersionEventArgs.cs +++ b/VTOL_2.0.0/Scripts/VersionEventArgs.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace VTOL { diff --git a/VTOL_2.0.0/Scripts/WindowBlur.cs b/VTOL_2.0.0/Scripts/WindowBlur.cs index c04ae3a2..83bf41f2 100644 --- a/VTOL_2.0.0/Scripts/WindowBlur.cs +++ b/VTOL_2.0.0/Scripts/WindowBlur.cs @@ -3,7 +3,6 @@ using System.Windows; using System.Windows.Interop; using VTOL.Native; -using Walterlv.Windows.Interop; namespace VTOL { @@ -20,7 +19,7 @@ public static void SetIsEnabled(DependencyObject element, bool value) public static bool GetIsEnabled(DependencyObject element) { - return (bool) element.GetValue(IsEnabledProperty); + return (bool)element.GetValue(IsEnabledProperty); } private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) @@ -52,7 +51,7 @@ public static void SetWindowBlur(DependencyObject element, WindowBlur value) public static WindowBlur GetWindowBlur(DependencyObject element) { - return (WindowBlur) element.GetValue(WindowBlurProperty); + return (WindowBlur)element.GetValue(WindowBlurProperty); } private static void OnWindowBlurChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) @@ -69,7 +68,7 @@ private static void OnWindowBlurChanged(DependencyObject d, DependencyPropertyCh private void Attach(Window window) { _window = window; - var source = (HwndSource) PresentationSource.FromVisual(window); + var source = (HwndSource)PresentationSource.FromVisual(window); if (source == null) { window.SourceInitialized += OnSourceInitialized; @@ -94,7 +93,7 @@ private void Detach() private void OnSourceInitialized(object sender, EventArgs e) { - ((Window) sender).SourceInitialized -= OnSourceInitialized; + ((Window)sender).SourceInitialized -= OnSourceInitialized; AttachCore(); } diff --git a/VTOL_2.0.0/Scripts/_EventArgs/DownloadProgressEventArgs.cs b/VTOL_2.0.0/Scripts/_EventArgs/DownloadProgressEventArgs.cs index 2e169e50..9a9599bb 100644 --- a/VTOL_2.0.0/Scripts/_EventArgs/DownloadProgressEventArgs.cs +++ b/VTOL_2.0.0/Scripts/_EventArgs/DownloadProgressEventArgs.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace VTOL._EventArgs { diff --git a/VTOL_2.0.0/Scripts/_EventArgs/ExceptionEventArgs.cs b/VTOL_2.0.0/Scripts/_EventArgs/ExceptionEventArgs.cs index 00375df8..81b1639a 100644 --- a/VTOL_2.0.0/Scripts/_EventArgs/ExceptionEventArgs.cs +++ b/VTOL_2.0.0/Scripts/_EventArgs/ExceptionEventArgs.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; namespace VTOL._EventArgs {