From 3e1ed98c468e160cec7d7c23eb3fc7f91c5ead0d Mon Sep 17 00:00:00 2001 From: vletroye Date: Sat, 16 Jan 2021 18:15:41 +0100 Subject: [PATCH] Remove the checksum from INFO file when opening a Package. Remove support to compute the checksum (moved into a dedicated module). Add support to edit stat-stop-status.sh and installer.sh (quite usual in old packages). Display the list of errors preventing to open a package folder, if any. Upgrade to .NET 4.6.1. --- Mods.sln | 40 +++++++++ Mods/App.config | 24 +++--- Mods/Forms/MainForm.Designer.cs | 146 +++++++++++++++++++------------- Mods/Forms/MainForm.cs | 22 +++-- Mods/Helpers/Helper.cs | 43 +--------- Mods/Mods.csproj | 29 ++++++- Mods/Program.cs | 86 +++++++++---------- 7 files changed, 219 insertions(+), 171 deletions(-) diff --git a/Mods.sln b/Mods.sln index 2cce055..c2a49ca 100644 --- a/Mods.sln +++ b/Mods.sln @@ -12,50 +12,90 @@ Project("{6141683F-8A12-4E36-9623-2EB02B2C2303}") = "Installer", "Installer\Inst {DB8082FE-EDDD-406D-B6D7-19C26EC778A4} = {DB8082FE-EDDD-406D-B6D7-19C26EC778A4} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hash", "Hash\Hash.csproj", "{A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 Release|x86 = Release|x86 SingleImage|Any CPU = SingleImage|Any CPU + SingleImage|x64 = SingleImage|x64 SingleImage|x86 = SingleImage|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Debug|x64.ActiveCfg = Debug|x64 + {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Debug|x64.Build.0 = Debug|x64 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Debug|x86.ActiveCfg = Debug|x86 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Debug|x86.Build.0 = Debug|x86 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Release|Any CPU.Build.0 = Release|Any CPU + {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Release|x64.ActiveCfg = Release|x64 + {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Release|x64.Build.0 = Release|x64 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Release|x86.ActiveCfg = Release|x86 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.Release|x86.Build.0 = Release|x86 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.SingleImage|Any CPU.Build.0 = Release|Any CPU + {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.SingleImage|x64.ActiveCfg = Release|x64 + {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.SingleImage|x64.Build.0 = Release|x64 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.SingleImage|x86.ActiveCfg = Release|x86 {DB8082FE-EDDD-406D-B6D7-19C26EC778A4}.SingleImage|x86.Build.0 = Release|x86 {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Debug|x64.ActiveCfg = Debug|x64 + {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Debug|x64.Build.0 = Debug|x64 {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Debug|x86.ActiveCfg = Debug|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Debug|x86.Build.0 = Debug|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Release|Any CPU.ActiveCfg = Release|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Release|Any CPU.Build.0 = Release|Any CPU + {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Release|x64.ActiveCfg = Release|x64 + {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Release|x64.Build.0 = Release|x64 {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Release|x86.ActiveCfg = Release|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.Release|x86.Build.0 = Release|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.SingleImage|Any CPU.Build.0 = Release|Any CPU + {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.SingleImage|x64.ActiveCfg = Release|x64 + {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.SingleImage|x64.Build.0 = Release|x64 {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.SingleImage|x86.ActiveCfg = Release|Any CPU {C0BE5E35-87CC-40E0-92D8-1D42C60F016D}.SingleImage|x86.Build.0 = Release|Any CPU {1196CE31-52D1-451B-B592-642F1B8A530A}.Debug|Any CPU.ActiveCfg = SingleImage + {1196CE31-52D1-451B-B592-642F1B8A530A}.Debug|x64.ActiveCfg = DVD-5 + {1196CE31-52D1-451B-B592-642F1B8A530A}.Debug|x64.Build.0 = DVD-5 {1196CE31-52D1-451B-B592-642F1B8A530A}.Debug|x86.ActiveCfg = DVD-5 {1196CE31-52D1-451B-B592-642F1B8A530A}.Debug|x86.Build.0 = DVD-5 {1196CE31-52D1-451B-B592-642F1B8A530A}.Release|Any CPU.ActiveCfg = SingleImage + {1196CE31-52D1-451B-B592-642F1B8A530A}.Release|x64.ActiveCfg = CD_ROM {1196CE31-52D1-451B-B592-642F1B8A530A}.Release|x86.ActiveCfg = SingleImage {1196CE31-52D1-451B-B592-642F1B8A530A}.Release|x86.Build.0 = SingleImage {1196CE31-52D1-451B-B592-642F1B8A530A}.SingleImage|Any CPU.ActiveCfg = SingleImage {1196CE31-52D1-451B-B592-642F1B8A530A}.SingleImage|Any CPU.Build.0 = SingleImage + {1196CE31-52D1-451B-B592-642F1B8A530A}.SingleImage|x64.ActiveCfg = SingleImage + {1196CE31-52D1-451B-B592-642F1B8A530A}.SingleImage|x64.Build.0 = SingleImage {1196CE31-52D1-451B-B592-642F1B8A530A}.SingleImage|x86.ActiveCfg = SingleImage {1196CE31-52D1-451B-B592-642F1B8A530A}.SingleImage|x86.Build.0 = SingleImage + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Debug|x64.ActiveCfg = Debug|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Debug|x64.Build.0 = Debug|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Debug|x86.ActiveCfg = Debug|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Debug|x86.Build.0 = Debug|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Release|Any CPU.Build.0 = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Release|x64.ActiveCfg = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Release|x64.Build.0 = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Release|x86.ActiveCfg = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.Release|x86.Build.0 = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.SingleImage|Any CPU.Build.0 = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.SingleImage|x64.ActiveCfg = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.SingleImage|x64.Build.0 = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.SingleImage|x86.ActiveCfg = Release|Any CPU + {A88C4996-406E-4F26-BEE2-1D7ACB2BAB21}.SingleImage|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Mods/App.config b/Mods/App.config index 0342dd6..4463499 100644 --- a/Mods/App.config +++ b/Mods/App.config @@ -1,15 +1,15 @@ - + - -
+ +
- -
+ +
- + @@ -21,19 +21,19 @@ - + - + - + True - + False @@ -48,7 +48,7 @@ False - + This SOFTWARE PRODUCT is provided by THE PROVIDER "as is" and "with all faults." THE PROVIDER makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and other software installed on your equipment. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT. @@ -300,4 +300,4 @@ ln -s $SYNOPKG_PKGDEST/ui/dsm.cgi.conf /usr/syno/share/nginx/conf.d/dsm.$SYNOPKG - \ No newline at end of file + diff --git a/Mods/Forms/MainForm.Designer.cs b/Mods/Forms/MainForm.Designer.cs index 14b9813..66e5de1 100644 --- a/Mods/Forms/MainForm.Designer.cs +++ b/Mods/Forms/MainForm.Designer.cs @@ -160,13 +160,17 @@ private void InitializeComponent() this.menuRouterConfig = new System.Windows.Forms.ToolStripMenuItem(); this.menuRouterScript = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); - this.menuStartScript = new System.Windows.Forms.ToolStripMenuItem(); - this.menuStopScript = new System.Windows.Forms.ToolStripMenuItem(); + this.menuPreInstall = new System.Windows.Forms.ToolStripMenuItem(); this.menuPostInstall = new System.Windows.Forms.ToolStripMenuItem(); this.menuPreUninstall = new System.Windows.Forms.ToolStripMenuItem(); this.menuPostUninstall = new System.Windows.Forms.ToolStripMenuItem(); this.menuPreUpgrade = new System.Windows.Forms.ToolStripMenuItem(); this.menuPostUpgrade = new System.Windows.Forms.ToolStripMenuItem(); + this.menuPreReplace = new System.Windows.Forms.ToolStripMenuItem(); + this.menuPostReplace = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStartStopScript = new System.Windows.Forms.ToolStripMenuItem(); + this.menuStartScriptShell = new System.Windows.Forms.ToolStripMenuItem(); + this.menuInstallerScript = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.menuWizardInstallUI = new System.Windows.Forms.ToolStripMenuItem(); this.menuWizardUninstallUI = new System.Windows.Forms.ToolStripMenuItem(); @@ -194,8 +198,6 @@ private void InitializeComponent() this.menuAbout = new System.Windows.Forms.ToolStripMenuItem(); this.groupBoxTip = new System.Windows.Forms.GroupBox(); this.labelToolTip = new System.Windows.Forms.Label(); - this.menuPostReplace = new System.Windows.Forms.ToolStripMenuItem(); - this.menuPreReplace = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox_256)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox_128)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox_96)).BeginInit(); @@ -1765,7 +1767,7 @@ private void InitializeComponent() this.menuRouterConfig, this.menuRouterScript, this.toolStripMenuItem2, - this.menuStopScript, + this.menuPreInstall, this.menuPostInstall, this.menuPreUninstall, this.menuPostUninstall, @@ -1773,7 +1775,9 @@ private void InitializeComponent() this.menuPostUpgrade, this.menuPreReplace, this.menuPostReplace, - this.menuStartScript, + this.menuInstallerScript, + this.menuStartStopScript, + this.menuStartScriptShell, this.toolStripSeparator2, this.menuWizardInstallUI, this.menuWizardUninstallUI, @@ -1788,7 +1792,7 @@ private void InitializeComponent() // this.menuRouterConfig.Name = "menuRouterConfig"; this.menuRouterConfig.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F1))); - this.menuRouterConfig.Size = new System.Drawing.Size(200, 22); + this.menuRouterConfig.Size = new System.Drawing.Size(234, 22); this.menuRouterConfig.Tag = "package\\{0}\\dsm.cgi.conf"; this.menuRouterConfig.Text = "Router Config"; this.menuRouterConfig.Click += new System.EventHandler(this.menuRouterConfig_Click); @@ -1797,7 +1801,7 @@ private void InitializeComponent() // this.menuRouterScript.Name = "menuRouterScript"; this.menuRouterScript.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F2))); - this.menuRouterScript.Size = new System.Drawing.Size(200, 22); + this.menuRouterScript.Size = new System.Drawing.Size(234, 22); this.menuRouterScript.Tag = "package\\{0}\\router.cgi"; this.menuRouterScript.Text = "Router Script"; this.menuRouterScript.Click += new System.EventHandler(this.menuRouterScript_Click); @@ -1805,33 +1809,23 @@ private void InitializeComponent() // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(197, 6); - // - // menuStartScript - // - this.menuStartScript.Name = "menuStartScript"; - this.menuStartScript.ShortcutKeys = System.Windows.Forms.Keys.F9; - this.menuStartScript.Size = new System.Drawing.Size(200, 22); - this.menuStartScript.Tag = "scripts\\start-stop-status"; - this.menuStartScript.Text = "Start-Stop Script"; - this.menuStartScript.ToolTipText = "Edit the script used to start/stop the currently opened Package."; - this.menuStartScript.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + this.toolStripMenuItem2.Size = new System.Drawing.Size(231, 6); // - // menuStopScript + // menuPreInstall // - this.menuStopScript.Name = "menuStopScript"; - this.menuStopScript.ShortcutKeys = System.Windows.Forms.Keys.F1; - this.menuStopScript.Size = new System.Drawing.Size(200, 22); - this.menuStopScript.Tag = "scripts\\preinst"; - this.menuStopScript.Text = "Pre-Install Script"; - this.menuStopScript.ToolTipText = "Edit the script to be run before installing the currently opened Package."; - this.menuStopScript.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + this.menuPreInstall.Name = "menuPreInstall"; + this.menuPreInstall.ShortcutKeys = System.Windows.Forms.Keys.F1; + this.menuPreInstall.Size = new System.Drawing.Size(234, 22); + this.menuPreInstall.Tag = "scripts\\preinst"; + this.menuPreInstall.Text = "Pre-Install Script"; + this.menuPreInstall.ToolTipText = "Edit the script to be run before installing the currently opened Package."; + this.menuPreInstall.Click += new System.EventHandler(this.scriptEditMenuItem_Click); // // menuPostInstall // this.menuPostInstall.Name = "menuPostInstall"; this.menuPostInstall.ShortcutKeys = System.Windows.Forms.Keys.F2; - this.menuPostInstall.Size = new System.Drawing.Size(200, 22); + this.menuPostInstall.Size = new System.Drawing.Size(234, 22); this.menuPostInstall.Tag = "scripts\\postinst"; this.menuPostInstall.Text = "Post-Install Script"; this.menuPostInstall.ToolTipText = "Edit the script to be run after installing the currently opened Package."; @@ -1841,7 +1835,7 @@ private void InitializeComponent() // this.menuPreUninstall.Name = "menuPreUninstall"; this.menuPreUninstall.ShortcutKeys = System.Windows.Forms.Keys.F3; - this.menuPreUninstall.Size = new System.Drawing.Size(200, 22); + this.menuPreUninstall.Size = new System.Drawing.Size(234, 22); this.menuPreUninstall.Tag = "scripts\\preuninst"; this.menuPreUninstall.Text = "Pre-Uninstall Script"; this.menuPreUninstall.ToolTipText = "Edit the script to be run before uninstalling the currently opened Package."; @@ -1851,7 +1845,7 @@ private void InitializeComponent() // this.menuPostUninstall.Name = "menuPostUninstall"; this.menuPostUninstall.ShortcutKeys = System.Windows.Forms.Keys.F4; - this.menuPostUninstall.Size = new System.Drawing.Size(200, 22); + this.menuPostUninstall.Size = new System.Drawing.Size(234, 22); this.menuPostUninstall.Tag = "scripts\\postuninst"; this.menuPostUninstall.Text = "Post-Uninstall Script"; this.menuPostUninstall.ToolTipText = "Edit the script to be run after uninstalling the currently opened Package."; @@ -1861,7 +1855,7 @@ private void InitializeComponent() // this.menuPreUpgrade.Name = "menuPreUpgrade"; this.menuPreUpgrade.ShortcutKeys = System.Windows.Forms.Keys.F5; - this.menuPreUpgrade.Size = new System.Drawing.Size(200, 22); + this.menuPreUpgrade.Size = new System.Drawing.Size(234, 22); this.menuPreUpgrade.Tag = "scripts\\preupgrade"; this.menuPreUpgrade.Text = "Pre-Upgrade Script"; this.menuPreUpgrade.ToolTipText = "Edit the script to be run before upgrading the currently opened Package."; @@ -1871,22 +1865,72 @@ private void InitializeComponent() // this.menuPostUpgrade.Name = "menuPostUpgrade"; this.menuPostUpgrade.ShortcutKeys = System.Windows.Forms.Keys.F6; - this.menuPostUpgrade.Size = new System.Drawing.Size(200, 22); + this.menuPostUpgrade.Size = new System.Drawing.Size(234, 22); this.menuPostUpgrade.Tag = "scripts\\postupgrade"; this.menuPostUpgrade.Text = "Post-Upgrade Script"; this.menuPostUpgrade.ToolTipText = "Edit the script to be run after upgrading the currently opened Package."; this.menuPostUpgrade.Click += new System.EventHandler(this.scriptEditMenuItem_Click); // + // menuPreReplace + // + this.menuPreReplace.Name = "menuPreReplace"; + this.menuPreReplace.ShortcutKeys = System.Windows.Forms.Keys.F7; + this.menuPreReplace.Size = new System.Drawing.Size(234, 22); + this.menuPreReplace.Tag = "scripts\\prereplace"; + this.menuPreReplace.Text = "Pre-Replace Script"; + this.menuPreReplace.Visible = false; + this.menuPreReplace.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + // + // menuPostReplace + // + this.menuPostReplace.Name = "menuPostReplace"; + this.menuPostReplace.ShortcutKeys = System.Windows.Forms.Keys.F8; + this.menuPostReplace.Size = new System.Drawing.Size(234, 22); + this.menuPostReplace.Tag = "scripts\\postreplace"; + this.menuPostReplace.Text = "Post-Replace Script"; + this.menuPostReplace.Visible = false; + this.menuPostReplace.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + // + // menuStartStopScript + // + this.menuStartStopScript.Name = "menuStartStopScript"; + this.menuStartStopScript.ShortcutKeys = System.Windows.Forms.Keys.F9; + this.menuStartStopScript.Size = new System.Drawing.Size(234, 22); + this.menuStartStopScript.Tag = "scripts\\start-stop-status"; + this.menuStartStopScript.Text = "Start-Stop Script"; + this.menuStartStopScript.ToolTipText = "Edit the script used to start/stop the currently opened Package."; + this.menuStartStopScript.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + // + // menuStartScriptShell + // + this.menuStartScriptShell.Name = "menuStartScriptShell"; + this.menuStartScriptShell.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F9))); + this.menuStartScriptShell.Size = new System.Drawing.Size(234, 22); + this.menuStartScriptShell.Tag = "scripts\\start-stop-status.sh"; + this.menuStartScriptShell.Text = "Start-Stop Script Shell"; + this.menuStartScriptShell.ToolTipText = "Edit the shell script used to start/stop the currently opened Package."; + this.menuStartScriptShell.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + // + // menuInstallerScript + // + this.menuInstallerScript.Name = "menuInstallerScript"; + this.menuInstallerScript.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F8))); + this.menuInstallerScript.Size = new System.Drawing.Size(234, 22); + this.menuInstallerScript.Tag = "scripts\\installer.sh"; + this.menuInstallerScript.Text = "Installer Script Shell"; + this.menuInstallerScript.ToolTipText = "Edit the shell script used to install the currently opened Package."; + this.menuInstallerScript.Click += new System.EventHandler(this.scriptEditMenuItem_Click); + // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(197, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(231, 6); // // menuWizardInstallUI // this.menuWizardInstallUI.Name = "menuWizardInstallUI"; this.menuWizardInstallUI.ShortcutKeys = System.Windows.Forms.Keys.F10; - this.menuWizardInstallUI.Size = new System.Drawing.Size(200, 22); + this.menuWizardInstallUI.Size = new System.Drawing.Size(234, 22); this.menuWizardInstallUI.Tag = "WIZARD_UIFILES\\install_uifile"; this.menuWizardInstallUI.Text = "Wizard-Install UI"; this.menuWizardInstallUI.ToolTipText = "Edit the wizard to be run before installing of the currently opened Package."; @@ -1896,7 +1940,7 @@ private void InitializeComponent() // this.menuWizardUninstallUI.Name = "menuWizardUninstallUI"; this.menuWizardUninstallUI.ShortcutKeys = System.Windows.Forms.Keys.F11; - this.menuWizardUninstallUI.Size = new System.Drawing.Size(200, 22); + this.menuWizardUninstallUI.Size = new System.Drawing.Size(234, 22); this.menuWizardUninstallUI.Tag = "WIZARD_UIFILES\\uninstall_uifile"; this.menuWizardUninstallUI.Text = "Wizard-Uninstall UI"; this.menuWizardUninstallUI.ToolTipText = "Edit the wizard to be run before uninstalling of the currently opened Package."; @@ -1906,7 +1950,7 @@ private void InitializeComponent() // this.menuWizardUpgradeUI.Name = "menuWizardUpgradeUI"; this.menuWizardUpgradeUI.ShortcutKeys = System.Windows.Forms.Keys.F12; - this.menuWizardUpgradeUI.Size = new System.Drawing.Size(200, 22); + this.menuWizardUpgradeUI.Size = new System.Drawing.Size(234, 22); this.menuWizardUpgradeUI.Tag = "WIZARD_UIFILES\\upgrade_uifile"; this.menuWizardUpgradeUI.Text = "Wizard-Upgrade UI"; this.menuWizardUpgradeUI.ToolTipText = "Edit the wizard to be run before upgrading of the currently opened Package."; @@ -1915,13 +1959,13 @@ private void InitializeComponent() // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(197, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(231, 6); // // menuLicense // this.menuLicense.Name = "menuLicense"; this.menuLicense.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12))); - this.menuLicense.Size = new System.Drawing.Size(200, 22); + this.menuLicense.Size = new System.Drawing.Size(234, 22); this.menuLicense.Tag = "LICENSE"; this.menuLicense.Text = "License"; this.menuLicense.Click += new System.EventHandler(this.menuLicense_Click); @@ -2114,26 +2158,6 @@ private void InitializeComponent() this.labelToolTip.TabIndex = 24; this.labelToolTip.UseMnemonic = false; // - // menuPostReplace - // - this.menuPostReplace.Name = "menuPostReplace"; - this.menuPostReplace.ShortcutKeys = System.Windows.Forms.Keys.F8; - this.menuPostReplace.Size = new System.Drawing.Size(200, 22); - this.menuPostReplace.Tag = "scripts\\postreplace"; - this.menuPostReplace.Text = "Post-Replace Script"; - this.menuPostReplace.Visible = false; - this.menuPostReplace.Click += new System.EventHandler(this.scriptEditMenuItem_Click); - // - // menuPreReplace - // - this.menuPreReplace.Name = "menuPreReplace"; - this.menuPreReplace.ShortcutKeys = System.Windows.Forms.Keys.F7; - this.menuPreReplace.Size = new System.Drawing.Size(200, 22); - this.menuPreReplace.Tag = "scripts\\prereplace"; - this.menuPreReplace.Text = "Pre-Replace Script"; - this.menuPreReplace.Visible = false; - this.menuPreReplace.Click += new System.EventHandler(this.scriptEditMenuItem_Click); - // // MainForm // this.AllowDrop = true; @@ -2251,8 +2275,10 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem menuResetPackage; private System.Windows.Forms.ToolStripMenuItem menuBuildPackage; private System.Windows.Forms.ToolStripMenuItem menuDefaultRunner; - private System.Windows.Forms.ToolStripMenuItem menuStartScript; - private System.Windows.Forms.ToolStripMenuItem menuStopScript; + private System.Windows.Forms.ToolStripMenuItem menuStartStopScript; + private System.Windows.Forms.ToolStripMenuItem menuStartScriptShell; + private System.Windows.Forms.ToolStripMenuItem menuInstallerScript; + private System.Windows.Forms.ToolStripMenuItem menuPreInstall; private System.Windows.Forms.ToolStripMenuItem menuPostInstall; private System.Windows.Forms.ToolStripMenuItem menuPreUninstall; private System.Windows.Forms.ToolStripMenuItem menuPostUninstall; diff --git a/Mods/Forms/MainForm.cs b/Mods/Forms/MainForm.cs index 0193883..7d37f6c 100644 --- a/Mods/Forms/MainForm.cs +++ b/Mods/Forms/MainForm.cs @@ -697,7 +697,8 @@ private void LoadPackageInfo(string path) value = value.Replace("
", "\r\n"); if (info.ContainsKey(key)) info.Remove(key); - info.Add(key, value); + if (key != "checksum") + info.Add(key, value); } } @@ -3606,7 +3607,8 @@ private bool OpenExistingPackage(string path = null, bool? import = false) if (ready == DialogResult.Abort) { - MessageBoxEx.Show(this, "The Folder does not contain any valid package.", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); + var message = warnings.Aggregate((i, j) => i + "\r\n_____________________________________________________________\r\n\r\n" + j); + MessageBoxEx.Show(this, "The Folder does not contain a valid package.\r\n\r\n" + message, "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); ready = DialogResult.Abort; succeed = false; } @@ -3662,9 +3664,15 @@ private void CopyPackagingBinaries(string path) if (File.Exists(Path.Combine(path, "Unpack.cmd"))) File.Delete(Path.Combine(path, "Unpack.cmd")); File.Copy(Path.Combine(Helper.ResourcesDirectory, "Unpack.cmd"), Path.Combine(path, "Unpack.cmd")); - if (File.Exists(Path.Combine(path, "Mods.exe"))) - File.Delete(Path.Combine(path, "Mods.exe")); - File.Copy(Assembly.GetEntryAssembly().Location, Path.Combine(path, "Mods.exe")); + + var binFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); + var hash = Path.Combine(binFolder, "Hash.exe"); + if (File.Exists(hash)) + { + if (File.Exists(Path.Combine(path, "Hash.exe"))) + File.Delete(Path.Combine(path, "Hash.exe")); + File.Copy(hash, Path.Combine(path, "Hash.exe")); + } } /// @@ -4093,7 +4101,7 @@ private void menuWizard_Click(object sender, EventArgs e) Helper.WriteAnsiFile(jsonPath, wizard.Code); menu.Image = new Bitmap(Properties.Resources.EditedScript); } - if (wizard.Code.Trim()=="") + if (wizard.Code.Trim() == "") Helper.DeleteFile(jsonPath); } else @@ -4122,7 +4130,7 @@ private void menuWizard_Click(object sender, EventArgs e) } var dir = Path.GetDirectoryName(jsonPath); - if (Directory.Exists(dir) && Directory.EnumerateFiles(dir).Count() ==0) + if (Directory.Exists(dir) && Directory.EnumerateFiles(dir).Count() == 0) Directory.Delete(dir); } } diff --git a/Mods/Helpers/Helper.cs b/Mods/Helpers/Helper.cs index 2b71109..b33e988 100644 --- a/Mods/Helpers/Helper.cs +++ b/Mods/Helpers/Helper.cs @@ -802,48 +802,7 @@ public static void EncryptAndSign(string sourcePath, string targetPath, string p encrypter.EncryptAndSign(outputStream, new FileInfo(sourcePath)); } } - - public static void ComputeMD5Hash(string path) - { - string hash = ""; - var package = Path.Combine(path, "package.tgz"); - var info = Path.Combine(path, "INFO"); - - using (var md5 = MD5.Create()) - { - using (var stream = File.OpenRead(package)) - { - var hashByte = md5.ComputeHash(stream); - hash = BitConverter.ToString(hashByte).Replace("-", "").ToLower(); - } - } - - if (File.Exists(info)) - { - var lines = File.ReadAllLines(info); - using (StreamWriter outputFile = new StreamWriter(info)) - { - bool check = false; - foreach (var line in lines) - { - var key = line.Substring(0, line.IndexOf('=')); - var value = line.Substring(line.IndexOf('=') + 1); - value = value.Trim(new char[] { '"' }); - - if (key == "checksum") - { - value = hash; - check = true; - } - - outputFile.WriteLine("{0}=\"{1}\"", key, value); - } - if (!check) - outputFile.WriteLine("checksum=\"{0}\"", hash); - } - } - } - + public static string JsonPrettify(string json) { using (var stringReader = new StringReader(json)) diff --git a/Mods/Mods.csproj b/Mods/Mods.csproj index 333d174..f7f2092 100644 --- a/Mods/Mods.csproj +++ b/Mods/Mods.csproj @@ -9,7 +9,7 @@ Properties BeatificaBytes.Synology.Mods Mods - v4.5 + v4.6.1 512 SAK SAK @@ -32,6 +32,7 @@ true + x86 @@ -79,6 +80,26 @@ BeatificaBytes.Synology.Mods.Program + + true + bin\x64\Debug\ + DEBUG;TRACE + full + x64 + prompt + MinimumRecommendedRules.ruleset + true + + + bin\x64\Release\ + TRACE + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + true + ..\packages\BouncyCastle.Crypto.dll.1.8.1\lib\BouncyCastle.Crypto.dll @@ -180,7 +201,6 @@ SnapshotManager.cs - @@ -317,6 +337,11 @@ + + {a88c4996-406e-4f26-bee2-1d7acb2bab21} + Hash + True + {c0be5e35-87cc-40e0-92d8-1d42c60f016d} Json Editor diff --git a/Mods/Program.cs b/Mods/Program.cs index 0f4caaf..9366ba4 100644 --- a/Mods/Program.cs +++ b/Mods/Program.cs @@ -31,66 +31,56 @@ static void Main(string[] args) { try { - var hash = args.SingleOrDefault(arg => arg.StartsWith("hash:")); - if (!string.IsNullOrEmpty(hash)) + string open = null; + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + var edit = args.SingleOrDefault(arg => arg.StartsWith("edit:")); + if (!string.IsNullOrEmpty(edit)) { - var path = hash.Replace("hash:", ""); - if (path == ".") path = AppDomain.CurrentDomain.BaseDirectory; - Helper.ComputeMD5Hash(path); + open = edit.Replace("edit:", ""); } - else + else if (Properties.Settings.Default.UpgradeRequired) { - string open = null; - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - var edit = args.SingleOrDefault(arg => arg.StartsWith("edit:")); - if (!string.IsNullOrEmpty(edit)) - { - open = edit.Replace("edit:", ""); - } - else if (Properties.Settings.Default.UpgradeRequired) - { - Properties.Settings.Default.Upgrade(); - Properties.Settings.Default.UpgradeRequired = false; - Properties.Settings.Default.Save(); - } - - // Load the default runner script or create one if it does not exist - var defaultRunnerPath = Path.Combine(Helper.ResourcesDirectory, "default.runner"); - if (!File.Exists(defaultRunnerPath)) - Helper.WriteAnsiFile(defaultRunnerPath, Properties.Settings.Default.Ps_Exec); + Properties.Settings.Default.Upgrade(); + Properties.Settings.Default.UpgradeRequired = false; + Properties.Settings.Default.Save(); + } - // Load the Router Config or create one if it does not exist - var defaultRouterConfigPath = Path.Combine(Helper.ResourcesDirectory, "dsm.cgi.conf"); - if (!File.Exists(defaultRouterConfigPath)) - Helper.WriteAnsiFile(defaultRouterConfigPath, Properties.Settings.Default.dsm_cgi); + // Load the default runner script or create one if it does not exist + var defaultRunnerPath = Path.Combine(Helper.ResourcesDirectory, "default.runner"); + if (!File.Exists(defaultRunnerPath)) + Helper.WriteAnsiFile(defaultRunnerPath, Properties.Settings.Default.Ps_Exec); - // Load the Router Script or create one if it does not exist - var defaultRouterScriptPath = Path.Combine(Helper.ResourcesDirectory, "router.cgi"); - if (!File.Exists(defaultRouterScriptPath)) - Helper.WriteAnsiFile(defaultRouterScriptPath, Properties.Settings.Default.router_cgi); + // Load the Router Config or create one if it does not exist + var defaultRouterConfigPath = Path.Combine(Helper.ResourcesDirectory, "dsm.cgi.conf"); + if (!File.Exists(defaultRouterConfigPath)) + Helper.WriteAnsiFile(defaultRouterConfigPath, Properties.Settings.Default.dsm_cgi); - // Load the default DSM release list or create one if it does not exist - var defaultDSMReleases = Path.Combine(Helper.ResourcesDirectory, "dsm_releases"); - if (!File.Exists(defaultDSMReleases)) - Helper.WriteAnsiFile(defaultDSMReleases, Properties.Settings.Default.dsm_releases); + // Load the Router Script or create one if it does not exist + var defaultRouterScriptPath = Path.Combine(Helper.ResourcesDirectory, "router.cgi"); + if (!File.Exists(defaultRouterScriptPath)) + Helper.WriteAnsiFile(defaultRouterScriptPath, Properties.Settings.Default.router_cgi); - // Extract the WizardUI background image if it does not exist - var backWizard = Path.Combine(Helper.ResourcesDirectory, "backwizard.png"); - if (!File.Exists(backWizard)) - { - var backWizardPng = new Bitmap(Properties.Resources.BackWizard); - backWizardPng.Save(backWizard); - } + // Load the default DSM release list or create one if it does not exist + var defaultDSMReleases = Path.Combine(Helper.ResourcesDirectory, "dsm_releases"); + if (!File.Exists(defaultDSMReleases)) + Helper.WriteAnsiFile(defaultDSMReleases, Properties.Settings.Default.dsm_releases); - Application.Run(new MainForm(open)); + // Extract the WizardUI background image if it does not exist + var backWizard = Path.Combine(Helper.ResourcesDirectory, "backwizard.png"); + if (!File.Exists(backWizard)) + { + var backWizardPng = new Bitmap(Properties.Resources.BackWizard); + backWizardPng.Save(backWizard); } + + Application.Run(new MainForm(open)); } catch (Exception ex) { - MessageBoxEx.Show(string.Format("Mods Packager failed to run due to a fatal error : {0}\r\n\r\nIt will now stop.", ex.Message), "Fatal Error"); + MessageBoxEx.Show(string.Format("Mods Packager failed to run due to a fatal error : {0}\r\n\r\nIt will now stop.", ex.Message), "Fatal Error"); } } }