first commit
This commit is contained in:
commit
65714e77ad
|
@ -0,0 +1,261 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
#*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignoreable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35327.3
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MxFilterGen2", "MxFilterGen2\MxFilterGen2.csproj", "{C109AB79-2BB7-4CE9-89FB-004B44FA6206}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C109AB79-2BB7-4CE9-89FB-004B44FA6206}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C109AB79-2BB7-4CE9-89FB-004B44FA6206}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C109AB79-2BB7-4CE9-89FB-004B44FA6206}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C109AB79-2BB7-4CE9-89FB-004B44FA6206}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1CF617F3-4420-4E63-85D7-0D34CAB76761}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
</configuration>
|
|
@ -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 = "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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}"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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")]
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
</packages>
|
|
@ -0,0 +1,9 @@
|
|||
## MxFilterGen
|
||||
MxFilterGen2 is my Path of Exile 2 "Item Filter" Generator.
|
||||
|
||||
## Installation
|
||||
- Install Visual Studio 2019 (Community or paid.) or newer.
|
||||
- Get the source, put it inside a folder and open it.
|
||||
- Build and copy the executable to a dedicated folder.
|
||||
- Launch it, close it and edit the settings.json file.
|
||||
- You are now ready to use it!
|
Loading…
Reference in New Issue