diff --git a/MxFilterGen2/DB/MySql.cs b/MxFilterGen2/DB/MySql.cs index 7b2317c..4028338 100644 --- a/MxFilterGen2/DB/MySql.cs +++ b/MxFilterGen2/DB/MySql.cs @@ -14,7 +14,7 @@ namespace MxFilterGen2.DB MySqlConnection conn; string myConnectionString; - myConnectionString = $"server={JSON.settings.GetdbHost()};port={JSON.settings.GetdbPort()};uid={JSON.settings.GetdbUser()};pwd={JSON.settings.GetdbPass()};database={JSON.settings.GetdbName()};"; + myConnectionString = $"server={JSON.Settings.GetdbHost()};port={JSON.Settings.GetdbPort()};uid={JSON.Settings.GetdbUser()};pwd={JSON.Settings.GetdbPass()};database={JSON.Settings.GetdbName()};"; conn = new MySqlConnection(); conn.ConnectionString = myConnectionString; return conn; diff --git a/MxFilterGen2/IO/Cleaner.cs b/MxFilterGen2/IO/Cleaner.cs index 9d42357..ab0a607 100644 --- a/MxFilterGen2/IO/Cleaner.cs +++ b/MxFilterGen2/IO/Cleaner.cs @@ -11,14 +11,14 @@ namespace MxFilterGen2.IO { public static void CleanOut() { - foreach (string f in JSON.settings.GetType()) + foreach (string f in JSON.Settings.GetType()) { String[] files = Directory.GetFiles($"out/{f}", "*.*"); foreach (String file in files) { File.Delete(file); } - File.Delete($"out/{JSON.settings.GetName()}_{f}.filter"); + File.Delete($"out/{JSON.Settings.GetName()}_{f}.filter"); } var gens = Directory.GetFiles("out/Gen"); foreach (var g in gens) diff --git a/MxFilterGen2/IO/Creator.cs b/MxFilterGen2/IO/Creator.cs index 80fdc70..d5b9082 100644 --- a/MxFilterGen2/IO/Creator.cs +++ b/MxFilterGen2/IO/Creator.cs @@ -14,7 +14,8 @@ namespace MxFilterGen2.IO Message.CMW($"Checking and creating the base directories...", true, 2); if (!Directory.Exists($"filson")) { Directory.CreateDirectory($"filson"); } if (!Directory.Exists($"out")) { Directory.CreateDirectory($"out"); } - foreach (string f in JSON.settings.GetType()) + if (!Directory.Exists($"out/Gen")) { Directory.CreateDirectory($"out/Gen"); } + foreach (string f in JSON.Settings.GetType()) { if (!Directory.Exists($"out/{f}")) { Directory.CreateDirectory($"out/{f}"); } } diff --git a/MxFilterGen2/JSON/Settings.cs b/MxFilterGen2/JSON/Settings.cs index 4387a0c..f678871 100644 --- a/MxFilterGen2/JSON/Settings.cs +++ b/MxFilterGen2/JSON/Settings.cs @@ -23,7 +23,7 @@ namespace MxFilterGen2.JSON } - class settings + class Settings { public static string GetdbHost() => JsonConvert.DeserializeObject(File.ReadAllText("settings.json")).dbHost; public static string GetdbPort() => JsonConvert.DeserializeObject(File.ReadAllText("settings.json")).dbPort; diff --git a/MxFilterGen2/Program.cs b/MxFilterGen2/Program.cs index 24ef7a4..b25ff61 100644 --- a/MxFilterGen2/Program.cs +++ b/MxFilterGen2/Program.cs @@ -3,26 +3,27 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace MxFilterGen2 { internal class Program { - public static string version = "1.1.1"; + public static string version = "1.1.2"; public static string docpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); static void Main(string[] args) { Message.Splash("MxFilterGen2", "mikx"); IO.Cleaner.CleanOut(); IO.Creator.CreateBaseDir(); - string fname = JSON.settings.GetName(); - foreach (string s in JSON.settings.GetStructure()) + string fname = JSON.Settings.GetName(); + foreach (string s in JSON.Settings.GetStructure()) { if (s != "GEN") { Message.CMW($"Section: {s}", true, 2); - foreach (string f in JSON.settings.GetType()) + foreach (string f in JSON.Settings.GetType()) { Compiler.section.Compile(s, f); } @@ -47,13 +48,13 @@ namespace MxFilterGen2 string genstring = ""; foreach (var g in gens) { - foreach (string f in JSON.settings.GetType()) + foreach (string f in JSON.Settings.GetType()) { File.AppendAllText($"out/{f}/GEN.filter",File.ReadAllText(g)); } } - foreach (string f in JSON.settings.GetType()) + foreach (string f in JSON.Settings.GetType()) { Message.CMW($"Creating the {f} filter...", true, 2); string outp = "out/" + fname + "_" + f + ".filter"; @@ -65,12 +66,12 @@ namespace MxFilterGen2 File.AppendAllText(outp, $"#### Contact: mikx@mxpoe.ovh / http://discord.mxg.ovh{Environment.NewLine}"); File.AppendAllText(outp, $"{Environment.NewLine}"); File.AppendAllText(outp, $"#### SECTIONS{Environment.NewLine}"); - foreach (var sspl in JSON.settings.GetStructure()) + foreach (var sspl in JSON.Settings.GetStructure()) { File.AppendAllText(outp, $"# {sspl}{Environment.NewLine}"); } File.AppendAllText(outp, $"{Environment.NewLine}"); - foreach (var structure in JSON.settings.GetStructure()) + foreach (var structure in JSON.Settings.GetStructure()) { File.AppendAllText("out/" + fname + "_" + f + ".filter", string.Format("#### SECTION: {0}", (object)structure) + Environment.NewLine); File.AppendAllText("out/" + fname + "_" + f + ".filter", File.ReadAllText(string.Format("out/" + f + "/" + structure + ".filter"))); @@ -78,12 +79,12 @@ namespace MxFilterGen2 } } - if (JSON.settings.GetInstall()) + if (JSON.Settings.GetInstall()) { Message.CMW($"Install is \"True\". Installing to the game directory...", true, 1); - foreach (string f in JSON.settings.GetType()) + foreach (string f in JSON.Settings.GetType()) { - File.Copy($"out/{JSON.settings.GetName()}_{f}.filter", $@"{docpath}\My Games\Path of Exile 2\{JSON.settings.GetName()}_{f}.filter", true); + File.Copy($"out/{JSON.Settings.GetName()}_{f}.filter", $@"{docpath}\My Games\Path of Exile 2\{JSON.Settings.GetName()}_{f}.filter", true); } foreach (var s in Directory.EnumerateFiles("sound")) { @@ -92,9 +93,11 @@ namespace MxFilterGen2 } } else { - int fc = JSON.settings.GetType().Count; + int fc = JSON.Settings.GetType().Count; Message.CMW($"Install is \"False\". Use the {fc} Filter(s) from the \"out\" directory.", true, 1); } + Message.CMW($"Waiting 5 seconds before exiting...", true, 1); + Thread.Sleep(5000); } } }