2024-12-23 18:42:50 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MxFilterGen2
|
|
|
|
|
{
|
|
|
|
|
internal class Program
|
|
|
|
|
{
|
2024-12-27 18:42:06 -05:00
|
|
|
|
public static string version = "1.1.1";
|
2024-12-27 17:05:41 -05:00
|
|
|
|
public static string docpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
2024-12-23 18:42:50 -05:00
|
|
|
|
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())
|
|
|
|
|
{
|
2024-12-27 17:05:41 -05:00
|
|
|
|
if (s != "GEN")
|
|
|
|
|
{
|
|
|
|
|
Message.CMW($"Section: {s}", true, 2);
|
|
|
|
|
foreach (string f in JSON.settings.GetType())
|
|
|
|
|
{
|
|
|
|
|
Compiler.section.Compile(s, f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Generator.Body.Gen();
|
|
|
|
|
Generator.Boots.Gen();
|
|
|
|
|
Generator.Bows.Gen();
|
|
|
|
|
Generator.Claws.Gen();
|
|
|
|
|
Generator.Daggers.Gen();
|
|
|
|
|
Generator.Focus.Gen();
|
|
|
|
|
Generator.Gloves.Gen();
|
|
|
|
|
Generator.Helmets.Gen();
|
|
|
|
|
Generator.OneHander.Gen();
|
|
|
|
|
Generator.Shields.Gen();
|
|
|
|
|
Generator.Staves.Gen();
|
|
|
|
|
Generator.TwoHander.Gen();
|
|
|
|
|
Generator.Wands.Gen();
|
|
|
|
|
|
|
|
|
|
var gens = Directory.GetFiles("out/Gen");
|
|
|
|
|
string genstring = "";
|
|
|
|
|
foreach (var g in gens)
|
|
|
|
|
{
|
2024-12-23 18:42:50 -05:00
|
|
|
|
foreach (string f in JSON.settings.GetType())
|
|
|
|
|
{
|
2024-12-27 17:05:41 -05:00
|
|
|
|
File.AppendAllText($"out/{f}/GEN.filter",File.ReadAllText(g));
|
2024-12-23 18:42:50 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (string f in JSON.settings.GetType())
|
|
|
|
|
{
|
|
|
|
|
Message.CMW($"Creating the {f} filter...", true, 2);
|
|
|
|
|
string outp = "out/" + fname + "_" + f + ".filter";
|
|
|
|
|
////////// Splash //////////
|
|
|
|
|
File.AppendAllText(outp, $"#### Filson - PoE2 Item Filter JSON Parsing - MxFilterGen2 v{Program.version}{Environment.NewLine}");
|
|
|
|
|
File.AppendAllText(outp, $"#### Filson and MxFilterGen2 are developped by mikx.{Environment.NewLine}");
|
2024-12-27 18:42:06 -05:00
|
|
|
|
File.AppendAllText(outp, $"#### MxGit: https://mxgit.ovh/mikx/PoE2-MxFilterGen2{Environment.NewLine}");
|
2024-12-23 18:42:50 -05:00
|
|
|
|
File.AppendAllText(outp, $"#### MxPoE: https://mxpoe.ovh/{Environment.NewLine}");
|
|
|
|
|
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())
|
|
|
|
|
{
|
|
|
|
|
File.AppendAllText(outp, $"# {sspl}{Environment.NewLine}");
|
|
|
|
|
}
|
2024-12-27 17:05:41 -05:00
|
|
|
|
File.AppendAllText(outp, $"{Environment.NewLine}");
|
2024-12-23 18:42:50 -05:00
|
|
|
|
foreach (var structure in JSON.settings.GetStructure())
|
2024-12-27 17:05:41 -05:00
|
|
|
|
{
|
2024-12-23 18:42:50 -05:00
|
|
|
|
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")));
|
|
|
|
|
File.AppendAllText("out/" + fname + "_" + f + ".filter", Environment.NewLine ?? "");
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-27 17:05:41 -05:00
|
|
|
|
|
|
|
|
|
if (JSON.settings.GetInstall())
|
|
|
|
|
{
|
|
|
|
|
Message.CMW($"Install is \"True\". Installing to the game directory...", true, 1);
|
|
|
|
|
foreach (string f in JSON.settings.GetType())
|
|
|
|
|
{
|
2024-12-27 18:42:06 -05:00
|
|
|
|
File.Copy($"out/{JSON.settings.GetName()}_{f}.filter", $@"{docpath}\My Games\Path of Exile 2\{JSON.settings.GetName()}_{f}.filter", true);
|
2024-12-27 17:05:41 -05:00
|
|
|
|
}
|
|
|
|
|
foreach (var s in Directory.EnumerateFiles("sound"))
|
|
|
|
|
{
|
|
|
|
|
string sf = Path.GetFileName(s);
|
|
|
|
|
File.Copy($"{s}", $@"{docpath}\My Games\Path of Exile 2\{sf}", true);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
int fc = JSON.settings.GetType().Count;
|
|
|
|
|
Message.CMW($"Install is \"False\". Use the {fc} Filter(s) from the \"out\" directory.", true, 1);
|
|
|
|
|
}
|
2024-12-23 18:42:50 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|