diff --git a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings.Designer.cs b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings.Designer.cs index 99e2e251..856ef2b5 100644 --- a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings.Designer.cs +++ b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings.Designer.cs @@ -122,6 +122,7 @@ private void InitializeComponent() this.Button_Change_Game_Path = new System.Windows.Forms.Button(); this.Label_Game_Files = new System.Windows.Forms.Label(); this.TabPage_Game_Verify_Hash = new System.Windows.Forms.TabPage(); + this.VerifyHashWelcome = new System.Windows.Forms.Label(); this.CheckBox_Verify_Scan_Scripts = new System.Windows.Forms.CheckBox(); this.GroupBox_Verify_Scan = new System.Windows.Forms.GroupBox(); this.TextBox_Verify_Scan = new System.Windows.Forms.TextBox(); @@ -192,7 +193,6 @@ private void InitializeComponent() this.Button_Settings = new System.Windows.Forms.PictureBox(); this.Button_Close = new System.Windows.Forms.PictureBox(); this.Clock = new System.Windows.Forms.Timer(this.components); - this.VerifyHashWelcome = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).BeginInit(); this.TabControl_Shared_Hub.SuspendLayout(); this.TabPage_Setup.SuspendLayout(); @@ -1365,6 +1365,21 @@ private void InitializeComponent() this.TabPage_Game_Verify_Hash.Text = "Verify Hash"; this.TabPage_Game_Verify_Hash.UseVisualStyleBackColor = true; // + // VerifyHashWelcome + // + this.VerifyHashWelcome.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.VerifyHashWelcome.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.VerifyHashWelcome.Font = new System.Drawing.Font("DejaVu Sans", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.VerifyHashWelcome.ImageAlign = System.Drawing.ContentAlignment.TopCenter; + this.VerifyHashWelcome.Location = new System.Drawing.Point(434, 13); + this.VerifyHashWelcome.Name = "VerifyHashWelcome"; + this.VerifyHashWelcome.Size = new System.Drawing.Size(384, 101); + this.VerifyHashWelcome.TabIndex = 227; + this.VerifyHashWelcome.Text = "Welcome!\r\n\r\nThe scanning process is pretty quick,\r\nbut may still take a while.\r\nD" + + "epending on your connection,\r\nre-downloading will take the longest.\r\nPlease allo" + + "w it to complete fully!"; + this.VerifyHashWelcome.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // // CheckBox_Verify_Scan_Scripts // this.CheckBox_Verify_Scan_Scripts.BackColor = System.Drawing.Color.Transparent; @@ -1428,7 +1443,7 @@ private void InitializeComponent() this.Button_Verify_Scan.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(200)))), ((int)(((byte)(0))))); this.Button_Verify_Scan.Location = new System.Drawing.Point(13, 13); this.Button_Verify_Scan.Name = "Button_Verify_Scan"; - this.Button_Verify_Scan.Size = new System.Drawing.Size(91, 24); + this.Button_Verify_Scan.Size = new System.Drawing.Size(222, 24); this.Button_Verify_Scan.TabIndex = 13; this.Button_Verify_Scan.Text = "Stop Scan"; this.Button_Verify_Scan.UseVisualStyleBackColor = true; @@ -2287,21 +2302,6 @@ private void InitializeComponent() this.Clock.Enabled = true; this.Clock.Interval = 1200; // - // VerifyHashWelcome - // - this.VerifyHashWelcome.Anchor = System.Windows.Forms.AnchorStyles.Top; - this.VerifyHashWelcome.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.VerifyHashWelcome.Font = new System.Drawing.Font("DejaVu Sans", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.VerifyHashWelcome.ImageAlign = System.Drawing.ContentAlignment.TopCenter; - this.VerifyHashWelcome.Location = new System.Drawing.Point(434, 13); - this.VerifyHashWelcome.Name = "VerifyHashWelcome"; - this.VerifyHashWelcome.Size = new System.Drawing.Size(384, 101); - this.VerifyHashWelcome.TabIndex = 227; - this.VerifyHashWelcome.Text = "Welcome!\r\n\r\nThe scanning process is pretty quick,\r\nbut may still take a while.\r\nD" + - "epending on your connection,\r\nre-downloading will take the longest.\r\nPlease allo" + - "w it to complete fully!"; - this.VerifyHashWelcome.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // // Screen_Settings // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Events.cs b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Events.cs index c69aa0e0..6c0bcbe9 100644 --- a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Events.cs +++ b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Events.cs @@ -109,7 +109,7 @@ private void Button_Game_Verify_Files_Click(object sender, EventArgs e) { if (FunctionStatus.IsVerifyHashDisabled) { - ButtonsColorSet(Button_Game_Verify_Files, 3, true); + ButtonsColorSet(Button_Verify_Scan, 3, true); if (!File.Exists(Path.Combine(Save_Settings.Live_Data.Game_Path, "nfsw.exe"))) { MessageBox.Show(null, "You need to Download the Game Files first before you can have access to run Verify Hash", @@ -123,13 +123,13 @@ private void Button_Game_Verify_Files_Click(object sender, EventArgs e) } else if (!FunctionStatus.DoesCDNSupportVerifyHash) { - ButtonsColorSet(Button_Game_Verify_Files, 3, true); + ButtonsColorSet(Button_Verify_Scan, 3, true); MessageBox.Show(null, "The current saved CDN does not support 'Verify GameFiles' Scan" + "\nPlease Choose Another CDN from the list", "GameLauncher", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { - ButtonsColorSet(Button_Game_Verify_Files, (Save_Settings.Live_Data.Game_Integrity != "Good") ? 2 : 0, true); + ButtonsColorSet(Button_Verify_Scan, (Save_Settings.Live_Data.Game_Integrity != "Good") ? 2 : 0, true); Screen_Verify_Hash.OpenScreen(); } } @@ -203,7 +203,7 @@ private async void SettingsSave_Click(object sender, EventArgs e) Save_Settings.Live_Data.Launcher_CDN = New_Choosen_CDN; Label_CDN_Current.Text = "CHANGED CDN:"; CDN_Changed_Button_Update = Stop_and_Restart_Downloader = RestartRequired = true; - ButtonsColorSet(Button_Game_Verify_Files, 0, false); + ButtonsColorSet(Button_Verify_Scan, 0, false); } if (TabControl_Shared_Hub.SelectedTab.Equals(TabPage_Settings)) @@ -379,14 +379,14 @@ await Task.Run(() => if (Screen_Instance != null) { FunctionStatus.DoesCDNSupportVerifyHash = true; - ButtonsColorSet(Button_Game_Verify_Files, (Save_Settings.Live_Data.Game_Integrity != "Good" ? 2 : 0), true); + ButtonsColorSet(Button_Verify_Scan, (Save_Settings.Live_Data.Game_Integrity != "Good" ? 2 : 0), true); } break; default: if (Screen_Instance != null) { FunctionStatus.DoesCDNSupportVerifyHash = false; - ButtonsColorSet(Button_Game_Verify_Files, 3, true); + ButtonsColorSet(Button_Verify_Scan, 3, true); } break; } @@ -1007,11 +1007,11 @@ await Task.Run(() => if (BuildDevelopment.Allowed()) { FunctionStatus.DoesCDNSupportVerifyHash = true; - ButtonsColorSet(Button_Game_Verify_Files, 4, true); + ButtonsColorSet(Button_Verify_Scan, 4, true); } else { - ButtonsColorSet(Button_Game_Verify_Files, 0, false); + ButtonsColorSet(Button_Verify_Scan, 0, false); await Task.Run(() => { if (!Application.OpenForms[this.Name].IsDisposed) @@ -1022,11 +1022,11 @@ await Task.Run(() => { case APIStatus.Online: FunctionStatus.DoesCDNSupportVerifyHash = true; - ButtonsColorSet(Button_Game_Verify_Files, (Save_Settings.Live_Data.Game_Integrity != "Good") ? 2 : 0, true); + ButtonsColorSet(Button_Verify_Scan, (Save_Settings.Live_Data.Game_Integrity != "Good") ? 2 : 0, true); break; default: FunctionStatus.DoesCDNSupportVerifyHash = false; - ButtonsColorSet(Button_Game_Verify_Files, 3, true); + ButtonsColorSet(Button_Verify_Scan, 3, true); break; } } diff --git a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash.cs b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash.cs deleted file mode 100644 index 9d085a25..00000000 --- a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash.cs +++ /dev/null @@ -1,49 +0,0 @@ -using SBRW.Launcher.Core.Reference.Json_.Newtonsoft_; -using SBRW.Launcher.RunTime.LauncherCore.Lists.JSON; -using System.Collections.Generic; -using System.ComponentModel; - -namespace SBRW.Launcher.App.UI_Forms.Settings_Screen -{ - partial class Screen_Settings - { - public static BackgroundWorker? Verify_Hash { get; set; } - /* VerifyHash */ - public int Files_Total { get; set; } - public int Files_Scanned_Total { get; set; } - public int Files_Invaild_Total { get; set; } - public int Files_Downloaded_Total { get; set; } - public int Files_Download_Error_Total { get; set; } - public int Files_Deletion_Error_Total { get; set; } - public string Verify_CDN_URL { get; set; } = string.Empty; - public bool File_Downloading { get; set; } - public Raw_Download_Progress Verify_Hash_Status { get; set; } = Raw_Download_Progress.Idle; - /// - /// - /// - public static bool Skip_Scripts_Folder { get; set; } - public static List Generated_Scanned_List { get; set; } = new List(); - public static List Generated_Scanned_Invalid_List { get; set; } = new List(); - public string[] File_Checksum { get; set; } = { }; - } - /// - /// - /// - public enum Raw_Download_Progress - { - Idle = -1, - Scanning = 0, - Removing = 1, - Checksums_File = 2, - Checksums_File_Found = 2, - Checksums_File_Error = 2, - Checksums_Not_Available, - Verifying = 3, - Invaild = 4, - Downloading = 5, - Stopped = 6, - Complete = 7, - Passed = 8, - Error = 9 - } -} diff --git a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash_Events.cs b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash_Events.cs deleted file mode 100644 index 8976f4c9..00000000 --- a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash_Events.cs +++ /dev/null @@ -1,201 +0,0 @@ -using SBRW.Launcher.Core.Discord.RPC_; -using SBRW.Launcher.Core.Extension.Logging_; -using SBRW.Launcher.Core.Extra.File_.Save_; -using SBRW.Launcher.Core.Theme; -using SBRW.Launcher.RunTime.LauncherCore.Global; -using SBRW.Launcher.RunTime.LauncherCore.Support; -using System; -using System.ComponentModel; -using System.IO; - -namespace SBRW.Launcher.App.UI_Forms.Settings_Screen -{ - partial class Screen_Settings - { - /// - /// - /// - /// - /// - private void VerifyHash_Load(object sender, EventArgs e) - { - Log.Core("VERIFY HASH: Opened"); - - if (!FunctionStatus.IsVerifyHashDisabled) - { - Log_Verify.Start(); - - /* Clean up previous logs and start logging */ - string[] filestocheck = new string[] { "checksums.dat", "validfiles.dat", "invalidfiles.dat", "Verify.log" }; - foreach (String file in filestocheck) - { - if (File.Exists(file)) - { - try { File.Delete(file); } - catch (Exception Error) - { - DeletionError++; - Log_Verify.Error("File: " + file + " Error: " + Error.Message); - Log_Verify.ErrorIC("File: " + file + " Error: " + Error.HResult); - Log_Verify.ErrorFR("File: " + file + " Error: " + Error.ToString()); - } - } - } - - Log_Verify.Info("VERIFYHASH: Checking Characters in URL"); - if (Save_Settings.Live_Data.Launcher_CDN.EndsWith("/")) - { - char[] charsToTrim = { '/' }; - FinalCDNURL = Save_Settings.Live_Data.Launcher_CDN.TrimEnd(charsToTrim); - Log_Verify.Info("VERIFYHASH: Trimed end of CDN URL -> " + FinalCDNURL); - } - else - { - FinalCDNURL = Save_Settings.Live_Data.Launcher_CDN; - Log_Verify.Info("VERIFYHASH: Choosen CDN URL -> " + FinalCDNURL); - } - } - else - { - StartScanner.Enabled = false; - } - } - /// - /// - /// - /// - /// - private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) - { - StillDownloading = false; - - if (e.Error != null) - { - RedownloadErrorCount++; - Log_Verify.Downloaded("File: " + CurrentDownloadingFile); - Presence_Launcher.Status(26, RedownloadedCount + RedownloadErrorCount + " out of " + CurrentCount); - - DownloadProgressText.SafeInvokeAction(() => - DownloadProgressText.Text = "Failed To Download File [ " + - RedownloadedCount + RedownloadErrorCount + " / " + CurrentCount + " ]:" + "\n" + CurrentDownloadingFile); - - DownloadProgressBar.SafeInvokeAction(() => DownloadProgressBar.Value = RedownloadedCount + RedownloadErrorCount * 100 / CurrentCount); - - Log_Verify.Error("Download for [" + CurrentDownloadingFile + "] - " + - (e.Error != null ? (string.IsNullOrWhiteSpace(e.Error.Message) ? e.Error.ToString() : e.Error.Message) : "No Exception Error Provided")); - - if (RedownloadedCount + RedownloadErrorCount == CurrentCount) - { - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - Button_Verify_Scan.SafeInvokeAction(() => Button_Verify_Scan.Visible = false); - - DownloadProgressText.SafeInvokeAction(() => - DownloadProgressText.Text = "\n" + RedownloadedCount + " Invalid/Missing File(s) were Redownloaded"); - - VerifyHashText.SafeInvokeAction(() => - { - VerifyHashText.ForeColor = Color_Winform.Warning_Text_Fore_Color; - VerifyHashText.Text = RedownloadErrorCount + " Files Failed to Download. Check Log for Details"; - }, this); - - DownloadErrorEncountered = true; - GameScanner(false); - } - } - else if (IsVerifyHashOpen && !ForceStopScan) - { - RedownloadedCount++; - - Presence_Launcher.Status(26, RedownloadedCount + " out of " + CurrentCount); - Log_Verify.Downloaded("File: " + CurrentDownloadingFile); - - DownloadProgressText.SafeInvokeAction(() => - DownloadProgressText.Text = "Downloaded File [ " + RedownloadedCount + " / " + CurrentCount + " ]:\n" + CurrentDownloadingFile); - DownloadProgressBar.SafeInvokeAction(() => DownloadProgressBar.Value = RedownloadedCount * 100 / CurrentCount); - - if (RedownloadedCount == CurrentCount) - { - Integrity(); - Log.Info("VERIFY HASH: Re-downloaded Count: " + RedownloadedCount + " Current File Count: " + CurrentCount); - DownloadProgressText.SafeInvokeAction(() => DownloadProgressText.Text = "\n" + RedownloadedCount + " Invalid/Missing File(s) were downloaded"); - - VerifyHashText.SafeInvokeAction(() => - { - VerifyHashText.ForeColor = Color_Winform.Warning_Text_Fore_Color; - VerifyHashText.Text = "Yay! Scanning and Downloading\n is now completed on Gamefiles"; - }, this); - - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - Button_Verify_Scan.SafeInvokeAction(() => Button_Verify_Scan.Visible = false); - - GameScanner(false); - } - else if (RedownloadedCount + RedownloadErrorCount == CurrentCount) - { - DownloadProgressText.SafeInvokeAction(() => DownloadProgressText.Text = "\n" + RedownloadedCount + " Invalid/Missing File(s) were downloaded"); - - VerifyHashText.SafeInvokeAction(() => - { - VerifyHashText.ForeColor = Color_Winform.Warning_Text_Fore_Color; - VerifyHashText.Text = RedownloadErrorCount + " Files Failed to Download. Check Log for Details"; - }, this); - - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - Button_Verify_Scan.SafeInvokeAction(() => Button_Verify_Scan.Visible = false); - - DownloadErrorEncountered = true; - GameScanner(false); - } - } - else if (IsVerifyHashOpen && ForceStopScan) - { - Log.Info("VERIFY HASH: Download Process has Stopped"); - Presence_Launcher.Status(26, RedownloadedCount + " out of " + CurrentCount); - - DownloadProgressText.SafeInvokeAction(() => - DownloadProgressText.Text = "Download Stopped on File [ " + - RedownloadedCount + " / " + CurrentCount + " ]:" + "\n" + CurrentDownloadingFile); - - DownloadProgressBar.SafeInvokeAction(() => DownloadProgressBar.Value = RedownloadedCount * 100 / CurrentCount); - - Log_Verify.Error("Download for [" + CurrentDownloadingFile + "] - has been Cancelled"); - - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - Button_Verify_Scan.SafeInvokeAction(() => Button_Verify_Scan.Visible = false); - VerifyHashText.SafeInvokeAction(() => - { - VerifyHashText.Text = "Verify Hash Download Process has been Terminated"; - }, this); - } - else if (ForceStopScan) - { - Log.Info("VERIFY HASH: Download Process has Stopped"); - Log_Verify.Error("Download for [" + CurrentDownloadingFile + "] - has been Cancelled"); - } - } - /// - /// - /// - /// - /// - private void StartScanner_Click(object sender, EventArgs e) - { - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - Button_Verify_Scan.SafeInvokeAction(() => Button_Verify_Scan.Visible = true); - - GameScanner(true); - } - /// - /// - /// - /// - /// - private void StopScanner_Click(object? sender, EventArgs? e) - { - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - Button_Verify_Scan.SafeInvokeAction(() => Button_Verify_Scan.Visible = false); - - GameScanner(false); - } - } -} diff --git a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash_Functions.cs b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash_Functions.cs deleted file mode 100644 index af734b76..00000000 --- a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Verify_Hash/Verify_Hash_Functions.cs +++ /dev/null @@ -1,610 +0,0 @@ -using SBRW.Launcher.Core.Discord.RPC_; -using SBRW.Launcher.Core.Extension.Logging_; -using SBRW.Launcher.RunTime.LauncherCore.Global; -using SBRW.Launcher.RunTime.LauncherCore.Support; -using System; -using System.IO; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using SBRW.Launcher.Core.Extra.File_.Save_; -using SBRW.Launcher.RunTime.LauncherCore.ModNet; -using SBRW.Launcher.RunTime.LauncherCore.Logger; -using System.Net; -using System.Net.Cache; -using SBRW.Launcher.Core.Cache; -using SBRW.Launcher.Core.Extension.Hash_; -using SBRW.Launcher.App.UI_Forms.Main_Screen; -using SBRW.Launcher.RunTime.LauncherCore.Visuals; -using SBRW.Launcher.Core.Extension.Web_; -using System.ComponentModel; -using SBRW.Launcher.Core.Reference.Json_.Newtonsoft_; -using SBRW.Launcher.RunTime.LauncherCore.Lists.JSON; -using System.Net.Http; - -namespace SBRW.Launcher.App.UI_Forms.Settings_Screen -{ - partial class Screen_Settings - { - public BackgroundWorker Start() - { - BackgroundWorker Creator = new BackgroundWorker() - { - WorkerReportsProgress = true, - WorkerSupportsCancellation = true - }; - Creator.DoWork += Start_File_Scan; - Creator.RunWorkerCompleted += Start_File_Scan_Completed; - - return Creator; - } - /// - /// - /// - /// TODO: UPDATE TEXT FOR TRANSLATIONS - private void Start_File_Scan(object _, DoWorkEventArgs Live_Events) - { - if (!string.IsNullOrWhiteSpace(Save_Settings.Live_Data.Game_Path)) - { - Verify_Hash_Status = Raw_Download_Progress.Scanning; - Presence_Launcher.Status(25); - Log.Info("VERIFY HASH: Checking and Deleting '.orig' Files and Symbolic Folders"); - //Label_Verify_Scan.SafeInvokeAction(() => Label_Verify_Scan.Text = "Removing any '.orig' Files in Game Directory"); - - DirectoryInfo Game_Files_Directory = new DirectoryInfo(Save_Settings.Live_Data.Game_Path); - /* */ - if (Game_Files_Directory.Exists) - { - /* */ - foreach (FileInfo Matched_File in Game_Files_Directory.EnumerateFiles("*.orig", SearchOption.AllDirectories)) - { - if (!Live_Events.Cancel) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { File_Info = Matched_File }); - } - else - { - break; - } - } - /* */ - foreach (DirectoryInfo Found_Directory in Game_Files_Directory.EnumerateDirectories()) - { - if (!Live_Events.Cancel) - { - if (ModNetHandler.IsSymbolic(Found_Directory.FullName)) - { - if (Directory.Exists(Found_Directory.FullName)) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { Directory_Info = Found_Directory }); - } - else if (File.Exists(Found_Directory.FullName)) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { File_System_Info = Found_Directory }); - } - } - } - else - { - break; - } - } - /* */ - foreach (DirectoryInfo Found_Directory in Game_Files_Directory.GetDirectories()) - { - if (!Live_Events.Cancel) - { - foreach (FileInfo Matched_File in Found_Directory.EnumerateFiles("*.orig", SearchOption.AllDirectories)) - { - if (!Live_Events.Cancel) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { File_Info = Matched_File }); - } - else - { - break; - } - } - /* */ - foreach (DirectoryInfo Found_Directories in Found_Directory.EnumerateDirectories()) - { - if (!Live_Events.Cancel) - { - if (ModNetHandler.IsSymbolic(Found_Directories.FullName)) - { - if (Directory.Exists(Found_Directories.FullName)) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { Directory_Info = Found_Directories }); - } - else if (File.Exists(Found_Directories.FullName)) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { File_System_Info = Found_Directories }); - } - } - } - else - { - break; - } - } - } - else - { - break; - } - } - /* */ - DirectoryInfo Scripts_Folder = new DirectoryInfo(Path.Combine(Save_Settings.Live_Data.Game_Path, "scripts")); - /* */ - if (Scripts_Folder.Exists) - { - foreach (FileInfo Scripts_files in Scripts_Folder.GetFiles()) - { - if (!Live_Events.Cancel) - { - Generated_Scanned_List.Add(new Json_List_Scanned_Game_Files() { File_Info = Scripts_files, Skip = Skip_Scripts_Folder }); - } - else - { - break; - } - } - } - } - } - } - /// - /// - /// - /// - /// - private void Start_File_Scan_Completed(object _, RunWorkerCompletedEventArgs Live_Events) - { - if (!Live_Events.Cancelled) - { - Verify_Hash_Status = Raw_Download_Progress.Removing; - } - } - /// - /// - /// - private void Start_Removal(object _, DoWorkEventArgs Live_Events) - { - if (!Live_Events.Cancel) - { - Verify_Hash_Status = Raw_Download_Progress.Removing; - foreach (Json_List_Scanned_Game_Files Bad_File_OR_Folder in Generated_Scanned_List) - { - if (Bad_File_OR_Folder != default) - { - if (!Bad_File_OR_Folder.Skip) - { - /* FileSystemInfo can be either a File or Directory, so do two Checks to ensure we know what it is */ - if (Bad_File_OR_Folder.File_System_Info != default) - { - try - { - if (Directory.Exists(Bad_File_OR_Folder.File_System_Info.FullName)) - { - Directory.Delete(Bad_File_OR_Folder.File_System_Info.FullName, true); - Log_Verify.Deleted("Folder - [FSI]: " + Bad_File_OR_Folder.File_System_Info.Name); - } - else if (File.Exists(Bad_File_OR_Folder.File_System_Info.FullName)) - { - File.Delete(Bad_File_OR_Folder.File_System_Info.FullName); - Log_Verify.Deleted("File - [FSI]: " + Bad_File_OR_Folder.File_System_Info.Name); - } - } - catch (Exception Error) - { - Files_Deletion_Error_Total++; - Log_Verify.Error("FSI: " + Bad_File_OR_Folder.File_System_Info.Name + " Error: " + Error.Message); - Log_Verify.ErrorIC("FSI: " + Bad_File_OR_Folder.File_System_Info.Name + " Error: " + Error.HResult); - Log_Verify.ErrorFR("FSI: " + Bad_File_OR_Folder.File_System_Info.Name + " Error: " + Error.ToString()); - } - } - /* Detected as a File */ - if (Bad_File_OR_Folder.File_Info != default) - { - try - { - if (File.Exists(Bad_File_OR_Folder.File_Info.FullName)) - { - Bad_File_OR_Folder.File_Info.Delete(); - Log_Verify.Deleted("File: " + Bad_File_OR_Folder.File_Info.Name); - } - } - catch (Exception Error) - { - Files_Deletion_Error_Total++; - Log_Verify.Error("File: " + Bad_File_OR_Folder.File_Info.Name + " Error: " + Error.Message); - Log_Verify.ErrorIC("File: " + Bad_File_OR_Folder.File_Info.Name + " Error: " + Error.HResult); - Log_Verify.ErrorFR("File: " + Bad_File_OR_Folder.File_Info.Name + " Error: " + Error.ToString()); - } - } - /* Detected as a Directory */ - if (Bad_File_OR_Folder.Directory_Info != default) - { - try - { - if (Directory.Exists(Bad_File_OR_Folder.Directory_Info.FullName)) - { - Directory.Delete(Bad_File_OR_Folder.Directory_Info.FullName, true); - Log_Verify.Deleted("Folder: " + Bad_File_OR_Folder.Directory_Info.Name); - } - } - catch (Exception Error) - { - Files_Deletion_Error_Total++; - Log_Verify.Error("Folder: " + Bad_File_OR_Folder.Directory_Info.Name + " Error: " + Error.Message); - Log_Verify.ErrorIC("Folder: " + Bad_File_OR_Folder.Directory_Info.Name + " Error: " + Error.HResult); - Log_Verify.ErrorFR("Folder: " + Bad_File_OR_Folder.Directory_Info.Name + " Error: " + Error.ToString()); - } - } - } - - Generated_Scanned_List.Remove(Bad_File_OR_Folder); - } - } - } - } - /// - /// - /// - /// - /// - private void Start_Removal_Completed(object _, RunWorkerCompletedEventArgs Live_Events) - { - if (!Live_Events.Cancelled) - { - Verify_Hash_Status = Raw_Download_Progress.Checksums_File; - } - else - { - Verify_Hash_Status = Raw_Download_Progress.Stopped; - } - } - private void Start_Checksums_Download(object _, DoWorkEventArgs Live_Events) - { - if (!Live_Events.Cancel) - { - bool CheckSums_File_Found = "checksums.dat".Hash_SHA() == "80D272597981DABA49F5022BBF36FF302FC9D13E"; - - if (CheckSums_File_Found) - { - Verify_Hash_Status = Raw_Download_Progress.Checksums_File_Found; - /* Read Local checksums.dat */ - File_Checksum = File.ReadAllLines("checksums.dat"); - } - else - { - /* Fetch and Read Remote checksums.dat */ - //Label_Verify_Scan.SafeInvokeAction(() => Label_Verify_Scan.Text = "Downloading Checksums File"); - - Uri URLCall = new Uri(Verify_CDN_URL + "/unpacked/checksums.dat"); - ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = (int)TimeSpan.FromSeconds(Launcher_Value.Launcher_WebCall_Timeout_Enable ? - Launcher_Value.Launcher_WebCall_Timeout() : 60).TotalMilliseconds; - var Client = new WebClient - { - Encoding = Encoding.UTF8, - CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore) - }; - if (!Launcher_Value.Launcher_Alternative_Webcalls()) - { - Client = new WebClientWithTimeout { Encoding = Encoding.UTF8, CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore) }; - } - else - { - Client.Headers.Add("user-agent", "SBRW Launcher " + - Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)"); - } - - bool ErrorFree = true; - - try - { - File_Checksum = Client.DownloadString(URLCall).Split('\n'); - } - catch (Exception Error) - { - LogToFileAddons.OpenLog("VERIFY HASH CHECKSUMS", "Downloading of the Checksums File has Encountered an Error", Error, "Error", false); - ErrorFree = false; - } - finally - { - Client?.Dispose(); - } - - if (ErrorFree) - { - File.WriteAllLines("checksums.dat", File_Checksum); - } - else - { - Verify_Hash_Status = Raw_Download_Progress.Checksums_File_Error; - } - } - - if (CheckSums_File_Found) - { - /* We need to Verify that the CDN Supports Verify or Raw Download - DavidCarbon */ - using (HttpClient Alpha_Client = new HttpClient()) - { - try - { - Alpha_Client.Timeout = TimeSpan.FromSeconds(30); - HttpRequestMessage Client_Request = new HttpRequestMessage(HttpMethod.Head, Verify_CDN_URL + "/unpacked/checksums.dat"); - HttpResponseMessage Client_Response = Alpha_Client.SendAsync(Client_Request).GetAwaiter().GetResult(); - Verify_Hash_Status = Client_Response.IsSuccessStatusCode ? Raw_Download_Progress.Verifying : Raw_Download_Progress.Checksums_Not_Available; - } - catch - { - Verify_Hash_Status = Raw_Download_Progress.Checksums_Not_Available; - } - } - } - } - } - private void Start_Checksums_Completed(object _, RunWorkerCompletedEventArgs Live_Events) - { - if (!Live_Events.Cancelled) - { - Stage_Process = 3; - } - } - /// - /// - /// - /// - /// - private void Start_File_Download(object _, DoWorkEventArgs Live_Events) - { - if (!Live_Events.Cancel) - { - Presence_Launcher.Status(26); - /* START Show Redownloader Progress - StartScanner.SafeInvokeAction(() => StartScanner.Visible = false); - StopScanner.SafeInvokeAction(() => StopScanner.Visible = true); - - - if (!Screen_Instance.DisposedForm()) - { - Screen_Instance.Label_Verify_Scan.Text = "Currently (re)downloading files. This part may take awhile depending on your connection."; - }*/ - - if (Generated_Scanned_Invalid_List.Any()) - { - //DownloadProgressText.SafeInvokeAction(() => DownloadProgressText.Text = "\nPreparing to Download Files"); - - Files_Total = Generated_Scanned_Invalid_List.Count; - - foreach (Json_List_Invalid_Game_Files Found_File_Invaild in Generated_Scanned_Invalid_List) - { - if (!Live_Events.Cancel) - { - try - { - while (File_Downloading) - { - if (Live_Events.Cancel) - { - break; - } - } - - if (!Live_Events.Cancel) - { - Uri URLCall = new Uri(Found_File_Invaild.Download_Url); - int Timeout = (int)TimeSpan.FromMinutes(5).TotalMilliseconds; - - if (Found_File_Invaild.Download_Url.Contains("copspeechdat")) - { - Timeout = (int)TimeSpan.FromMinutes(30).TotalMilliseconds; - } - else if (Found_File_Invaild.Download_Url.Contains("nfs09mx.mus")) - { - Timeout = (int)TimeSpan.FromMinutes(15).TotalMilliseconds; - } - - ServicePointManager.FindServicePoint(URLCall).ConnectionLeaseTimeout = Timeout; - - var Client = new WebClient() - { - Encoding = Encoding.UTF8, - CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore) - }; - if (!Launcher_Value.Launcher_Alternative_Webcalls()) - { - Client = new WebClientWithTimeout() - { - Encoding = Encoding.UTF8, - CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore) - }; - } - else - { - Client.Headers.Add("user-agent", "SBRW Launcher " + - Application.ProductVersion + " (+https://github.com/SoapBoxRaceWorld/GameLauncher_NFSW)"); - } - - Client.DownloadProgressChanged += (Systems, RecevingData) => - { - if (RecevingData.TotalBytesToReceive >= 1 && !Live_Events.Cancel) - { - /* - if (Screen_Instance != default) - { - if (!(Screen_Instance.Disposing || Screen_Instance.IsDisposed)) - { - Screen_Instance.Label_Verify_Scan.Text = "Currently (re)downloading files. This part may take awhile depending on your connection."; - } - } - - TextBox_Verify_Scan - DownloadProgressText.SafeInvokeAction(() => - DownloadProgressText.Text = "Downloading File [ " + RedownloadedCount + " / " + - CurrentCount + " ]:\n" + CurrentDownloadingFile + "\n" + Time_Conversion.FormatFileSize(RecevingData.BytesReceived) + - " of " + Time_Conversion.FormatFileSize(RecevingData.TotalBytesToReceive)); - */ - } - else if (Live_Events.Cancel) - { - Client.CancelAsync(); - } - }; - Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted); - - try - { - Client.DownloadFileAsync(URLCall, Found_File_Invaild.Path_Full); - File_Downloading = true; - } - catch (Exception Error) - { - if (!Live_Events.Cancel) - { - Files_Download_Error_Total++; - File_Downloading = false; - } - - LogToFileAddons.OpenLog("VERIFY HASH", string.Empty, Error, string.Empty, true); - } - finally - { - Client?.Dispose(); - } - - Generated_Scanned_Invalid_List.Remove(Found_File_Invaild); - } - else - { - break; - } - } - catch (Exception Error) - { - if (!Live_Events.Cancel) - { - Files_Download_Error_Total++; - } - - LogToFileAddons.OpenLog("VERIFY HASH", string.Empty, Error, string.Empty, true); - } - } - else - { - break; - } - } - } - } - } - /// - /// - /// - private void Start_File_Scan_Invalid(object _, DoWorkEventArgs Live_Events) - { - if (!Live_Events.Cancel) - { - try - { - FunctionStatus.IsVerifyHashDisabled = true; - - - - Files_Total = getFilesToCheck.Length; - Files_Scanned_Total = 0; - - for (var i = 0; i < Files_Total; i++) - { - if (!Live_Events.Cancel) - { - Generated_Scanned_Invalid_List.Add(new Json_List_Invalid_Game_Files() - { - Hash = getFilesToCheck[i].Split(' ')[0].Trim(), - Path_Truncated = getFilesToCheck[i].Split(' ')[1].Trim(), - Path_Full = Path.Combine(Save_Settings.Live_Data.Game_Path + getFilesToCheck[i].Split(' ')[1].Trim()), - Download_Url = Verify_CDN_URL + "/unpacked" + getFilesToCheck[i].Split(' ')[1].Trim().Replace("\\", "/") - }); - } - else - { - break; - } - } - - foreach (Json_List_Invalid_Game_Files Current_File_Scan in Generated_Scanned_Invalid_List) - { - if (!Live_Events.Cancel) - { - if (!File.Exists(Current_File_Scan.Path_Full)) - { - Log_Verify.Missing("File: " + Current_File_Scan.Path_Truncated); - } - else - { - if (Current_File_Scan.Hash != Current_File_Scan.Path_Full.Hash_SHA().Trim()) - { - Log_Verify.Invalid("File: " + Current_File_Scan.Path_Truncated); - } - else - { - Generated_Scanned_Invalid_List.Remove(Current_File_Scan); - Log_Verify.Valid("File: " + Current_File_Scan.Path_Truncated); - } - } - - Files_Scanned_Total++; - } - else - { - break; - } - } - - Log.Info("VERIFY HASH: Scan Completed"); - if (!Generated_Scanned_Invalid_List.Any() || !Live_Events.Cancel) - { - Verify_Hash_Status = Raw_Download_Progress.Passed; - } - else - { - Log.Info("VERIFY HASH: Found Invalid or Missing Files and will Start File Downloader"); - Verify_Hash_Status = Raw_Download_Progress.Removing; - } - } - catch (Exception Error) - { - LogToFileAddons.OpenLog("VERIFY HASH", string.Empty, Error, string.Empty, true); - } - } - } - - private void Integrity() - { - Presence_Launcher.Status(27); - Save_Settings.Live_Data.Game_Integrity = "Good"; - Save_Settings.Save(); - /* @DavidCarbon OR @Zacam - * Ini File Save Error Happens Above - */ - if (!Screen_Main.Screen_Instance.DisposedForm()) - { - if (Screen_Main.Screen_Instance.Button_Settings.InvokeRequired) - { - Screen_Main.Screen_Instance.Button_Settings.SafeInvokeAction(() => - Screen_Main.Screen_Instance.Button_Settings.BackgroundImage = - Screen_Main.Screen_Instance.Button_Settings.Icon_Order(SVG_Icon.Gear, SVG_Color.White)); - } - else - { - Screen_Main.Screen_Instance.Button_Settings.BackgroundImage = - Screen_Main.Screen_Instance.Button_Settings.Icon_Order(SVG_Icon.Gear, SVG_Color.White); - } - } - } - /// - /// - /// - } -} diff --git a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Visuals.cs b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Visuals.cs index 66453aca..e878f22d 100644 --- a/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Visuals.cs +++ b/SBRW.Launcher.Net/App/UI_Forms/Settings_Screen/Screen_Settings_Visuals.cs @@ -298,7 +298,7 @@ private void Set_Visuals() Label_Game_Files.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); Button_Change_Game_Path.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); Button_Change_Game_Path_Setup.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); - Button_Game_Verify_Files.Font = new Font(FormsFont.Primary(), MainFontSize, FontStyle.Regular); + Button_Verify_Scan.Font = new Font(FormsFont.Primary(), MainFontSize, FontStyle.Regular); Label_Game_Settings.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); Button_Game_User_Settings.Font = new Font(FormsFont.Primary(), MainFontSize, FontStyle.Regular); Button_Clear_Crash_Logs.Font = new Font(FormsFont.Primary_Bold(), SecondaryFontSize, FontStyle.Bold); @@ -386,7 +386,7 @@ private void Set_Visuals() /* Buttons */ ButtonsColorSet(Button_Change_Game_Path, Screen_Parent.Launcher_Setup.Equals(1) ? 2 : 0, true); ButtonsColorSet(Button_Change_Game_Path_Setup, Screen_Parent.Launcher_Setup.Equals(1) ? 2 : 0, true); - ButtonsColorSet(Button_Game_Verify_Files, 0, false); + ButtonsColorSet(Button_Verify_Scan, 0, false); ButtonsColorSet(Button_Game_User_Settings, 0, true); ButtonsColorSet(Button_Clear_Crash_Logs, 0, false); ButtonsColorSet(Button_Launcher_logs, 0, true); @@ -499,7 +499,7 @@ private void Set_Visuals() Button_Console_Submit.Click += new EventHandler(Console_Enter); Button_CDN_List.Click += new EventHandler(Button_CDN_Selector_Click); Button_CDN_List_Setup.Click += new EventHandler(Button_CDN_Selector_Click); - Button_Game_Verify_Files.Click += new EventHandler(Button_Game_Verify_Files_Click); + Button_Verify_Scan.Click += new EventHandler(Button_Game_Verify_Files_Click); Button_Save.Click += new EventHandler(SettingsSave_Click); Button_Save_Setup.Click += new EventHandler(SettingsSave_Click); Button_Experiments.Click += new EventHandler(Button_Experiments_Click); @@ -549,7 +549,7 @@ private void Set_Visuals() if (FunctionStatus.IsVerifyHashDisabled) { - ButtonsColorSet(Button_Game_Verify_Files, 3, true); + ButtonsColorSet(Button_Verify_Scan, 3, true); } /*******************************/ @@ -558,7 +558,7 @@ private void Set_Visuals() ToolTip_Hover.SetToolTip(Button_Change_Game_Path, "Change the location of where the \'nfsw.exe\' that the Launcher will run"); ToolTip_Hover.SetToolTip(Button_Change_Game_Path_Setup, "Change the location of where the \'nfsw.exe\' that the Launcher will run"); - ToolTip_Hover.SetToolTip(Button_Game_Verify_Files, "Checks and Restores GameFiles back to \"Stock\""); + ToolTip_Hover.SetToolTip(Button_Verify_Scan, "Checks and Restores GameFiles back to \"Stock\""); ToolTip_Hover.SetToolTip(Button_CDN_List, "Download Location for Fetching the base GameFiles\n" + "Can also be a Soruce for VerifyHash to get replacement files"); ToolTip_Hover.SetToolTip(Button_CDN_List_Setup, "Download Location for Fetching the base GameFiles\n" + @@ -721,10 +721,8 @@ private void Set_Visuals() #region Verfy Hash VerifyHashWelcome.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); Label_Verify_Scan.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); - DownloadProgressText.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); - StartScanner.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); Button_Verify_Scan.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); - VerifyHashText.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); + Button_Verify_Scan.Font = new Font(FormsFont.Primary_Bold(), MainFontSize, FontStyle.Bold); /********************************/ /* Set Theme Colors / @@ -733,16 +731,14 @@ private void Set_Visuals() ForeColor = Color_Winform.Text_Fore_Color; BackColor = Color_Winform.BG_Fore_Color; - DownloadProgressText.ForeColor = Color_Winform.Text_Fore_Color; Label_Verify_Scan.ForeColor = Color_Winform.Text_Fore_Color; VerifyHashWelcome.ForeColor = Color_Winform.Secondary_Text_Fore_Color; - VerifyHashText.ForeColor = Color_Winform.Success_Text_Fore_Color; - StartScanner.ForeColor = Color_Winform.Success_Text_Fore_Color; - StartScanner.BackColor = Color_Winform_Buttons.Blue_Back_Color; - StartScanner.FlatAppearance.BorderColor = Color_Winform_Buttons.Blue_Border_Color; - StartScanner.FlatAppearance.MouseOverBackColor = Color_Winform_Buttons.Blue_Mouse_Over_Back_Color; + Button_Verify_Scan.ForeColor = Color_Winform.Success_Text_Fore_Color; + Button_Verify_Scan.BackColor = Color_Winform_Buttons.Blue_Back_Color; + Button_Verify_Scan.FlatAppearance.BorderColor = Color_Winform_Buttons.Blue_Border_Color; + Button_Verify_Scan.FlatAppearance.MouseOverBackColor = Color_Winform_Buttons.Blue_Mouse_Over_Back_Color; Button_Verify_Scan.ForeColor = Color_Winform.Warning_Text_Fore_Color; Button_Verify_Scan.BackColor = Color_Winform_Buttons.Blue_Back_Color; @@ -753,8 +749,7 @@ private void Set_Visuals() /* Events Handlers / /********************************/ - StartScanner.Click += new EventHandler(StartScanner_Click); - Button_Verify_Scan.Click += new EventHandler(StopScanner_Click); + //Button_Verify_Scan.Click += new EventHandler(StopScanner_Click); /********************************/ /* Hardcoded Text [Linux Fix] / @@ -763,8 +758,8 @@ private void Set_Visuals() VerifyHashWelcome.Text = "Welcome!\n\nThe scanning process is pretty quick,\nbut may still take a while." + "\nDepending on your connection,\nre-downloading will take the longest\nPlease allow it to complete fully!"; Label_Verify_Scan.Text = "Scanning Progress:"; - DownloadProgressText.Text = "Download Progress:"; - VerifyHashText.Text = "Please select \"Start Scan\" \nTo begin Validating Gamefiles"; + //DownloadProgressText.Text = "Download Progress:"; + //VerifyHashText.Text = "Please select \"Start Scan\" \nTo begin Validating Gamefiles"; #endregion } #endregion diff --git a/SBRW.Launcher.RunTime/InsiderKit/BuildInformation.cs b/SBRW.Launcher.RunTime/InsiderKit/BuildInformation.cs index d31bbfa6..4bad679f 100644 --- a/SBRW.Launcher.RunTime/InsiderKit/BuildInformation.cs +++ b/SBRW.Launcher.RunTime/InsiderKit/BuildInformation.cs @@ -9,10 +9,10 @@ public class BuildInformation { /* Current month, day, year (2 digits), and letter! Ex: 12-15-20-A */ /* If a second build gets release within the same day bump letter version up (No R2 or D2)*/ - const string DATE = "06-04-2024"; - const string DATE_SHORT = "06-04-24"; - const string TIME = "0052"; - const string TIME_SECONDS = "54"; + const string DATE = "06-19-2024"; + const string DATE_SHORT = "06-19-24"; + const string TIME = "2236"; + const string TIME_SECONDS = "05"; const string TIME_ZONE = "-07:00"; /// /// Build Information (Full Information)