diff --git a/Installer/Installer.isl b/Installer/Installer.isl index 53a2e5e..f39c73b 100644 --- a/Installer/Installer.isl +++ b/Installer/Installer.isl @@ -2345,6 +2345,8 @@ ISProductConfiguration_ Property Value + ExpressMSIPackageFileNameModsPackager + ExpressSetupFileNameModsPackager @@ -2627,7 +2629,7 @@ EncodedCommentTimeStamp - + @@ -3728,8 +3730,8 @@ - - + + @@ -3856,8 +3858,10 @@ + + @@ -3866,6 +3870,7 @@ + @@ -3985,8 +3990,8 @@ Value @@ -4003,7 +4008,7 @@ RABWAEQALQA1AAEARQB4AHAAcgBlAHMAcwA= - +
COMPANY_NAME1033BeatificaBytes0816222765COMPANY_NAME1033BeatificaBytes0598270898 DN_AlwaysInstall1033Always Install0816195852 IDPROP_EXPRESS_LAUNCH_CONDITION_COLOR1033The color settings of your system are not adequate for running [ProductName].0816195852 IDPROP_EXPRESS_LAUNCH_CONDITION_DOTNETVERSION45FULL1033Microsoft .NET Framework 4.5 Full package or greater needs to be installed for this installation to continue.0816198604IDS__TargetReq_DESC_PROCESSOR1033The processor is not adequate for running [ProductName].0816195852 IDS__TargetReq_DESC_RAM1033The amount of RAM is not adequate for running [ProductName].0816195852 IDS__TargetReq_DESC_RESOLUTION1033The screen resolution is not adequate for running [ProductName].0816195852ID_STRING11033https://github.com/vletroye/Mods01084623668ID_STRING21033BeatificaBytes0816222765ID_STRING11033http://www.BeatificaBytes.com0598270898ID_STRING21033BeatificaBytes0598270898 ID_STRING31033MODSPA~1|Mods Packager0816231022 ID_STRING41033MODSPA~1|Mods Packager01218860564 ID_STRING51033Uninstall01218864660_2F12380404694CEDBED088731830E538.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _363B76D18D4A455CABB8017415C9A452.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _41A02E29B4A84A7D9EBF7CA0E530FD12.exeE:\Work\Development\Git\Mods Packager\Mods\bin\Release\Mods.exe0_45D34636B41C478AAA320B656E448520.exeE:\Work\Development\Git\Mods Packager\Mods\bin\Release\Mods.exe0 _474F4FBC6F9A4356B8E5B3D766A731DF.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _5A16D07E4256431C8CD3AD5E29974A59.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0_5B14CC6636404AFE83AD1B9917A9EDBC.exeE:\Work\Development\Git\Mods Packager\Mods\bin\Release\Mods.exe0 _640C510ABC28486BA8654B7151D653AA.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _698BC01DC203404AA839E5B84286CDAD.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _6E4FDAF88E0C415B9F60EE8378BAA7CF.exeE:\Work\Development\Git\Mods Packager\Mods\bin\Release\Mods.exe0_B3ADE7A9BD9C4A87B29589E052AE48F9.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _BBA60D912E2748DB8AE26944A0FB800F.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Release\Mods.exe0 _C811BD35821D47D0B09A46BAF413CC28.exeE:\Work\Development\Git\Mods Packager\Mods\bin\Release\Mods.exe0_D158E5CA42AA43D3B7360F9982A42B57.exeE:\Work\Development\Git\Mods Packager\Mods\bin\Release\Mods.exe0 _E24B286946EA4DC3A0ADD60BBF3B54DE.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _E3EA6B0BF9A14B7BB393B62086A537DF.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0 _E84D6A01C4024F9281D1F6963BCE25F9.exeE:\Work\Development\Git\Mods\Mods\MyOwnDSMShortcuts\bin\Debug\Mods.exe0
ActiveLanguage1033 Comments - CurrentMedia -RABWAEQALQA1AAEARQB4AHAAcgBlAHMAcwA= + CurrentMedia +QwBEAF8AUgBPAE0AAQBFAHgAcAByAGUAcwBzAA== DefaultProductConfigurationExpress EnableSwidtag0ISThemeInstallShield Blue.theme ISUSLock{6514ECB8-B8DB-4268-AB81-00F88F64F54B} ISUSSignature{6E03227C-024D-4572-92B1-9486B0022884}ISVisitedViewsviewAssistant,viewProject,viewISToday,viewLearnMore,viewRelease,viewSystemSearch,viewUI,viewServices,viewAppFiles,viewObjects,viewShortcuts,viewTextMessages,viewUpgradePathsISVisitedViewsviewAssistant,viewProject,viewISToday,viewLearnMore,viewRelease,viewSystemSearch,viewUI,viewServices,viewAppFiles,viewObjects,viewShortcuts,viewTextMessages,viewUpgradePaths,viewUpdateService,viewIniFiles,viewFileExtensions,viewEnvironmentVariables,viewRegistry,viewCustomActions Limited1 LockPermissionMode1 MsiExecCmdLineOptions @@ -4062,7 +4067,6 @@ RABWAEQALQA1AAEARQB4AHAAcgBlAHMAcwA= ConditionDescription -
(Not Version9X) And (Not ((VersionNT>=400 And VersionNT<=600) Or (VersionNT>=601 And VersionNT<=603 And MsiNTProductType>1)))##IDPROP_EXPRESS_LAUNCH_CONDITION_OS## DOTNETVERSION45FULL>="#1"##IDPROP_EXPRESS_LAUNCH_CONDITION_DOTNETVERSION45FULL##
@@ -4383,7 +4387,7 @@ RABWAEQALQA1AAEARQB4AHAAcgBlAHMAcwA=
PROGRAMFILETOLAUNCHATEND[INSTALLDIR]Mods.Primary output ProductCode{4D6A4347-3372-4B79-9AD6-B7A0632892B9} ProductNameMods Packager - ProductVersion7.01.0000 + ProductVersion7.02.0000 ProgressType0install ProgressType1Installing ProgressType2installed diff --git a/Installer/Installer/Express/SingleImage/DiskImages/DISK1/setup.exe b/Installer/Installer/Express/SingleImage/DiskImages/DISK1/setup.exe deleted file mode 100644 index b580c39..0000000 Binary files a/Installer/Installer/Express/SingleImage/DiskImages/DISK1/setup.exe and /dev/null differ diff --git a/Installer/Installer/Express/SingleImage/LogFiles/11-10-2018 07-10-22.txt b/Installer/Installer/Express/SingleImage/LogFiles/11-10-2018 07-10-22.txt deleted file mode 100644 index 4925bd0..0000000 Binary files a/Installer/Installer/Express/SingleImage/LogFiles/11-10-2018 07-10-22.txt and /dev/null differ diff --git a/Installer/Installer/Express/SingleImage/Reports/11-10-2018 07-10-29.htm b/Installer/Installer/Express/SingleImage/Reports/11-10-2018 07-10-29.htm deleted file mode 100644 index cb14333..0000000 --- a/Installer/Installer/Express/SingleImage/Reports/11-10-2018 07-10-29.htm +++ /dev/null @@ -1,727 +0,0 @@ -Build Report - -

-Build Report

- -

-Summary

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -Number of features: -

- -1 -

- -Number of merge modules: -

- -0 -

- -Number of dynamic links: -

- -0 -

- -Media: -

- -SingleImage -

- -Number of files: -

- -16 -

- -Uncompressed files total size: -

- -0.00 MB -

- -Compressed files total size: -

- -0.00 MB -

- -

-Features

- - - - - - - - - -

- -AlwaysInstall -

- -

-Merge Modules

- - - -
- -

-Dynamic links

- - - -
- -

-Files

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -File -

- -Destination -

- -Feature -

- -Last Modified -

- -Size (bytes) -

- -Version -

- -HelpSynoWizard.csv -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -20-04-17 20:43:14 -

- -9216 -

- - -

- -Pack.cmd -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -04-01-18 21:17:53 -

- -516 -

- - -

- -Package.zip -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -31-12-17 11:44:23 -

- -65882 -

- - -

- -Unpack.cmd -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -02-05-17 01:04:42 -

- -419 -

- - -

- -synology_models.yaml -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -18-11-17 22:26:02 -

- -3513 -

- - -

- -synology_services.yaml -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -31-12-17 19:07:39 -

- -375 -

- - -

- -7z.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -20-04-17 20:43:14 -

- -1606656 -

- -16.2.0.0 -

- -7z.exe -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager\Resources -

- -Always Install -

- -20-04-17 20:43:14 -

- -448000 -

- -16.2.0.0 -

- -Mods.exe -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -10-11-18 19:10:22 -

- -1527808 -

- -7.1.0.0 -

- -Mods.exe.config -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -10-11-18 17:03:04 -

- -5450 -

- - -

- -BouncyCastle.Crypto.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -25-01-16 07:17:06 -

- -2236416 -

- -1.8.15362.1 -

- -Magick.NET-Q16-AnyCPU.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -05-12-17 21:46:44 -

- -12818488 -

- -7.2.1.0 -

- -Newtonsoft.Json.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -18-06-17 12:57:10 -

- -653824 -

- -10.0.3.21018 -

- -ScintillaNET.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -18-02-17 17:02:08 -

- -1368064 -

- -3.6.3.0 -

- -YamlDotNet.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -18-12-17 03:19:12 -

- -185344 -

- -4.2.3.0 -

- -ZTn.Json.Editor.dll -

- -[ProgramFilesFolder]BeatificaBytes\Mods Packager -

- -Always Install -

- -10-11-18 19:10:21 -

- -202240 -

- -1.3.3.0 -

- - - diff --git a/Json Editor/Forms/JsonEditorMainForm.cs b/Json Editor/Forms/JsonEditorMainForm.cs index 98c19e5..b13f387 100644 --- a/Json Editor/Forms/JsonEditorMainForm.cs +++ b/Json Editor/Forms/JsonEditorMainForm.cs @@ -36,6 +36,8 @@ public sealed partial class JsonEditorMainForm : Form private bool validJSon = true; + private string originalJson = string.Empty; + #endregion #region >> Properties @@ -51,6 +53,9 @@ public void OpenFile(string path) if (string.IsNullOrEmpty(json)) { CreateEmptyJson(path); + } else + { + originalJson = json; } OpenJson(path); } @@ -93,7 +98,7 @@ private void ExpandWizardNodes(TreeNode node) private void CreateEmptyJson(string path) { var jsonEditorItem = new JTokenRoot("[]"); - File.WriteAllText(path, jsonEditorItem.JTokenValue.ToString()); + Helper.WriteAnsiFile(path, jsonEditorItem.JTokenValue.ToString()); } /// @@ -463,6 +468,7 @@ private void buttonOk_Click(object sender, EventArgs e) { if (OpenedFileName == null) { + DialogResult = DialogResult.Cancel; return; } @@ -478,6 +484,14 @@ private void buttonOk_Click(object sender, EventArgs e) { JsonEditorItem.Save(stream); } + + SetActionStatus(@"Wizard successfully saved.", false); + + string json = File.ReadAllText(OpenedFileName); + if (json != originalJson) + DialogResult = DialogResult.OK; + else + DialogResult = DialogResult.Cancel; } catch { @@ -486,19 +500,18 @@ private void buttonOk_Click(object sender, EventArgs e) OpenedFileName = null; SetActionStatus(@"Wizard NOT saved.", true); - return; + DialogResult = DialogResult.Cancel; } - - SetActionStatus(@"Wizard successfully saved.", false); - this.DialogResult = DialogResult.OK; - this.Close(); + } else + { + DialogResult = DialogResult.Cancel; } } private void buttonCancel_Click(object sender, EventArgs e) { - this.DialogResult = DialogResult.Cancel; - this.Close(); + DialogResult = DialogResult.Cancel; + //this.Close(); } private void wizardDevGuideToolStripMenuItem_Click(object sender, EventArgs e) @@ -975,8 +988,6 @@ private void buttonNext_Click(object sender, EventArgs e) private void JsonEditorMainForm_FormClosing(object sender, FormClosingEventArgs e) { - if (this.DialogResult != DialogResult.Cancel) - buttonCancel_Click(sender, e); } private void deleteToolStripMenuItem_Click(object sender, EventArgs e) @@ -985,7 +996,7 @@ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { File.Delete(OpenedFileName); this.DialogResult = DialogResult.OK; - this.Close(); + //this.Close(); } } } diff --git a/Json Editor/Helper.cs b/Json Editor/Helper.cs index 9981201..962607a 100644 --- a/Json Editor/Helper.cs +++ b/Json Editor/Helper.cs @@ -71,5 +71,18 @@ internal static string GetSubItemType(string type) } return subitemType; } + + public static void WriteAnsiFile(string path, string content) + { + if (string.IsNullOrEmpty(content)) + content = string.Empty; + else + content = content.Replace("\r\n", "\n"); + + using (TextWriter text = new StreamWriter(path, false, Encoding.GetEncoding(1252))) + { + text.Write(content); + } + } } } diff --git a/Json Editor/JTokenRoot.cs b/Json Editor/JTokenRoot.cs index 070f697..43d08c9 100644 --- a/Json Editor/JTokenRoot.cs +++ b/Json Editor/JTokenRoot.cs @@ -2,6 +2,7 @@ using Newtonsoft.Json.Linq; using System.IO; using System.Windows.Forms; +using System.Text; namespace ZTn.Json.Editor { @@ -102,14 +103,14 @@ public void Save(Stream jsonStream) return; } - var json = jTokenValue.ToString(); + var json = jTokenValue.ToString().Replace("\r\n","\n"); DialogResult response = DialogResult.Yes; if (string.IsNullOrEmpty(json) || json == "[]") response = MessageBox.Show(Application.OpenForms[0], "This wizard is empty, incomplete or incorrect. Do you really want to save it ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (response == DialogResult.Yes) { - using (var streamWriter = new StreamWriter(jsonStream)) + using (var streamWriter = new StreamWriter(jsonStream, Encoding.GetEncoding(1252))) { streamWriter.Write(json); } diff --git a/Mods/Data/ScriptInfo.cs b/Mods/Data/ScriptInfo.cs index 7728815..410b3e6 100644 --- a/Mods/Data/ScriptInfo.cs +++ b/Mods/Data/ScriptInfo.cs @@ -24,7 +24,7 @@ public string Code { get { - if (code != null) code = code.Replace("\r\n", "\n"); + //if (!string.IsNullOrEmpty(code)) code = code.Replace("\r\n", "\n"); return code; } diff --git a/Mods/Forms/MainForm.Designer.cs b/Mods/Forms/MainForm.Designer.cs index 542efa8..f061640 100644 --- a/Mods/Forms/MainForm.Designer.cs +++ b/Mods/Forms/MainForm.Designer.cs @@ -147,13 +147,13 @@ private void InitializeComponent() this.menuMovePackage = new System.Windows.Forms.ToolStripMenuItem(); this.menuDeletePackage = new System.Windows.Forms.ToolStripMenuItem(); this.menuAddWizard = new System.Windows.Forms.ToolStripMenuItem(); - this.menuChangeLog = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.menuBuildPackage = new System.Windows.Forms.ToolStripMenuItem(); this.menuPublish = new System.Windows.Forms.ToolStripMenuItem(); this.menuOpenPackageFolder = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); this.menuManageScreenshots = new System.Windows.Forms.ToolStripMenuItem(); + this.menuChangeLog = new System.Windows.Forms.ToolStripMenuItem(); this.menuReviewPendingChanges = new System.Windows.Forms.ToolStripMenuItem(); this.menuEdit = new System.Windows.Forms.ToolStripMenuItem(); this.menuRouterConfig = new System.Windows.Forms.ToolStripMenuItem(); @@ -1685,14 +1685,6 @@ private void InitializeComponent() this.menuAddWizard.ToolTipText = "Add installation/upgrade/uninstallation wizards to the currently opened Package."; this.menuAddWizard.Click += new System.EventHandler(this.menuAddWizard_Click); // - // menuChangeLog - // - this.menuChangeLog.Name = "menuChangeLog"; - this.menuChangeLog.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.L))); - this.menuChangeLog.Size = new System.Drawing.Size(205, 22); - this.menuChangeLog.Text = "Edit Change&Log"; - this.menuChangeLog.Click += new System.EventHandler(this.toolStripMenuItemChangeLog_Click); - // // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; @@ -1720,7 +1712,7 @@ private void InitializeComponent() this.menuOpenPackageFolder.Name = "menuOpenPackageFolder"; this.menuOpenPackageFolder.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); this.menuOpenPackageFolder.Size = new System.Drawing.Size(205, 22); - this.menuOpenPackageFolder.Text = "&Open Folder"; + this.menuOpenPackageFolder.Text = "&Explore Folder"; this.menuOpenPackageFolder.ToolTipText = "Opened the folder of the currently opened Package within Windows Explorer."; this.menuOpenPackageFolder.Click += new System.EventHandler(this.menuOpenFolder_Click); // @@ -1738,6 +1730,14 @@ private void InitializeComponent() this.menuManageScreenshots.Text = "Edit &Screenshots"; this.menuManageScreenshots.Click += new System.EventHandler(this.menuManageScreenshots_Click); // + // menuChangeLog + // + this.menuChangeLog.Name = "menuChangeLog"; + this.menuChangeLog.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.L))); + this.menuChangeLog.Size = new System.Drawing.Size(205, 22); + this.menuChangeLog.Text = "Edit Change&Log"; + this.menuChangeLog.Click += new System.EventHandler(this.toolStripMenuItemChangeLog_Click); + // // menuReviewPendingChanges // this.menuReviewPendingChanges.Name = "menuReviewPendingChanges"; @@ -1772,7 +1772,7 @@ private void InitializeComponent() // menuRouterConfig // this.menuRouterConfig.Name = "menuRouterConfig"; - this.menuRouterConfig.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F2))); + 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.Tag = "package\\{0}\\dsm.cgi.conf"; this.menuRouterConfig.Text = "Router Config"; @@ -1781,7 +1781,7 @@ private void InitializeComponent() // menuRouterScript // this.menuRouterScript.Name = "menuRouterScript"; - this.menuRouterScript.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F3))); + 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.Tag = "package\\{0}\\router.cgi"; this.menuRouterScript.Text = "Router Script"; diff --git a/Mods/Forms/MainForm.cs b/Mods/Forms/MainForm.cs index 7d8f0af..6836596 100644 --- a/Mods/Forms/MainForm.cs +++ b/Mods/Forms/MainForm.cs @@ -404,7 +404,8 @@ private void SaveResourceConfig(string path) if (this.resource.Count > 0) { var json = JsonConvert.SerializeObject(this.resource, Formatting.Indented); - File.WriteAllText(resourceFile, json); + + Helper.WriteAnsiFile(resourceFile, json); } } catch (Exception ex) @@ -959,7 +960,7 @@ private void SavePackageInfo(string path) Helper.DeleteFile(infoName); // Write the new INFO file - using (StreamWriter outputFile = new StreamWriter(infoName)) + using (StreamWriter outputFile = new StreamWriter(infoName, false, Encoding.GetEncoding(1252))) { foreach (var element in info) { @@ -1865,14 +1866,8 @@ private bool CreateScript(KeyValuePair current, string script, Directory.CreateDirectory(target); // Create sh script (ANSI) to be executed by the php runner script - using (TextWriter text = new StreamWriter(targetScript, true, Encoding.GetEncoding(1252))) - { - text.Write(script); - } - using (TextWriter text = new StreamWriter(targetRunner, true, Encoding.GetEncoding(1252))) - { - text.Write(runner); - } + Helper.WriteAnsiFile(targetScript, script); + Helper.WriteAnsiFile(targetRunner, runner); } } @@ -1908,7 +1903,8 @@ private void SaveItemsConfig() var config = Path.Combine(CurrentPackageFolder, string.Format(CONFIGFILE, info["dsmuidir"])); if (Directory.Exists(Path.GetDirectoryName(config))) { - File.WriteAllText(config, json); + // Save Config as Ansi + Helper.WriteAnsiFile(config, json); } else { @@ -3892,7 +3888,7 @@ private bool EditInstallationScript(string scriptName, string title) DialogResult result = Helper.ScriptEditor(script, null, GetAllWizardVariables()); if (result == DialogResult.OK) { - File.WriteAllText(scriptPath, script.Code); + Helper.WriteAnsiFile(scriptPath, script.Code); done = true; } } @@ -3903,6 +3899,7 @@ private bool EditInstallationScript(string scriptName, string title) private void menuExit_Click(object sender, EventArgs e) { // Trigger the Close event on the Main Form. (See MainForm_FormClosing) + //DialogResult = DialogResult.Abort; this.Close(); } @@ -3963,8 +3960,7 @@ private void menuWizard_Click(object sender, EventArgs e) jsonPath = Path.Combine(CurrentPackageFolder, "WIZARD_UIFILES", json); if (jsonPath != null) - using (File.CreateText(jsonPath)) - { } + Helper.WriteAnsiFile(jsonPath, string.Empty); } if (jsonPath != null) @@ -3978,7 +3974,7 @@ private void menuWizard_Click(object sender, EventArgs e) result = Helper.ScriptEditor(wizard, null, null); if (result == DialogResult.OK) { - File.WriteAllText(jsonPath, wizard.Code); + Helper.WriteAnsiFile(jsonPath, wizard.Code); menu.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -4095,8 +4091,8 @@ private void buttonAdvanced_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(script, config, null); if (result == DialogResult.OK) { - File.WriteAllText(infoName, script.Code); - if (configName != null) File.WriteAllText(configName, config.Code); + Helper.WriteAnsiFile(infoName, script.Code); + if (configName != null) Helper.WriteAnsiFile(configName, config.Code); LoadPackageInfo(CurrentPackageFolder); LoadResourceConfig(CurrentPackageFolder); BindData(list, null); @@ -5041,7 +5037,7 @@ private void menuLicense_Click(object sender, EventArgs e) } else { - File.WriteAllText(scriptPath, script.Code); + Helper.WriteAnsiFile(scriptPath, script.Code); menu.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -5104,7 +5100,7 @@ private void menuDefaultRunner_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(null, runner, null); if (result == DialogResult.OK) { - File.WriteAllText(file, runner.Code); + Helper.WriteAnsiFile(file, runner.Code); menuDefaultRunner.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -5118,7 +5114,7 @@ private void menuDefaultRouterConfig_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(null, routerConfig, null); if (result == DialogResult.OK) { - File.WriteAllText(file, routerConfig.Code); + Helper.WriteAnsiFile(file, routerConfig.Code); menuDefaultRouterConfig.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -5132,7 +5128,7 @@ private void menuDefaultRouterScript_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(null, routercgi, null); if (result == DialogResult.OK) { - File.WriteAllText(file, routercgi.Code); + Helper.WriteAnsiFile(file, routercgi.Code); menuDefaultRouterScript.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -5154,7 +5150,7 @@ private void menuRouterConfig_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(null, routerConfig, null); if (result == DialogResult.OK) { - File.WriteAllText(file, routerConfig.Code); + Helper.WriteAnsiFile(file, routerConfig.Code); menuRouterConfig.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -5179,7 +5175,7 @@ private void menuRouterScript_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(null, routercgi, null); if (result == DialogResult.OK) { - File.WriteAllText(file, routercgi.Code); + Helper.WriteAnsiFile(file, routercgi.Code); menuRouterScript.Image = new Bitmap(Properties.Resources.EditedScript); } } @@ -5253,8 +5249,10 @@ private void portConfigToolStripMenuItem_Click(object sender, EventArgs e) } //Save the INI protocol file - var fileParser = new FileIniDataParser(parser); - fileParser.WriteFile(protocolFile, portConfigData); + Helper.WriteAnsiFile(protocolFile, portConfigData.ToString()); + //var fileParser = new FileIniDataParser(parser); + //fileParser.WriteFile(protocolFile, portConfigData, Encoding.GetEncoding(1252)); + //Update the Resource file if (resource == null) resource = JsonConvert.DeserializeObject("{}"); @@ -5455,8 +5453,9 @@ private void EditPackageConfig(string pkgType, string doc) } //Save the INI protocol file - var fileParser = new FileIniDataParser(parser); - fileParser.WriteFile(pkgConfigFile, pkgConfig); + //var fileParser = new FileIniDataParser(parser); + //fileParser.WriteFile(pkgConfigFile, pkgConfig); + Helper.WriteAnsiFile(pkgConfigFile, pkgConfig.ToString()); } else { diff --git a/Mods/Forms/Parameters.cs b/Mods/Forms/Parameters.cs index 3c99bfd..65f7c53 100644 --- a/Mods/Forms/Parameters.cs +++ b/Mods/Forms/Parameters.cs @@ -274,7 +274,7 @@ private void buttonEditDSMReleases_Click(object sender, EventArgs e) DialogResult result = Helper.ScriptEditor(null, dsmRelease, null); if (result == DialogResult.OK) { - File.WriteAllText(dsmReleases, dsmRelease.Code); + Helper.WriteAnsiFile(dsmReleases, dsmRelease.Code); } } } diff --git a/Mods/Helpers/Helper.cs b/Mods/Helpers/Helper.cs index d4562b2..189d4f9 100644 --- a/Mods/Helpers/Helper.cs +++ b/Mods/Helpers/Helper.cs @@ -1130,6 +1130,19 @@ public static void ValidateFirmware(TextBox sender, CancelEventArgs e, ErrorProv } } + public static void WriteAnsiFile(string path, string content) + { + if (string.IsNullOrEmpty(content)) + content = string.Empty; + else + content = content.Replace("\r\n", "\n"); + + using (TextWriter text = new StreamWriter(path, false, Encoding.GetEncoding(1252))) + { + text.Write(content); + } + } + public static string Unquote(string text) { if (text != null) diff --git a/Mods/Program.cs b/Mods/Program.cs index c3abbd6..7b011bd 100644 --- a/Mods/Program.cs +++ b/Mods/Program.cs @@ -41,6 +41,10 @@ static void Main(string[] args) else { string open = null; + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + var edit = args.SingleOrDefault(arg => arg.StartsWith("edit:")); if (!string.IsNullOrEmpty(edit)) { @@ -56,22 +60,22 @@ static void Main(string[] args) // 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)) - File.WriteAllText(defaultRunnerPath, Properties.Settings.Default.Ps_Exec); + Helper.WriteAnsiFile(defaultRunnerPath, Properties.Settings.Default.Ps_Exec); // 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)) - File.WriteAllText(defaultRouterConfigPath, Properties.Settings.Default.dsm_cgi); + Helper.WriteAnsiFile(defaultRouterConfigPath, Properties.Settings.Default.dsm_cgi); // Load the Router Script or create one if it does not exist var defaultRouterScriptPath = Path.Combine(Helper.ResourcesDirectory, "router.cgi"); if (!File.Exists(defaultRouterScriptPath)) - File.WriteAllText(defaultRouterScriptPath, Properties.Settings.Default.router_cgi); + Helper.WriteAnsiFile(defaultRouterScriptPath, Properties.Settings.Default.router_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)) - File.WriteAllText(defaultDSMReleases, Properties.Settings.Default.dsm_releases); + Helper.WriteAnsiFile(defaultDSMReleases, Properties.Settings.Default.dsm_releases); // Extract the WizardUI background image if it does not exist var backWizard = Path.Combine(Helper.ResourcesDirectory, "backwizard.png"); @@ -81,8 +85,6 @@ static void Main(string[] args) backWizardPng.Save(backWizard); } - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm(open)); } } diff --git a/Mods/Resources/Pack.cmd b/Mods/Resources/Pack.cmd index 1cf2135..984662a 100644 --- a/Mods/Resources/Pack.cmd +++ b/Mods/Resources/Pack.cmd @@ -12,7 +12,7 @@ if errorlevel 1 ( move package.tgz ..\ cd .. Mods.exe hash:. -7z.exe a -ttar mods.spk package.tgz scripts WIZARD_UIFILES CHANGELOG INFO LICENSE PACKAGE_ICON*.PNG screen_*.png +7z.exe a -ttar mods.spk package.tgz conf scripts WIZARD_UIFILES CHANGELOG INFO LICENSE PACKAGE_ICON*.PNG screen_*.png if errorlevel 1 ( cd .. echo Error while creating package.