diff --git a/data/languages/EN.xml b/data/languages/EN.xml index 5cbc495..53f3658 100644 --- a/data/languages/EN.xml +++ b/data/languages/EN.xml @@ -52,7 +52,6 @@ Warning Error Question - Select the game folder modification has been successfully installed! The binding of the game is completed! diff --git a/data/languages/RU.xml b/data/languages/RU.xml index ae07519..8add015 100644 --- a/data/languages/RU.xml +++ b/data/languages/RU.xml @@ -52,7 +52,6 @@ Предупреждение Ошибка Вопрос - Укажите папку с игрой была успешно установлена! Добавление игры в реестр успешно завершено! diff --git a/sources/Downgrader/Program.cs b/sources/Downgrader/Program.cs index 5ae2aa2..f5a7071 100644 --- a/sources/Downgrader/Program.cs +++ b/sources/Downgrader/Program.cs @@ -5,6 +5,7 @@ using System.IO; using System.Windows.Forms; using System.Xml.Serialization; +using System.Reflection; using VitNX.Functions.Common; using VitNX.Functions.Common.Information; @@ -67,10 +68,10 @@ public static void Main(string[] args) // // todo Localization //string lgcode = "EN"; - //if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\gui.xml")) + //if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\gui.xml")) //{ // XmlSerializer serializer = new XmlSerializer(typeof(SettingsEditor)); - // using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\gui.xml"))) + // using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\gui.xml"))) // { // var string_gui = (GUI_Settings)serializer.Deserialize(reader); // lgcode = string_gui.LnguageCode; @@ -79,7 +80,7 @@ public static void Main(string[] args) Console.Title = "Jetpack Downgrader"; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("[JPD] App: Jetpack Downgrader\n[JPD] Version: " + - System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\n[JPD] License: MIT" + + Assembly.GetExecutingAssembly().GetName().Version.ToString() + "\n[JPD] License: MIT" + "\n[JPD] Authors: Zalexanninev15 (programmer and creator) & Vadim M. (consultant)" + "\n[JPD] GitHub: https://github.com/Zalexanninev15/Jetpack-Downgrader\n\n[App] Start of log output..."); Console.ResetColor(); @@ -95,10 +96,10 @@ public static void Main(string[] args) settings[7] = false; settings[8] = false; settings[9] = true; - if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml")) + if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml")) { XmlSerializer serializer = new XmlSerializer(typeof(SettingsEditor)); - using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml"))) + using (StringReader reader = new StringReader(File.ReadAllText(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\downgrader.xml"))) { var bool_settings = (SettingsEditor)serializer.Deserialize(reader); settings[0] = bool_settings.CreateBackups; @@ -117,7 +118,7 @@ public static void Main(string[] args) else { Logger("App", "downgrader.xml", "false"); } } catch { Logger("App", "downgrader.xml", "false"); } - if (File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patcher.exe")) + if (File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patcher.exe")) { try { path = args[0]; } catch { } if (Directory.Exists(path) == false) @@ -306,13 +307,13 @@ public static void Main(string[] args) Logger("DirectPlay", "Enabled", "In process..."); try { - if (settings[9] == true) { Processes.Execute("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart"); } + if (settings[9] == true) { Processes.RunAW("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart", false); } else { Process.Start("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart").WaitForExit(); } } catch { Logger("DirectPlay", "Enabled", "Error"); } try { - if (settings[9] == true) { Processes.Execute("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all"); } + if (settings[9] == true) { Processes.RunAW("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all", false); } else { Process.Start("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all").WaitForExit(); } } catch { Logger("DirectPlay", "Enabled", "Error"); } @@ -321,13 +322,13 @@ public static void Main(string[] args) } if ((settings[7] == true) && (gv != 5)) { - if (Directory.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\DirectX")) + if (Directory.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\DirectX")) { try { Logger("DirectX", "Process", "Installing..."); Logger("DirectX", "Process", "App is not frozen, just busy right now..."); - Process.Start(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\DirectX\DXSETUP.exe", "/silent").WaitForExit(); + Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\DirectX\DXSETUP.exe", "/silent").WaitForExit(); Logger("DirectX", "Process", "Installation completed successfully"); } catch { Logger("DirectX", "Process", "Installation error"); } @@ -823,15 +824,15 @@ public static void Main(string[] args) } if (er == 0) { - if (Directory.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches")) + if (Directory.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches")) { bool all_patches = true; for (int i = 2; i < fl.Length; i++) { - if (!File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp")) + if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp")) all_patches = false; } - if (!File.Exists(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches\game.jpp")) + if (!File.Exists(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches\game.jpp")) all_patches = false; if (all_patches == true) { @@ -841,8 +842,8 @@ public static void Main(string[] args) // For All Versions | EXE var restoreRGLfiles = new ProcessStartInfo { - FileName = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\7z.exe", - Arguments = "x \"" + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\patches\\game.jpp\" -o\"" + path + "\" -y", + FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\7z.exe", + Arguments = "x \"" + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\patches\\game.jpp\" -o\"" + path + "\" -y", UseShellExecute = false, CreateNoWindow = true, }; @@ -871,10 +872,10 @@ public static void Main(string[] args) for (int i = 2; i < fl.Length; i++) { progress.SetColor(ConsoleColor.Blue); - string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; + string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; if (settings[0] == true) - par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; - Processes.Execute(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par); + par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; + Processes.RunAW(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par, false); if (settings[0] == false) File.Delete(path + fl[i]); File.Move(path + fl[i] + ".temp", path + fl[i]); @@ -900,10 +901,10 @@ public static void Main(string[] args) progress.SetColor(ConsoleColor.Blue); if ((i >= 2) && (i > 11)) { - string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; + string par = '"' + path + fl[i] + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; if (settings[0] == true) - par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; - Processes.Execute(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par); + par = '"' + path + fl[i] + ".jpb" + '"' + " " + '"' + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patches" + fl[i] + ".jpp" + '"' + " " + '"' + path + fl[i] + ".temp" + '"'; + Processes.RunAW(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\patcher.exe", @par, false); if (settings[0] == false) File.Delete(path + fl[i]); File.Move(path + fl[i] + ".temp", path + fl[i]); diff --git a/sources/Downgrader/Properties/AssemblyInfo.cs b/sources/Downgrader/Properties/AssemblyInfo.cs index 89b7a17..70da2e4 100644 --- a/sources/Downgrader/Properties/AssemblyInfo.cs +++ b/sources/Downgrader/Properties/AssemblyInfo.cs @@ -10,5 +10,5 @@ [assembly: AssemblyTrademark("Jetpack Downgrader (2020-2022)")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.16.1.0")] -[assembly: AssemblyFileVersion("1.16.1.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.16.2.0")] +[assembly: AssemblyFileVersion("1.16.2.0")] \ No newline at end of file diff --git a/sources/GUI/Classes/Data.cs b/sources/GUI/Classes/Data.cs index f64936c..ae24912 100644 --- a/sources/GUI/Classes/Data.cs +++ b/sources/GUI/Classes/Data.cs @@ -7,6 +7,7 @@ public static class Data public static bool DebugMode { get; set; } public static string NewVersionDetector { get; } = "https://raw.githubusercontent.com/Zalexanninev15/Jetpack-Downgrader/unstable/Version.txt"; public static string GitHubPing { get; } = "github.com"; + public static string Mods { get; } = "https://raw.githubusercontent.com/Zalexanninev15/Jetpack-Downgrader/unstable/data/mods/info/v2.json"; } public class ModsData @@ -29,6 +30,7 @@ public static class Urls public static string GTAForums { get; } = "https://gtaforums.com/topic/969056-jetpack-downgrader"; public static string GitHubAppUsage { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/main/README.md#usage"; public static string GitHubAppAuthors { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/main/README.md#authors"; + public static string GitHubAppAddMods { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/unstable/data/docs/AddNewData.md#add-new-modifications"; public static string GitHubAppIssues { get; } = "https://github.com/Zalexanninev15/Jetpack-Downgrader/issues"; } } \ No newline at end of file diff --git a/sources/GUI/Classes/GUI_Settings.cs b/sources/GUI/Classes/GUI_Settings.cs index 93e5461..38ae13a 100644 --- a/sources/GUI/Classes/GUI_Settings.cs +++ b/sources/GUI/Classes/GUI_Settings.cs @@ -23,16 +23,16 @@ public GUI() public void WriteXml() { XmlSerializer ser = new XmlSerializer(typeof(GUI_Settings)); - using (TextWriter writer = new StreamWriter(Application.StartupPath + @"\files\gui.xml")) + using (TextWriter writer = new StreamWriter($@"{Application.StartupPath}\files\gui.xml")) ser.Serialize(writer, Fields); } public void ReadXml() { - if (File.Exists(Application.StartupPath + @"\files\gui.xml")) + if (File.Exists($@"{Application.StartupPath}\files\gui.xml")) { XmlSerializer ser = new XmlSerializer(typeof(GUI_Settings)); - using (TextReader reader = new StreamReader(Application.StartupPath + @"\files\gui.xml")) + using (TextReader reader = new StreamReader($@"{Application.StartupPath}\files\gui.xml")) Fields = ser.Deserialize(reader) as GUI_Settings; } } diff --git a/sources/GUI/Classes/LanguagesString.cs b/sources/GUI/Classes/LanguagesString.cs index a472513..8b25822 100644 --- a/sources/GUI/Classes/LanguagesString.cs +++ b/sources/GUI/Classes/LanguagesString.cs @@ -149,9 +149,6 @@ public class LanguagesString [XmlElement(ElementName = "Done")] public string Done { get; set; } - [XmlElement(ElementName = "FolderSelectDialog")] - public string FolderSelectDialog { get; set; } - [XmlElement(ElementName = "WishDownloadPatches")] public string WishDownloadPatches { get; set; } diff --git a/sources/GUI/Classes/SettingsEditor.cs b/sources/GUI/Classes/SettingsEditor.cs index 4ab4258..f1c43f4 100644 --- a/sources/GUI/Classes/SettingsEditor.cs +++ b/sources/GUI/Classes/SettingsEditor.cs @@ -28,16 +28,16 @@ public Props() public void WriteXml() { XmlSerializer ser = new XmlSerializer(typeof(SettingsEditor)); - using (TextWriter writer = new StreamWriter(Application.StartupPath + @"\files\downgrader.xml")) + using (TextWriter writer = new StreamWriter($@"{Application.StartupPath}\files\downgrader.xml")) ser.Serialize(writer, Fields); } public void ReadXml() { - if (File.Exists(Application.StartupPath + @"\files\downgrader.xml")) + if (File.Exists($@"{Application.StartupPath}\files\downgrader.xml")) { XmlSerializer ser = new XmlSerializer(typeof(SettingsEditor)); - using (TextReader reader = new StreamReader(Application.StartupPath + @"\files\downgrader.xml")) + using (TextReader reader = new StreamReader($@"{Application.StartupPath}\files\downgrader.xml")) Fields = ser.Deserialize(reader) as SettingsEditor; } } diff --git a/sources/GUI/MainForm.Designer.cs b/sources/GUI/MainForm.Designer.cs index 336b45c..f585106 100644 --- a/sources/GUI/MainForm.Designer.cs +++ b/sources/GUI/MainForm.Designer.cs @@ -33,69 +33,69 @@ void InitializeComponent() this.progressPanel = new System.Windows.Forms.Panel(); this.play = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); - this.darkButton5 = new VitNX.Controls.VitNX_Button(); - this.AllProgressBar = new VitNX.Controls.VitNX_ProgressBar(); - this.PartProgressBar = new VitNX.Controls.VitNX_ProgressBar(); - this.darkListView2 = new VitNX.Controls.VitNX_ListView(); - this.labelAllProgress = new VitNX.Controls.VitNX_Label(); - this.DebugInfo = new VitNX.Controls.VitNX_Label(); - this.labelPartProgress = new VitNX.Controls.VitNX_Label(); + this.darkButton5 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.AllProgressBar = new VitNX.UI.ControlsV1.VitNX_ProgressBar(); + this.PartProgressBar = new VitNX.UI.ControlsV1.VitNX_ProgressBar(); + this.darkListView2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_ListView(); + this.labelAllProgress = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.DebugInfo = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.labelPartProgress = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); this.stagesPanel = new System.Windows.Forms.Panel(); this.pictureBox9 = new System.Windows.Forms.PictureBox(); this.pictureBox8 = new System.Windows.Forms.PictureBox(); - this.darkButton4 = new VitNX.Controls.VitNX_Button(); - this.button2 = new VitNX.Controls.VitNX_Button(); - this.button6 = new VitNX.Controls.VitNX_Button(); + this.darkButton4 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.button2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.button6 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); this.button1 = new System.Windows.Forms.Button(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.LangsPanel = new System.Windows.Forms.Panel(); - this.darkComboBox2 = new VitNX.Controls.VitNX_ComboBox(); - this.darkLabel1 = new VitNX.Controls.VitNX_Label(); + this.darkComboBox2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_ComboBox(); + this.darkLabel1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); this.label2 = new System.Windows.Forms.Label(); this.HelloUser = new System.Windows.Forms.Label(); - this.DSPanel = new VitNX.Controls.VitNX_SectionPanel(); - this.ModsPanel = new VitNX.Controls.VitNX_SectionPanel(); - this.darkLabel2 = new VitNX.Controls.VitNX_Label(); + this.DSPanel = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_SectionPanel(); + this.ModsPanel = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_SectionPanel(); + this.darkLabel2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); this.modsList = new System.Windows.Forms.ListBox(); - this.darkGroupBox1 = new VitNX.Controls.VitNX_GroupBox(); + this.darkGroupBox1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_GroupBox(); this.ScreenShotViewer = new System.Windows.Forms.Panel(); - this.vitNX_Button1 = new VitNX.Controls.VitNX_Button(); - this.darkButton8 = new VitNX.Controls.VitNX_Button(); - this.darkButton9 = new VitNX.Controls.VitNX_Button(); - this.darkButton7 = new VitNX.Controls.VitNX_Button(); + this.vitNX_Button1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton8 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton9 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton7 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); this.ScreenShotInViewer = new System.Windows.Forms.PictureBox(); - this.darkGroupBox2 = new VitNX.Controls.VitNX_GroupBox(); - this.darkLabel4 = new VitNX.Controls.VitNX_Label(); - this.darkButton3 = new VitNX.Controls.VitNX_Button(); - this.darkButton2 = new VitNX.Controls.VitNX_Button(); - this.darkButton1 = new VitNX.Controls.VitNX_Button(); + this.darkGroupBox2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_GroupBox(); + this.darkLabel4 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.darkButton3 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); this.ScreenShot = new System.Windows.Forms.PictureBox(); - this.YesInstallMe = new VitNX.Controls.VitNX_CheckBox(); - this.darkLabel6 = new VitNX.Controls.VitNX_Label(); - this.darkLabel5 = new VitNX.Controls.VitNX_Label(); - this.nameLabel = new VitNX.Controls.VitNX_Label(); - this.darkButton6 = new VitNX.Controls.VitNX_Button(); - this.darkLabel9 = new VitNX.Controls.VitNX_Label(); + this.YesInstallMe = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.darkLabel6 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.darkLabel5 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.nameLabel = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.darkButton6 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkLabel9 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); this.darkTitle2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.darkTitle1 = new System.Windows.Forms.Label(); - this.originalGameRestoreProgressBar = new VitNX.Controls.VitNX_ProgressBar(); - this.checkBox1 = new VitNX.Controls.VitNX_CheckBox(); + this.originalGameRestoreProgressBar = new VitNX.UI.ControlsV1.VitNX_ProgressBar(); + this.checkBox1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); this.pictureBox15 = new System.Windows.Forms.PictureBox(); this.pictureBox11 = new System.Windows.Forms.PictureBox(); this.pictureBox10 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.GamePath = new VitNX.Controls.VitNX_TextBox(); - this.checkBox2 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox9 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox4 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox8 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox6 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox7 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox3 = new VitNX.Controls.VitNX_CheckBox(); - this.checkBox5 = new VitNX.Controls.VitNX_CheckBox(); + this.GamePath = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_TextBox(); + this.checkBox2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox9 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox4 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox8 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox6 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox7 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox3 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); + this.checkBox5 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox(); this.pictureBox12 = new System.Windows.Forms.PictureBox(); this.pictureBox7 = new System.Windows.Forms.PictureBox(); this.pictureBox6 = new System.Windows.Forms.PictureBox(); @@ -204,7 +204,7 @@ void InitializeComponent() this.AllProgressBar.TextColor = System.Drawing.Color.Black; this.AllProgressBar.TextFont = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.AllProgressBar.Visible = false; - this.AllProgressBar.VisualMode = VitNX.Controls.VitNX_ProgressBarDisplayMode.Percentage; + this.AllProgressBar.VisualMode = VitNX.UI.ControlsV1.VitNX_ProgressBarDisplayMode.Percentage; // // PartProgressBar // @@ -216,7 +216,7 @@ void InitializeComponent() this.PartProgressBar.TabIndex = 10; this.PartProgressBar.TextColor = System.Drawing.Color.Black; this.PartProgressBar.TextFont = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.PartProgressBar.VisualMode = VitNX.Controls.VitNX_ProgressBarDisplayMode.Percentage; + this.PartProgressBar.VisualMode = VitNX.UI.ControlsV1.VitNX_ProgressBarDisplayMode.Percentage; // // darkListView2 // @@ -808,7 +808,7 @@ void InitializeComponent() this.originalGameRestoreProgressBar.TextColor = System.Drawing.Color.Black; this.originalGameRestoreProgressBar.TextFont = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.originalGameRestoreProgressBar.Visible = false; - this.originalGameRestoreProgressBar.VisualMode = VitNX.Controls.VitNX_ProgressBarDisplayMode.NoText; + this.originalGameRestoreProgressBar.VisualMode = VitNX.UI.ControlsV1.VitNX_ProgressBarDisplayMode.NoText; // // checkBox1 // @@ -1103,77 +1103,77 @@ void InitializeComponent() } #endregion - VitNX.Controls.VitNX_TextBox GamePath; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_TextBox GamePath; System.Windows.Forms.PictureBox pictureBox1; - VitNX.Controls.VitNX_CheckBox checkBox1; - VitNX.Controls.VitNX_CheckBox checkBox2; - VitNX.Controls.VitNX_CheckBox checkBox9; - VitNX.Controls.VitNX_CheckBox checkBox4; - VitNX.Controls.VitNX_CheckBox checkBox6; - VitNX.Controls.VitNX_CheckBox checkBox3; - VitNX.Controls.VitNX_CheckBox checkBox5; - VitNX.Controls.VitNX_CheckBox checkBox7; - VitNX.Controls.VitNX_CheckBox checkBox8; - VitNX.Controls.VitNX_SectionPanel DSPanel; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox1; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox2; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox9; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox4; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox6; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox3; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox5; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox7; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox checkBox8; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_SectionPanel DSPanel; System.Windows.Forms.PictureBox pictureBox3; System.Windows.Forms.PictureBox pictureBox4; System.Windows.Forms.PictureBox pictureBox5; System.Windows.Forms.PictureBox pictureBox6; System.Windows.Forms.PictureBox pictureBox7; - VitNX.Controls.VitNX_SectionPanel ModsPanel; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_SectionPanel ModsPanel; System.Windows.Forms.Panel stagesPanel; System.Windows.Forms.PictureBox pictureBox2; - VitNX.Controls.VitNX_Button button2; - VitNX.Controls.VitNX_Button button6; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button button2; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button button6; System.Windows.Forms.Button button1; System.Windows.Forms.Panel LangsPanel; - VitNX.Controls.VitNX_Label darkLabel1; - VitNX.Controls.VitNX_GroupBox darkGroupBox1; - VitNX.Controls.VitNX_CheckBox YesInstallMe; - VitNX.Controls.VitNX_Label nameLabel; - VitNX.Controls.VitNX_Label darkLabel4; - VitNX.Controls.VitNX_Label darkLabel5; - VitNX.Controls.VitNX_Label darkLabel6; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel1; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_GroupBox darkGroupBox1; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_CheckBox YesInstallMe; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label nameLabel; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel4; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel5; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel6; System.Windows.Forms.PictureBox ScreenShot; - VitNX.Controls.VitNX_Button darkButton1; - VitNX.Controls.VitNX_Button darkButton2; - VitNX.Controls.VitNX_Label darkLabel9; - VitNX.Controls.VitNX_Button darkButton3; - System.Windows.Forms.Panel progressPanel; - VitNX.Controls.VitNX_Label labelPartProgress; - VitNX.Controls.VitNX_GroupBox darkGroupBox2; - VitNX.Controls.VitNX_ComboBox darkComboBox2; - VitNX.Controls.VitNX_Button darkButton4; - VitNX.Controls.VitNX_Label labelAllProgress; - VitNX.Controls.VitNX_Label DebugInfo; - VitNX.Controls.VitNX_ListView darkListView2; - System.Windows.Forms.PictureBox pictureBox8; - System.Windows.Forms.PictureBox pictureBox9; - System.Windows.Forms.ListBox modsList; - System.Windows.Forms.PictureBox pictureBox10; - System.Windows.Forms.PictureBox pictureBox11; - VitNX.Controls.VitNX_ProgressBar PartProgressBar; - VitNX.Controls.VitNX_ProgressBar AllProgressBar; - VitNX.Controls.VitNX_ProgressBar originalGameRestoreProgressBar; - System.Windows.Forms.Label darkTitle1; - System.Windows.Forms.Label darkTitle2; - System.Windows.Forms.Label label1; - System.Windows.Forms.PictureBox pictureBox12; - System.Windows.Forms.PictureBox pictureBox13; - System.Windows.Forms.PictureBox pictureBox14; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton1; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton2; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel9; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton3; + System.Windows.Forms.Panel progressPanel; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label labelPartProgress; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_GroupBox darkGroupBox2; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_ComboBox darkComboBox2; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton4; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label labelAllProgress; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label DebugInfo; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_ListView darkListView2; + System.Windows.Forms.PictureBox pictureBox8; + System.Windows.Forms.PictureBox pictureBox9; + System.Windows.Forms.ListBox modsList; + System.Windows.Forms.PictureBox pictureBox10; + System.Windows.Forms.PictureBox pictureBox11; + VitNX.UI.ControlsV1.VitNX_ProgressBar PartProgressBar; + VitNX.UI.ControlsV1.VitNX_ProgressBar AllProgressBar; + VitNX.UI.ControlsV1.VitNX_ProgressBar originalGameRestoreProgressBar; + System.Windows.Forms.Label darkTitle1; + System.Windows.Forms.Label darkTitle2; + System.Windows.Forms.Label label1; + System.Windows.Forms.PictureBox pictureBox12; + System.Windows.Forms.PictureBox pictureBox13; + System.Windows.Forms.PictureBox pictureBox14; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label HelloUser; private System.Windows.Forms.Button play; private System.Windows.Forms.Label label3; - private VitNX.Controls.VitNX_Button darkButton5; - private VitNX.Controls.VitNX_Label darkLabel2; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton5; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel2; private System.Windows.Forms.Panel ScreenShotViewer; - private VitNX.Controls.VitNX_Button darkButton6; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton6; private System.Windows.Forms.PictureBox ScreenShotInViewer; - private VitNX.Controls.VitNX_Button darkButton7; - private VitNX.Controls.VitNX_Button darkButton8; - private VitNX.Controls.VitNX_Button darkButton9; - private VitNX.Controls.VitNX_Button vitNX_Button1; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton7; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton8; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton9; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button vitNX_Button1; private System.Windows.Forms.PictureBox pictureBox15; } } \ No newline at end of file diff --git a/sources/GUI/MainForm.cs b/sources/GUI/MainForm.cs index 7afce58..cbd3209 100644 --- a/sources/GUI/MainForm.cs +++ b/sources/GUI/MainForm.cs @@ -26,8 +26,7 @@ public partial class MainForm : Form { protected override void OnHandleCreated(EventArgs e) { - if (Import.DwmSetWindowAttribute(Handle, 19, new[] { 1 }, 4) != 0) - Import.DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); + VitNX.Functions.Windows.WindowSAndControls.WindowS.SetWindowsTenAndHighStyleForWinFormTitleToDark(Handle); } private Props config = new Props(); @@ -42,7 +41,7 @@ protected override void OnHandleCreated(EventArgs e) private bool NotDone = true; private bool IsDD = false; private bool db = false; - private string cache = Application.StartupPath + @"\files\mods_cache"; + private string cache = $@"{Application.StartupPath}\files\mods_cache"; private string zip_link = "application/zip"; private string[] photos_links = new string[3]; private string site_link = ""; @@ -53,7 +52,7 @@ private void MainForm_Load(object sender, EventArgs e) { ServicePointManager.SecurityProtocol = VitNX.Functions.Common.Web.Config.UseProtocols(); Import.SetProcessDpiAwareness(Enums.PROCESS_DPI_AWARENESS.PROCESS_DPI_UNAWARE); - if (!Directory.Exists(Application.StartupPath + @"\files\patches")) + if (!Directory.Exists($@"{Application.StartupPath}\files\patches")) { darkButton4.Visible = true; button1.Visible = false; @@ -67,7 +66,7 @@ private void MainForm_Load(object sender, EventArgs e) } try { - string[] mf = Directory.GetFiles(Application.StartupPath + @"\files", "*.zip"); + string[] mf = Directory.GetFiles($@"{Application.StartupPath}\files", "*.zip"); for (int i = 0; i < mf.Length; i++) File.Delete(mf[i]); } @@ -127,16 +126,16 @@ private void SettingsLoader() private void button1_Click(object sender, EventArgs e) { - if (Directory.Exists(Application.StartupPath + @"\files\patches")) + if (Directory.Exists($@"{Application.StartupPath}\files\patches")) { NotDone = false; bool all_patches = true; for (int i = 2; i < fl.Length; i++) { - if (!File.Exists(Application.StartupPath + @"\files\patches" + fl[i] + ".jpp")) + if (!File.Exists($@"{Application.StartupPath}\files\patches{fl[i]}.jpp")) all_patches = false; } - if (!File.Exists(Application.StartupPath + @"\files\patches\game.jpp")) + if (!File.Exists($@"{Application.StartupPath}\files\patches\game.jpp")) all_patches = false; if (all_patches == true) { @@ -148,7 +147,7 @@ private void button1_Click(object sender, EventArgs e) TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.Indeterminate); button1.Enabled = false; int d = 0; - Process.Start(Application.StartupPath + @"\files\jpd.exe", "\"" + GamePath.Text + "\"").WaitForExit(); + Process.Start($@"{Application.StartupPath}\files\jpd.exe", "\"" + GamePath.Text + "\"").WaitForExit(); string str = "jpd"; foreach (Process process2 in Process.GetProcesses()) { @@ -157,21 +156,21 @@ private void button1_Click(object sender, EventArgs e) } if ((d == 1) && Directory.Exists(cache + @"\zips")) { - File.WriteAllBytes(cache + @"\zips\ASI_Loader.zip", Properties.Resources.ASILoader); + File.WriteAllBytes($@"{cache}\zips\ASI_Loader.zip", Properties.Resources.ASILoader); string[] modsZip = Directory.GetFiles(cache + @"\zips", "*.zip"); TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.Normal); for (int i = 0; i < modsZip.Length; i++) { string modName = new FileInfo(modsZip[i]).Name.Replace(".zip", ""); - if (IsInstaller(modsZip[i]) == false) + if (FileSystem.IsPeExe(modsZip[i]) == false) { try { TaskBarProgressBar.SetValue(Handle, i, modsZip.Length); if (checkBox3.Checked == false) - Process.Start(Application.StartupPath + @"\files\7z.exe", "x \"" + modsZip[i] + "\" -o\"" + GamePath.Text + "\" -y").WaitForExit(); + Process.Start($@"{Application.StartupPath}\files\7z.exe", "x \"" + modsZip[i] + "\" -o\"" + GamePath.Text + "\" -y").WaitForExit(); else - Process.Start(Application.StartupPath + @"\files\7z.exe", "x \"" + modsZip[i] + "\" -o\"" + GamePath.Text + "_Downgraded\" -y").WaitForExit(); + Process.Start($@"{Application.StartupPath}\files\7z.exe", "x \"" + modsZip[i] + "\" -o\"" + GamePath.Text + "_Downgraded\" -y").WaitForExit(); if (modName != "ASI_Loader") MsgInfo(lc_text[6] + " \"" + modName + "\" " + lc_text[17]); if ((modName == "ASI_Loader") && (modsZip.Length == 1)) @@ -186,9 +185,7 @@ private void button1_Click(object sender, EventArgs e) else { if (checkBox3.Checked == true) - { VitNX_MessageBox.ShowWarning(lc_text[29] + ": \"" + GamePath.Text + "_Downgraded\"!\n" + lc_text[30], lc_text[11]); - } File.Move(modsZip[i], modsZip[i].Replace(".zip", ".exe")); Process.Start(modsZip[i].Replace(".zip", ".exe")).WaitForExit(); File.Move(modsZip[i].Replace(".zip", ".exe"), modsZip[i]); @@ -228,7 +225,7 @@ private void button1_Click(object sender, EventArgs e) } else { - try { Directory.Delete(Application.StartupPath + @"\files\patches", true); } catch { } + try { Directory.Delete($@"{Application.StartupPath}\files\patches", true); } catch { } button1.Visible = false; darkButton4.Visible = true; NotDone = true; @@ -358,7 +355,7 @@ private void button3_Click(object sender, EventArgs e) { if (!checkBox3.Checked) { - try { Process.Start(GamePath.Text + @"\gta_sa.exe"); } + try { Process.Start($@"{GamePath.Text}\gta_sa.exe"); } catch { MsgWarning(lc_text[25]); @@ -368,7 +365,7 @@ private void button3_Click(object sender, EventArgs e) } else { - try { Process.Start(GamePath.Text + @"_Downgraded\gta_sa.exe"); } + try { Process.Start($@"{GamePath.Text}_Downgraded\gta_sa.exe"); } catch { MsgWarning(lc_text[25]); @@ -421,18 +418,16 @@ private void pictureBox3_Click(object sender, EventArgs e) private void darkButton6_Click_1(object sender, EventArgs e) { - try { Process.Start("https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/unstable/data/docs/AddNewData.md#add-new-modifications"); } - catch + if (!Processes.OpenLink(Urls.GitHubAppAddMods)) { MsgWarning(lc_text[26]); - Clipboard.SetText("https://github.com/Zalexanninev15/Jetpack-Downgrader/blob/unstable/data/docs/AddNewData.md#add-new-modifications"); + Clipboard.SetText(Urls.GitHubAppAddMods); } } private void pictureBox4_Click(object sender, EventArgs e) { - try { Process.Start(Urls.GitHubAppUsage); } - catch + if (!Processes.OpenLink(Urls.GitHubAppUsage)) { MsgWarning(lc_text[26]); Clipboard.SetText(Urls.GitHubAppUsage); @@ -474,7 +469,7 @@ private async void MegaDownloader(string url, string file, string label, int cod if (code == 0) { try { TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.Indeterminate); } catch { } - Process.Start(Application.StartupPath + @"\files\7z.exe", "x \"" + file + "\" -o\"" + Application.StartupPath + "\\files\" -y").WaitForExit(); + Process.Start($@"{Application.StartupPath}\files\7z.exe", "x \"" + file + "\" -o\"" + Application.StartupPath + "\\files\" -y").WaitForExit(); File.Delete(file); darkButton4.Visible = false; button1.Visible = true; @@ -483,7 +478,7 @@ private async void MegaDownloader(string url, string file, string label, int cod if (code == 1) { try { TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.Indeterminate); } catch { } - Process.Start(Application.StartupPath + @"\files\7z.exe", "x \"" + file + "\" -o\"" + Application.StartupPath + "\\files\" -y").WaitForExit(); + Process.Start($@"{Application.StartupPath}\files\7z.exe", "x \"" + file + "\" -o\"" + Application.StartupPath + "\\files\" -y").WaitForExit(); File.Delete(file); try { TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.NoProgress); } catch { } } @@ -520,28 +515,34 @@ private void button2_Click(object sender, EventArgs e) { try { - Ping ping = new Ping(); - PingReply pingReply = null; - pingReply = ping.Send(Data.GitHubPing); - if (ModsPanel.Visible == false) + if (Internet.IsHaveInternet(Data.GitHubPing) == Internet.INTERNET_STATUS.CONNECTED) { - try + if (ModsPanel.Visible == false) { - using (System.Net.WebClient mods = new System.Net.WebClient()) + try { - string source = mods.DownloadString("https://raw.githubusercontent.com/Zalexanninev15/Jetpack-Downgrader/unstable/data/mods/info/v2.json"); - var parsed = JsonConvert.DeserializeObject>(source); - modsList.Items.Clear(); - foreach (var data in parsed) - modsList.Items.Add(data.Value.Name); + using (System.Net.WebClient mods = new System.Net.WebClient()) + { + string source = mods.DownloadString(Data.Mods); + var parsed = JsonConvert.DeserializeObject>(source); + modsList.Items.Clear(); + foreach (var data in parsed) + modsList.Items.Add(data.Value.Name); + } + tabFix = true; + DSPanel.Visible = true; + ModsPanel.Visible = true; + } + catch + { + MsgWarning(lc_text[27]); + ModsPanel.Visible = false; + DSPanel.Visible = false; + tabFix = false; } - tabFix = true; - DSPanel.Visible = true; - ModsPanel.Visible = true; } - catch + else { - MsgWarning(lc_text[27]); ModsPanel.Visible = false; DSPanel.Visible = false; tabFix = false; @@ -549,6 +550,7 @@ private void button2_Click(object sender, EventArgs e) } else { + MsgWarning(lc_text[27]); ModsPanel.Visible = false; DSPanel.Visible = false; tabFix = false; @@ -563,14 +565,6 @@ private void button2_Click(object sender, EventArgs e) } } - private bool IsInstaller(string file) - { - var twoBytes = new byte[2]; - using (var fileStream = File.Open(file, FileMode.Open)) - fileStream.Read(twoBytes, 0, 2); - return Encoding.UTF8.GetString(twoBytes) == "MZ"; - } - private void pictureBox2_Click(object sender, EventArgs e) { darkComboBox2.Items.Clear(); @@ -578,7 +572,7 @@ private void pictureBox2_Click(object sender, EventArgs e) { LangsPanel.Visible = true; lpFix = true; - langs = Directory.GetFiles(Application.StartupPath + @"\files\languages", "*.xml"); + langs = Directory.GetFiles($@"{Application.StartupPath}\files\languages", "*.xml"); for (int i = 0; i < langs.Length; i++) { if (langs[i] != "") @@ -615,7 +609,7 @@ private void Translate() langcode = language.Fields.LanguageCode; try { - using (StringReader reader = new StringReader(File.ReadAllText(Application.StartupPath + @"\files\languages\" + langcode + ".xml"))) + using (StringReader reader = new StringReader(File.ReadAllText($@"{Application.StartupPath}\files\languages\{langcode}.xml"))) { var LOCAL = (LanguagesString)lzol.Deserialize(reader); // Text loading @@ -666,7 +660,7 @@ private void Translate() lc_text[11] = LOCAL.Warning; lc_text[10] = LOCAL.Error; lc_text[33] = LOCAL.Question; - lc_text[12] = LOCAL.FolderSelectDialog; + // For new lc: lc_text[12] = // Information messages loading lc_text[17] = LOCAL.ModSucces; lc_text[19] = LOCAL.BindingOK; @@ -768,6 +762,8 @@ private void darkCheckBox1_CheckedChanged(object sender, EventArgs e) } } } + else + YesInstallMe.Checked = false; } catch (Exception ex) { @@ -797,14 +793,14 @@ private void checkBox8_CheckedChanged(object sender, EventArgs e) { if (checkBox8.Checked == true) { - if (!Directory.Exists(Application.StartupPath + @"\files\DirectX")) + if (!Directory.Exists($@"{Application.StartupPath}\files\DirectX")) { try { DialogResult result = VitNX_MessageBox.ShowQuestion(lc_text[14], lc_text[33]); if (result == DialogResult.Yes && Internet.IsHaveInternet(Data.GitHubPing) == Internet.INTERNET_STATUS.CONNECTED) { - try { MegaDownloader("https://mega.nz/file/0pFRwAqa#Arguk9cQLpXYeQgXnFfAp6cw6F5OIZFKP2tRTwNCArI", Application.StartupPath + @"\files\ddirectx.7z", lc_text[5], 1); } + try { MegaDownloader("https://mega.nz/file/0pFRwAqa#Arguk9cQLpXYeQgXnFfAp6cw6F5OIZFKP2tRTwNCArI", $@"{Application.StartupPath}\files\ddirectx.7z", lc_text[5], 1); } catch { checkBox8.Checked = false; } } else @@ -841,8 +837,8 @@ private void MainForm_KeyDown(object sender, KeyEventArgs e) } if (e.KeyData == Keys.F4) { - try { Processes.Run("notepad", Application.StartupPath + @"\files\downgrader.xml"); } - catch { Processes.Run(Application.StartupPath + @"\files\downgrader.xml"); } + try { Processes.Run("notepad", $@"{Application.StartupPath}\files\downgrader.xml"); } + catch { Processes.Run($@"{Application.StartupPath}\files\downgrader.xml"); } } if (e.KeyData == Keys.F12) { @@ -953,14 +949,20 @@ private void darkButton4_Click(object sender, EventArgs e) { try { - Ping ping = new Ping(); - PingReply pingReply = null; - pingReply = ping.Send(Data.GitHubPing); - DialogResult result = VitNX_MessageBox.ShowQuestion(lc_text[13], lc_text[33]); - if (result == DialogResult.Yes) + if (Internet.IsHaveInternet(Data.GitHubPing) == Internet.INTERNET_STATUS.CONNECTED) { - try { MegaDownloader("https://mega.nz/file/4tcXiSqA#8JzulAC0oABzinb7914sq2xkyxE7c6atSeMval-YWms", Application.StartupPath + @"\files\dpatches.rar", lc_text[4], 0); } - catch + DialogResult result = VitNX_MessageBox.ShowQuestion(lc_text[13], lc_text[33]); + if (result == DialogResult.Yes) + { + try { MegaDownloader("https://mega.nz/file/4tcXiSqA#8JzulAC0oABzinb7914sq2xkyxE7c6atSeMval-YWms", $@"{Application.StartupPath}\files\dpatches.rar", lc_text[4], 0); } + catch + { + progressPanel.Visible = false; + stagesPanel.Visible = true; + button1.Visible = false; + } + } + else { progressPanel.Visible = false; stagesPanel.Visible = true; @@ -969,9 +971,9 @@ private void darkButton4_Click(object sender, EventArgs e) } else { - progressPanel.Visible = false; - stagesPanel.Visible = true; - button1.Visible = false; + TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.Error); + MsgWarning(lc_text[27]); + TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.NoProgress); } } catch @@ -988,33 +990,42 @@ private void modsList_SelectedIndexChanged(object sender, EventArgs e) { try { - Ping ping = new Ping(); - PingReply pingReply = null; - pingReply = ping.Send(Data.GitHubPing); - using (System.Net.WebClient mods = new System.Net.WebClient()) + if (Internet.IsHaveInternet(Data.GitHubPing) == Internet.INTERNET_STATUS.CONNECTED) { - string source = mods.DownloadString("https://raw.githubusercontent.com/Zalexanninev15/Jetpack-Downgrader/unstable/data/mods/info/v2.json"); - var parsed = JsonConvert.DeserializeObject>(source); - foreach (var data in parsed) + using (System.Net.WebClient mods = new System.Net.WebClient()) { - if (modsList.Text == data.Value.Name) + string source = mods.DownloadString(Data.Mods); + var parsed = JsonConvert.DeserializeObject>(source); + foreach (var data in parsed) { - ScreenShot.Enabled = true; - darkGroupBox1.Visible = true; - nameLabel.Text = lc_text[0] + ": " + data.Value.Name; - darkLabel5.Text = lc_text[1] + ": " + data.Value.Version; - darkLabel6.Text = lc_text[2] + ": " + data.Value.Author; - darkLabel4.Text = data.Value.Description; - site_link = data.Value.Site; - ScreenShot.ImageLocation = data.Value.Logo; - photos_links[0] = ScreenShot.ImageLocation; - photos_links[1] = data.Value.Screenshot1; - photos_links[2] = data.Value.Screenshot2; - zip_link = data.Value.File; - YesInstallMe.Checked = File.Exists(cache + @"\zips\" + nameLabel.Text.Replace(lc_text[0] + ": ", "") + ".zip"); + if (modsList.Text == data.Value.Name) + { + ScreenShot.Enabled = true; + darkGroupBox1.Visible = true; + nameLabel.Text = lc_text[0] + ": " + data.Value.Name; + darkLabel5.Text = lc_text[1] + ": " + data.Value.Version; + darkLabel6.Text = lc_text[2] + ": " + data.Value.Author; + darkLabel4.Text = data.Value.Description; + site_link = data.Value.Site; + ScreenShot.ImageLocation = data.Value.Logo; + photos_links[0] = ScreenShot.ImageLocation; + photos_links[1] = data.Value.Screenshot1; + photos_links[2] = data.Value.Screenshot2; + zip_link = data.Value.File; + YesInstallMe.Checked = File.Exists(cache + @"\zips\" + nameLabel.Text.Replace(lc_text[0] + ": ", "") + ".zip"); + } } } } + else + { + MsgError(lc_text[21]); + ModsPanel.Visible = false; + DSPanel.Visible = false; + tabFix = false; + ScreenShot.Enabled = false; + zip_link = "application/zip"; + } } catch { @@ -1159,7 +1170,7 @@ private void pictureBox10_Click(object sender, EventArgs e) TaskBarProgressBar.SetState(Handle, Enums.TASKBAR_STATES.Indeterminate); var restoreRGLfiles = new ProcessStartInfo { - FileName = Application.StartupPath + @"\files\7z.exe", + FileName = $@"{Application.StartupPath}\files\7z.exe", Arguments = "x \"" + Application.StartupPath + "\\files\\rgl.jpbc\" -o\"" + @GamePath.Text + "\" -y", UseShellExecute = false, CreateNoWindow = true, @@ -1286,8 +1297,8 @@ private void pictureBox15_Click(object sender, EventArgs e) DialogResult result = VitNX_MessageBox.ShowQuestion(lc_text[18], lc_text[33]); if (result == DialogResult.Yes) { - try { Processes.Execute("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart"); } catch { } - try { Processes.Execute("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all"); } catch { } + try { Processes.RunAW("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart", false); } catch { } + try { Processes.RunAW("dism", "/Online /enable-feature /FeatureName:\"DirectPlay\" /NoRestart /all", false); } catch { } MsgInfo(lc_text[34]); } } diff --git a/sources/GUI/OtherForms/About.Designer.cs b/sources/GUI/OtherForms/About.Designer.cs index 1e80262..8a99c15 100644 --- a/sources/GUI/OtherForms/About.Designer.cs +++ b/sources/GUI/OtherForms/About.Designer.cs @@ -2,11 +2,11 @@ namespace JetpackGUI { partial class About - { + { /// /// Required designer variable. /// - System.ComponentModel.IContainer components = null; + System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. @@ -19,24 +19,24 @@ protected override void Dispose(bool disposing) components.Dispose(); } base.Dispose(disposing); - } - + } + #region Windows Form Designer generated code - + /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - void InitializeComponent() + void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(About)); this.label3 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.darkButton1 = new VitNX.Controls.VitNX_Button(); - this.darkTextBox1 = new VitNX.Controls.VitNX_TextBox(); - this.darkButton2 = new VitNX.Controls.VitNX_Button(); - this.darkButton3 = new VitNX.Controls.VitNX_Button(); - this.darkButton4 = new VitNX.Controls.VitNX_Button(); + this.darkButton1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkTextBox1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_TextBox(); + this.darkButton2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton3 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.darkButton4 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); @@ -176,10 +176,10 @@ void InitializeComponent() private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label1; - private VitNX.Controls.VitNX_Button darkButton1; - private VitNX.Controls.VitNX_TextBox darkTextBox1; - private VitNX.Controls.VitNX_Button darkButton2; - private VitNX.Controls.VitNX_Button darkButton3; - private VitNX.Controls.VitNX_Button darkButton4; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton1; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_TextBox darkTextBox1; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton2; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton3; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button darkButton4; } } \ No newline at end of file diff --git a/sources/GUI/OtherForms/About.cs b/sources/GUI/OtherForms/About.cs index b200503..33a0682 100644 --- a/sources/GUI/OtherForms/About.cs +++ b/sources/GUI/OtherForms/About.cs @@ -3,7 +3,6 @@ using System.Windows.Forms; using System.Xml.Serialization; -using VitNX.Functions.Windows.Win32; using VitNX.UI.ControlsV1.BasedOnDarkUI.Forms; using VitNX.Functions.Windows.Apps; @@ -13,8 +12,7 @@ public partial class About : Form { protected override void OnHandleCreated(EventArgs e) { - if (Import.DwmSetWindowAttribute(Handle, 19, new[] { 1 }, 4) != 0) - Import.DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); + VitNX.Functions.Windows.WindowSAndControls.WindowS.SetWindowsTenAndHighStyleForWinFormTitleToDark(Handle); } public About() diff --git a/sources/GUI/OtherForms/ChooseGame.Designer.cs b/sources/GUI/OtherForms/ChooseGame.Designer.cs index 41c45ea..83fc859 100644 --- a/sources/GUI/OtherForms/ChooseGame.Designer.cs +++ b/sources/GUI/OtherForms/ChooseGame.Designer.cs @@ -2,11 +2,11 @@ namespace JetpackGUI { partial class ChooseGame - { + { /// /// Required designer variable. /// - System.ComponentModel.IContainer components = null; + System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. @@ -19,22 +19,22 @@ protected override void Dispose(bool disposing) components.Dispose(); } base.Dispose(disposing); - } - + } + #region Windows Form Designer generated code - + /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - void InitializeComponent() + void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChooseGame)); this.label3 = new System.Windows.Forms.Label(); - this.vitNX_Button1 = new VitNX.Controls.VitNX_Button(); - this.vitNX_Button2 = new VitNX.Controls.VitNX_Button(); - this.vitNX_Button3 = new VitNX.Controls.VitNX_Button(); - this.vitNX_Button4 = new VitNX.Controls.VitNX_Button(); + this.vitNX_Button1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.vitNX_Button2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.vitNX_Button3 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); + this.vitNX_Button4 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); this.SuspendLayout(); // // label3 @@ -127,9 +127,9 @@ void InitializeComponent() #endregion private System.Windows.Forms.Label label3; - private VitNX.Controls.VitNX_Button vitNX_Button1; - private VitNX.Controls.VitNX_Button vitNX_Button2; - private VitNX.Controls.VitNX_Button vitNX_Button3; - private VitNX.Controls.VitNX_Button vitNX_Button4; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button vitNX_Button1; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button vitNX_Button2; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button vitNX_Button3; + private VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button vitNX_Button4; } } \ No newline at end of file diff --git a/sources/GUI/OtherForms/ChooseGame.cs b/sources/GUI/OtherForms/ChooseGame.cs index 3db0789..c853011 100644 --- a/sources/GUI/OtherForms/ChooseGame.cs +++ b/sources/GUI/OtherForms/ChooseGame.cs @@ -1,16 +1,13 @@ using System; using System.Windows.Forms; -using VitNX.Functions.Windows.Win32; - namespace JetpackGUI { public partial class ChooseGame : Form { protected override void OnHandleCreated(EventArgs e) { - if (Import.DwmSetWindowAttribute(Handle, 19, new[] { 1 }, 4) != 0) - Import.DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); + VitNX.Functions.Windows.WindowSAndControls.WindowS.SetWindowsTenAndHighStyleForWinFormTitleToDark(Handle); } private GUI mygui = new GUI(); diff --git a/sources/GUI/OtherForms/FirstLaunch.Designer.cs b/sources/GUI/OtherForms/FirstLaunch.Designer.cs index 1d26793..d1d81a2 100644 --- a/sources/GUI/OtherForms/FirstLaunch.Designer.cs +++ b/sources/GUI/OtherForms/FirstLaunch.Designer.cs @@ -6,7 +6,7 @@ partial class MyLang /// /// Required designer variable. /// - System.ComponentModel.IContainer components = null; + System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. @@ -27,18 +27,18 @@ protected override void Dispose(bool disposing) /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - void InitializeComponent() + void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MyLang)); - this.darkLabel1 = new VitNX.Controls.VitNX_Label(); - this.AllLangs = new VitNX.Controls.VitNX_ComboBox(); - this.button2 = new VitNX.Controls.VitNX_Button(); + this.darkLabel1 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label(); + this.AllLangs = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_ComboBox(); + this.button2 = new VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button(); this.SuspendLayout(); // // darkLabel1 // - this.darkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.darkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.darkLabel1.Font = new System.Drawing.Font("Arial", 9.75F); this.darkLabel1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(220)))), ((int)(((byte)(220))))); @@ -99,8 +99,8 @@ void InitializeComponent() #endregion - VitNX.Controls.VitNX_Label darkLabel1; - VitNX.Controls.VitNX_ComboBox AllLangs; - VitNX.Controls.VitNX_Button button2; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Label darkLabel1; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_ComboBox AllLangs; + VitNX.UI.ControlsV1.BasedOnDarkUI.Controls.VitNX_Button button2; } } \ No newline at end of file diff --git a/sources/GUI/OtherForms/FirstLaunch.cs b/sources/GUI/OtherForms/FirstLaunch.cs index 014a12f..3162e9f 100644 --- a/sources/GUI/OtherForms/FirstLaunch.cs +++ b/sources/GUI/OtherForms/FirstLaunch.cs @@ -3,7 +3,6 @@ using System.Windows.Forms; using System.Xml.Serialization; -using VitNX.Functions.Windows.Win32; using VitNX.UI.ControlsV1.BasedOnDarkUI.Forms; namespace JetpackGUI @@ -12,8 +11,7 @@ public partial class MyLang : Form { protected override void OnHandleCreated(EventArgs e) { - if (Import.DwmSetWindowAttribute(Handle, 19, new[] { 1 }, 4) != 0) - Import.DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4); + VitNX.Functions.Windows.WindowSAndControls.WindowS.SetWindowsTenAndHighStyleForWinFormTitleToDark(Handle); } private GUI mygui = new GUI(); @@ -41,7 +39,7 @@ private void MyLang_Load(object sender, EventArgs e) { this.Size = new System.Drawing.Size(265, 152); AllLangs.Items.Clear(); - langs = Directory.GetFiles(Application.StartupPath + @"\files\languages", "*.xml"); + langs = Directory.GetFiles($@"{Application.StartupPath}\files\languages", "*.xml"); for (int i = 0; i < langs.Length; i++) { if (langs[i] != "") diff --git a/sources/GUI/Properties/AssemblyInfo.cs b/sources/GUI/Properties/AssemblyInfo.cs index a1048c2..f9097a5 100644 --- a/sources/GUI/Properties/AssemblyInfo.cs +++ b/sources/GUI/Properties/AssemblyInfo.cs @@ -10,5 +10,5 @@ [assembly: AssemblyTrademark("Jetpack Downgrader (2020-2022)")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("1.5.5.0")] -[assembly: AssemblyFileVersion("1.5.5.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.5.6.0")] +[assembly: AssemblyFileVersion("1.5.6.0")] \ No newline at end of file