diff --git a/Form1.Designer.cs b/Form1.Designer.cs index d5de002..dc3c6b9 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -342,9 +342,9 @@ private void InitializeComponent() this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(778, 500); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(35, 13); + this.label1.Size = new System.Drawing.Size(16, 13); this.label1.TabIndex = 14; - this.label1.Text = "label1"; + this.label1.Text = "v."; // // Form1 // diff --git a/Form1.cs b/Form1.cs index 71ceaef..c93707d 100644 --- a/Form1.cs +++ b/Form1.cs @@ -31,7 +31,7 @@ public Form1() private void Form1_Load(object sender, EventArgs e) { this.logic = new MainLogic(); - if (logic.TryLoadInstallDir()) + if (logic.TryLoadProgramData()) { this.textBox1.Text = logic.BasePath; LoadAndFill(false); @@ -143,6 +143,7 @@ private void SetVersionAndVender() //Load mod data and fill in the list box.. private void LoadAndFill(bool FromClipboard) { + KeyValuePair currentEntry = new KeyValuePair(); try { if (FromClipboard) @@ -151,6 +152,7 @@ private void LoadAndFill(bool FromClipboard) logic.Loadstuff(); foreach (KeyValuePair entry in logic.ModList) { + currentEntry = entry; string modName = entry.Key; ListViewItem item1 = new ListViewItem("", 0); item1.Checked = entry.Value; @@ -161,23 +163,12 @@ private void LoadAndFill(bool FromClipboard) listView1.Items.Add(item1); } - this.logic.ProgramData.installdir = logic.BasePath; - this.logic.ProgramData.vendor = logic.Vendor; - - string systemPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); - string complete = Path.Combine(systemPath, @"MW5LoadOrderManager"); - JsonSerializer serializer = new JsonSerializer(); - serializer.Formatting = Formatting.Indented; - using (StreamWriter sw = new StreamWriter(complete + @"\ProgramData.json")) - using (JsonWriter writer = new JsonTextWriter(sw)) - { - serializer.Serialize(writer, logic.ProgramData); - } + logic.SaveProgramData(); } catch (Exception e) { Console.WriteLine(e.StackTrace); - string message = "While loading and parsing mod.json files some unknown error has occurred, please contact the developer with a screen shot of the editor, the error message and your mod folder."; + string message = "While loading " + currentEntry.Key.ToString() + "something went wrong."; string caption = "Error Loading"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); @@ -269,7 +260,7 @@ private void button5_Click(object sender, EventArgs e) private void button6_Click(object sender, EventArgs e) { ClearAll(); - if (logic.TryLoadInstallDir()) + if (logic.TryLoadProgramData()) { LoadAndFill(false); } diff --git a/Program.cs b/Program.cs index c6a7acb..ecdd641 100644 --- a/Program.cs +++ b/Program.cs @@ -15,7 +15,6 @@ static class Program { /// /// The main entry point for the application. - /// /// [STAThread] static void Main() @@ -40,17 +39,20 @@ private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object s public class MainLogic { public float Version = 0f; - public ProgramData ProgramData = new ProgramData(); public string Vendor = ""; - public bool CreatedModlist = false; - public JObject parent; - public string CurrentFolderInsearch; - public bool InterruptSearch = false; public string BasePath = ""; + public ProgramData ProgramData = new ProgramData(); + + public JObject parent; public string[] Directories; - public Dictionary ModList = new Dictionary(); public Dictionary ModDetails = new Dictionary(); + public Dictionary ModList = new Dictionary(); + public bool CreatedModlist = false; + + public string CurrentFolderInsearch; + public bool InterruptSearch = false; + public string rawJson; public void Loadstuff() @@ -98,8 +100,8 @@ private bool CheckModsDir() return true; } - //Try and load install dir path from stored data files. - public bool TryLoadInstallDir() + //Try and load data from previous sessions + public bool TryLoadProgramData() { //Load install dir from previous session: string systemPath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); @@ -171,6 +173,21 @@ public void ParseDirectories() } } + public void SaveProgramData() + { + this.ProgramData.installdir = this.BasePath; + this.ProgramData.vendor = this.Vendor; + + string complete = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\MW5LoadOrderManager"; + JsonSerializer serializer = new JsonSerializer(); + serializer.Formatting = Formatting.Indented; + using (StreamWriter sw = new StreamWriter(complete + @"\ProgramData.json")) + using (JsonWriter writer = new JsonTextWriter(sw)) + { + serializer.Serialize(writer, this.ProgramData); + } + } + public void ModListParser() { try diff --git a/bin/Release/MW5 Mod Manager.application b/bin/Release/MW5 Mod Manager.application index 26eb080..a620824 100644 --- a/bin/Release/MW5 Mod Manager.application +++ b/bin/Release/MW5 Mod Manager.application @@ -14,7 +14,7 @@ - pQ4Z5saC0ZsKnLQMujhCZ1Bj9YdU+eBrAHs/5afNacs= + +WoJeX8CLFZaQLRCBVhncFF8S6riVOc+Zdk2C3lPgvo= diff --git a/bin/Release/MW5 Mod Manager.exe b/bin/Release/MW5 Mod Manager.exe index b3cba33..84837c0 100644 Binary files a/bin/Release/MW5 Mod Manager.exe and b/bin/Release/MW5 Mod Manager.exe differ diff --git a/bin/Release/MW5 Mod Manager.exe.manifest b/bin/Release/MW5 Mod Manager.exe.manifest index 095e19f..8ea0646 100644 --- a/bin/Release/MW5 Mod Manager.exe.manifest +++ b/bin/Release/MW5 Mod Manager.exe.manifest @@ -50,7 +50,7 @@ - 5f2645K64RbzU46ExxaXZ/PMWKb20PxHivMPY1NhJP8= + OntH1UoVcIt1v8ZEIe5AoleXbenDSItWktWW5XIWY9o= diff --git a/bin/Release/app.publish/MW5 Mod Manager.exe b/bin/Release/app.publish/MW5 Mod Manager.exe index b3cba33..84837c0 100644 Binary files a/bin/Release/app.publish/MW5 Mod Manager.exe and b/bin/Release/app.publish/MW5 Mod Manager.exe differ