first commit
This commit is contained in:
6
MxFilterGen2/App.config
Normal file
6
MxFilterGen2/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
||||
259
MxFilterGen2/Compiler/Section.cs
Normal file
259
MxFilterGen2/Compiler/Section.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MxFilterGen2.Compiler
|
||||
{
|
||||
public class Block
|
||||
{
|
||||
public string Type { get; set; }
|
||||
public bool Show { get; set; }
|
||||
public List<object> Class { get; set; }
|
||||
public List<object> BaseType { get; set; }
|
||||
public List<string> SetTextColor { get; set; }
|
||||
public List<string> SetBackgroundColor { get; set; }
|
||||
public List<string> SetBorderColor { get; set; }
|
||||
public string SetFontSize { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
public List<Action> Actions { get; set; }
|
||||
}
|
||||
|
||||
public class Condition
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string op { get; set; }
|
||||
public string value { get; set; }
|
||||
}
|
||||
|
||||
public class Action
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string va { get; set; }
|
||||
public string vb { get; set; }
|
||||
public string vc { get; set; }
|
||||
public string vd { get; set; }
|
||||
}
|
||||
|
||||
public class RootBlocks
|
||||
{
|
||||
public List<Block> blocks { get; set; }
|
||||
}
|
||||
internal class section
|
||||
{
|
||||
public static string outpath = "";
|
||||
private static string iC;
|
||||
private static string iB;
|
||||
public static void Compile(string section, string filter)
|
||||
{
|
||||
if (File.Exists(outpath)) { File.Delete($"out/{section}.filter"); }
|
||||
|
||||
//DoSplash(filter, section);
|
||||
|
||||
string filson = $"filson/{section}.json";
|
||||
|
||||
//Message.CMW($"[{filter}] Block(s): {JsonConvert.DeserializeObject<RootBlocks>(File.ReadAllText(filson, Encoding.UTF8)).blocks.Count}", true, 2);
|
||||
|
||||
foreach (Block bl in JsonConvert.DeserializeObject<RootBlocks>(File.ReadAllText(filson, Encoding.UTF8)).blocks)
|
||||
{
|
||||
string blocktype = bl.Type;
|
||||
outpath = $"out/{filter}/{section}.filter";
|
||||
DoCompile(bl, blocktype, filter);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoSplash(string filter, string section)
|
||||
{
|
||||
string outp = $"out/{filter}/{section}.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}");
|
||||
File.AppendAllText(outp, $"#### MxGit: https://mxgit.ovh/mikx/PoE-MxFilterGen2{Environment.NewLine}");
|
||||
File.AppendAllText(outp, $"#### MxPoE: https://mxpoe.ovh/{Environment.NewLine}");
|
||||
File.AppendAllText(outp, $"#### Contact: mikx@mxpoe.ovh / http://discord.mxg.ovh{Environment.NewLine}");
|
||||
}
|
||||
|
||||
public static void DoCompile(Block bl, string bltype, string type)
|
||||
{
|
||||
////////// Skip a line //////////
|
||||
File.AppendAllText(outpath, Environment.NewLine);
|
||||
////////// Show or Hide //////////
|
||||
string bshow = "";
|
||||
if (bl.Show) { bshow = "Show"; } else { bshow = "Hide"; };
|
||||
if (bltype == "Normal" && type == "Strict") { bshow = "Hide"; }
|
||||
File.AppendAllText(outpath, bshow + Environment.NewLine);
|
||||
////////// Class //////////
|
||||
if (bl.Class != null)
|
||||
{
|
||||
foreach (var c in bl.Class) { iC += string.Format(@" ""{0}""", c); }
|
||||
if (iC != "")
|
||||
{
|
||||
File.AppendAllText(outpath, $" Class {iC} {Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
////////// Base //////////
|
||||
if (bl.BaseType != null)
|
||||
{
|
||||
foreach (var b in bl.BaseType) { iB += string.Format(@" ""{0}""", b); }
|
||||
if (iB != "")
|
||||
{
|
||||
File.AppendAllText(outpath, $" BaseType {iB} {Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
////////// SetTextColor //////////
|
||||
if (bl.SetTextColor[0] != null)
|
||||
{
|
||||
File.AppendAllText(outpath, $" SetTextColor {bl.SetTextColor[0]} {Environment.NewLine}");
|
||||
}
|
||||
////////// SetBackgroundColor //////////
|
||||
if (bl.SetBackgroundColor[0] != null)
|
||||
{
|
||||
File.AppendAllText(outpath, $" SetBackgroundColor {bl.SetBackgroundColor[0]} {Environment.NewLine}");
|
||||
}
|
||||
////////// SetBorderColor //////////
|
||||
if (bl.SetBorderColor[0] != null)
|
||||
{
|
||||
File.AppendAllText(outpath, $" SetBorderColor {bl.SetBorderColor[0]} {Environment.NewLine}");
|
||||
}
|
||||
////////// SetFontSize //////////
|
||||
if (bl.SetFontSize != null)
|
||||
{
|
||||
File.AppendAllText(outpath, " SetFontSize " + bl.SetFontSize + Environment.NewLine);
|
||||
}
|
||||
////////// Conditions //////////
|
||||
foreach (var con in bl.Conditions)
|
||||
{
|
||||
string cn = con.name;
|
||||
string co = con.op;
|
||||
var cv = con.value;
|
||||
switch (con.name)
|
||||
{
|
||||
case "AreaLevel":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "ItemLevel":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "DropLevel":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Quality":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Rarity":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "LinkedSockets":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "SocketGroup":
|
||||
File.AppendAllText(outpath, $" {cn} {co} \"{cv}\" {Environment.NewLine}");
|
||||
break;
|
||||
case "Sockets":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Height":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Width":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "HasExplicitMod":
|
||||
File.AppendAllText(outpath, $" {cn} \"{cv}\" {Environment.NewLine}");
|
||||
break;
|
||||
case "AnyEnchantment":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "StackSize":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "GemLevel":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "GemQualityType":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "AlternateQuality":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Identified":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Corrupted":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "Mirrored":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "ElderItem":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "ShaperItem":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "HasInfluence":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "FracturedItem":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "SynthesisedItem":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "BlightedMap":
|
||||
File.AppendAllText(outpath, $" {cn} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
case "MapTier":
|
||||
File.AppendAllText(outpath, $" {cn} {co} {cv} {Environment.NewLine}");
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
////////// Actions //////////
|
||||
if (bltype == "Normal" && type == "Strict")
|
||||
{
|
||||
// No Action
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var ac in bl.Actions)
|
||||
{
|
||||
string an;
|
||||
string ava;
|
||||
string avb;
|
||||
string avc;
|
||||
string avd;
|
||||
an = ac.name;
|
||||
ava = "";
|
||||
avb = "";
|
||||
avc = "";
|
||||
avd = "";
|
||||
if (ava != null) { ava = ac.va; }
|
||||
if (avb != null) { avb = ac.vb; }
|
||||
if (avc != null) { avc = ac.vc; }
|
||||
if (avd != null) { avd = ac.vd; }
|
||||
switch (ac.name)
|
||||
{
|
||||
case "PlayAlertSound":
|
||||
File.AppendAllText(outpath, $" {an} {ava} {avb} {Environment.NewLine}");
|
||||
break;
|
||||
case "CustomAlertSound":
|
||||
File.AppendAllText(outpath, $" {an} \"{ava}\" {Environment.NewLine}");
|
||||
break;
|
||||
case "MinimapIcon":
|
||||
File.AppendAllText(outpath, $" {an} {ava} {avb} {avc} {Environment.NewLine}");
|
||||
break;
|
||||
case "PlayEffect":
|
||||
File.AppendAllText(outpath, $" {an} {ava} {avb} {Environment.NewLine}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
iB = "";
|
||||
iC = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
25
MxFilterGen2/IO/Cleaner.cs
Normal file
25
MxFilterGen2/IO/Cleaner.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MxFilterGen2.IO
|
||||
{
|
||||
internal class Cleaner
|
||||
{
|
||||
public static void CleanOut()
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
MxFilterGen2/IO/Creator.cs
Normal file
23
MxFilterGen2/IO/Creator.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MxFilterGen2.IO
|
||||
{
|
||||
internal class Creator
|
||||
{
|
||||
public static void CreateBaseDir()
|
||||
{
|
||||
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/{f}")) { Directory.CreateDirectory($"out/{f}"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
MxFilterGen2/JSON/Settings.cs
Normal file
55
MxFilterGen2/JSON/Settings.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MxFilterGen2.JSON
|
||||
{
|
||||
internal class SETTINGS
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool Install { get; set; }
|
||||
public List<string> Types { get; set; }
|
||||
public List<string> Structures { get; set; }
|
||||
|
||||
}
|
||||
|
||||
class settings
|
||||
{
|
||||
internal static string GetName()
|
||||
{
|
||||
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($"settings.json"));
|
||||
return j.Name;
|
||||
}
|
||||
internal static bool GetInstall()
|
||||
{
|
||||
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($"settings.json"));
|
||||
return j.Install;
|
||||
}
|
||||
internal static List<string> GetType()
|
||||
{
|
||||
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($"settings.json"));
|
||||
return j.Types;
|
||||
}
|
||||
internal static List<string> GetStructure()
|
||||
{
|
||||
SETTINGS j = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($"settings.json"));
|
||||
return j.Structures;
|
||||
}
|
||||
|
||||
public static void WriteSection(string structure)
|
||||
{
|
||||
SETTINGS js = JsonConvert.DeserializeObject<SETTINGS>(File.ReadAllText($"settings.json"));
|
||||
SETTINGS se = new SETTINGS
|
||||
{
|
||||
Structures = js.Structures
|
||||
};
|
||||
var raw = JsonConvert.SerializeObject(se, Formatting.Indented);
|
||||
File.WriteAllText($"settings.json", raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
219
MxFilterGen2/Message.cs
Normal file
219
MxFilterGen2/Message.cs
Normal file
@@ -0,0 +1,219 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MxFilterGen2
|
||||
{
|
||||
internal class Message
|
||||
{
|
||||
public static void CM(string msg, bool time, int color)
|
||||
{
|
||||
DateTime now;
|
||||
string str1;
|
||||
int num;
|
||||
if (DateTime.Now.Second < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str1 = string.Format("0{0}", (object)now.Second);
|
||||
}
|
||||
else
|
||||
{
|
||||
num = DateTime.Now.Second;
|
||||
str1 = num.ToString();
|
||||
}
|
||||
now = DateTime.Now;
|
||||
string str2;
|
||||
if (now.Minute < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str2 = string.Format("0{0}", (object)now.Minute);
|
||||
}
|
||||
else
|
||||
{
|
||||
now = DateTime.Now;
|
||||
num = now.Minute;
|
||||
str2 = num.ToString();
|
||||
}
|
||||
now = DateTime.Now;
|
||||
string str3;
|
||||
if (now.Hour < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str3 = string.Format("0{0}", (object)now.Hour);
|
||||
}
|
||||
else
|
||||
{
|
||||
now = DateTime.Now;
|
||||
num = now.Hour;
|
||||
str3 = num.ToString();
|
||||
}
|
||||
string str4 = string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1);
|
||||
ConsoleColor consoleColor = ConsoleColor.White;
|
||||
switch (color)
|
||||
{
|
||||
case 1:
|
||||
consoleColor = ConsoleColor.Cyan;
|
||||
break;
|
||||
case 2:
|
||||
consoleColor = ConsoleColor.Green;
|
||||
break;
|
||||
case 3:
|
||||
consoleColor = ConsoleColor.Red;
|
||||
break;
|
||||
}
|
||||
if (time)
|
||||
{
|
||||
Console.ForegroundColor = consoleColor;
|
||||
Console.WriteLine(string.Format("[{0}] {1}", (object)str4, (object)msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ForegroundColor = consoleColor;
|
||||
Console.WriteLine(string.Format("{0}", (object)msg));
|
||||
}
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
}
|
||||
|
||||
public static void CMW(string msg, bool time, int color)
|
||||
{
|
||||
DateTime now;
|
||||
string str1;
|
||||
int num;
|
||||
if (DateTime.Now.Second < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str1 = string.Format("0{0}", (object)now.Second);
|
||||
}
|
||||
else
|
||||
{
|
||||
num = DateTime.Now.Second;
|
||||
str1 = num.ToString();
|
||||
}
|
||||
now = DateTime.Now;
|
||||
string str2;
|
||||
if (now.Minute < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str2 = string.Format("0{0}", (object)now.Minute);
|
||||
}
|
||||
else
|
||||
{
|
||||
now = DateTime.Now;
|
||||
num = now.Minute;
|
||||
str2 = num.ToString();
|
||||
}
|
||||
now = DateTime.Now;
|
||||
string str3;
|
||||
if (now.Hour < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str3 = string.Format("0{0}", (object)now.Hour);
|
||||
}
|
||||
else
|
||||
{
|
||||
now = DateTime.Now;
|
||||
num = now.Hour;
|
||||
str3 = num.ToString();
|
||||
}
|
||||
string str4 = string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1);
|
||||
File.AppendAllText("mxfiltergen.logs", string.Format("[{0}] {1}", (object)str4, (object)msg) + Environment.NewLine);
|
||||
ConsoleColor consoleColor = ConsoleColor.White;
|
||||
switch (color)
|
||||
{
|
||||
case 1:
|
||||
consoleColor = ConsoleColor.Cyan;
|
||||
break;
|
||||
case 2:
|
||||
consoleColor = ConsoleColor.Green;
|
||||
break;
|
||||
case 3:
|
||||
consoleColor = ConsoleColor.Red;
|
||||
break;
|
||||
}
|
||||
if (time)
|
||||
{
|
||||
Console.ForegroundColor = consoleColor;
|
||||
Console.WriteLine(string.Format("[{0}] {1}", (object)str4, (object)msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ForegroundColor = consoleColor;
|
||||
Console.WriteLine(string.Format(""));
|
||||
}
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
}
|
||||
|
||||
public static void drawProgress(int progress, int total)
|
||||
{
|
||||
DateTime now;
|
||||
string str1;
|
||||
int num;
|
||||
if (DateTime.Now.Second < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str1 = string.Format("0{0}", (object)now.Second);
|
||||
}
|
||||
else
|
||||
{
|
||||
num = DateTime.Now.Second;
|
||||
str1 = num.ToString();
|
||||
}
|
||||
now = DateTime.Now;
|
||||
string str2;
|
||||
if (now.Minute < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str2 = string.Format("0{0}", (object)now.Minute);
|
||||
}
|
||||
else
|
||||
{
|
||||
now = DateTime.Now;
|
||||
num = now.Minute;
|
||||
str2 = num.ToString();
|
||||
}
|
||||
now = DateTime.Now;
|
||||
string str3;
|
||||
if (now.Hour < 10)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
str3 = string.Format("0{0}", (object)now.Hour);
|
||||
}
|
||||
else
|
||||
{
|
||||
now = DateTime.Now;
|
||||
num = now.Hour;
|
||||
str3 = num.ToString();
|
||||
}
|
||||
string str4 = string.Format("[{0}] [", (object)string.Format("{0}:{1}:{2}", (object)str3, (object)str2, (object)str1));
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
if (progress == 1)
|
||||
{
|
||||
Console.Write(str4);
|
||||
Console.CursorLeft = total + str4.Length;
|
||||
Console.Write("]");
|
||||
}
|
||||
Console.CursorLeft = progress + str4.Length - 1;
|
||||
Console.Write("#");
|
||||
Console.CursorLeft = str4.Length + total + 2;
|
||||
Console.Write(string.Format("{0}/{1}", (object)progress, (object)total));
|
||||
if (progress != total)
|
||||
return;
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
public static void Splash(string progname, string dev)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine($"#### {progname}");
|
||||
Console.WriteLine(string.Format("#### VERSION: {0}", (object)Program.version));
|
||||
Console.WriteLine($"#### DEV: {dev}");
|
||||
Console.WriteLine("#### POWERED BY: poe.ninja");
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
65
MxFilterGen2/MxFilterGen2.csproj
Normal file
65
MxFilterGen2/MxFilterGen2.csproj
Normal file
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C109AB79-2BB7-4CE9-89FB-004B44FA6206}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>MxFilterGen2</RootNamespace>
|
||||
<AssemblyName>MxFilterGen2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Compiler\Section.cs" />
|
||||
<Compile Include="IO\Cleaner.cs" />
|
||||
<Compile Include="IO\Creator.cs" />
|
||||
<Compile Include="JSON\Settings.cs" />
|
||||
<Compile Include="Message.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Web\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
55
MxFilterGen2/Program.cs
Normal file
55
MxFilterGen2/Program.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MxFilterGen2
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
public static string version = "1.0.0";
|
||||
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())
|
||||
{
|
||||
Message.CMW($"Section: {s}",true,2);
|
||||
foreach (string f in JSON.settings.GetType())
|
||||
{
|
||||
Compiler.section.Compile(s, f);
|
||||
}
|
||||
}
|
||||
|
||||
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}");
|
||||
File.AppendAllText(outp, $"#### MxGit: https://mxgit.ovh/mikx/PoE-MxFilterGen2{Environment.NewLine}");
|
||||
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}");
|
||||
}
|
||||
File.AppendAllText(outp, $"{Environment.NewLine}");
|
||||
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")));
|
||||
File.AppendAllText("out/" + fname + "_" + f + ".filter", Environment.NewLine ?? "");
|
||||
}
|
||||
}
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
33
MxFilterGen2/Properties/AssemblyInfo.cs
Normal file
33
MxFilterGen2/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Les informations générales relatives à un assembly dépendent de
|
||||
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
|
||||
// associées à un assembly.
|
||||
[assembly: AssemblyTitle("MxFilterGen2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MxFilterGen2")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
|
||||
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
|
||||
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
|
||||
[assembly: Guid("c109ab79-2bb7-4ce9-89fb-004b44fa6206")]
|
||||
|
||||
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
|
||||
//
|
||||
// Version principale
|
||||
// Version secondaire
|
||||
// Numéro de build
|
||||
// Révision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
4
MxFilterGen2/packages.config
Normal file
4
MxFilterGen2/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user