From 03ba36f6947d75e3101e20a3219c878a79139b6e Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 1 Jan 2024 22:48:17 +1100 Subject: [PATCH] Add //dotnetref comment so you can add dotnet build specific assembly references when compiling plugins in the dotnet build --- MCGalaxy/Economy/Economy.DB.cs | 12 ++++++++---- MCGalaxy/Modules/Compiling/Compiler.cs | 4 ++++ MCGalaxy/Modules/Compiling/CompilerBackends.cs | 4 ++++ MCGalaxy/Modules/Compiling/CompilerFrontends.cs | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/MCGalaxy/Economy/Economy.DB.cs b/MCGalaxy/Economy/Economy.DB.cs index 4c1cc4a69..4421371aa 100644 --- a/MCGalaxy/Economy/Economy.DB.cs +++ b/MCGalaxy/Economy/Economy.DB.cs @@ -65,12 +65,16 @@ namespace MCGalaxy.Eco } public static void UpdateMoney(string name, int money) { - PlayerDB.Update(name, PlayerData.ColumnMoney, money.ToString()); + PlayerDB.Update(name, PlayerData.ColumnMoney, + NumberUtils.StringifyInt(money)); } - public struct EcoStats { - public string Player, Purchase, Payment, Salary, Fine; public int TotalSpent, __unused; + public struct EcoStats + { + public string Player; + public string Purchase, Payment, Salary, Fine; + public int TotalSpent, __unused; } public static void UpdateStats(EcoStats stats) { @@ -81,7 +85,7 @@ namespace MCGalaxy.Eco static EcoStats ParseStats(ISqlRecord record) { EcoStats stats; - stats.Player = record.GetText("player"); + stats.Player = record.GetText("player"); stats.Payment = Parse(record.GetText("payment")); stats.Purchase = Parse(record.GetText("purchase")); stats.Salary = Parse(record.GetText("salary")); diff --git a/MCGalaxy/Modules/Compiling/Compiler.cs b/MCGalaxy/Modules/Compiling/Compiler.cs index 5ab2fc773..6a8e81247 100644 --- a/MCGalaxy/Modules/Compiling/Compiler.cs +++ b/MCGalaxy/Modules/Compiling/Compiler.cs @@ -156,6 +156,10 @@ namespace MCGalaxy.Modules.Compiling } else if (line.CaselessStarts(plgPrefix)) { path = Path.Combine(IScripting.PLUGINS_DLL_DIR, GetDLL(line)); referenced.Add(Path.GetFullPath(path)); +#if NETSTANDARD + } else if (line.CaselessStarts(commentPrefix + "dotnetref")) { + referenced.Add(GetDLL(line)); +#endif } else { continue; } diff --git a/MCGalaxy/Modules/Compiling/CompilerBackends.cs b/MCGalaxy/Modules/Compiling/CompilerBackends.cs index 33c0fe629..22b47a617 100644 --- a/MCGalaxy/Modules/Compiling/CompilerBackends.cs +++ b/MCGalaxy/Modules/Compiling/CompilerBackends.cs @@ -97,6 +97,10 @@ namespace MCGalaxy.Modules.Compiling { static Regex outputRegWithFileAndLine; static Regex outputRegSimple; + + public static List PrepareInput(string[] srcPaths) { + return ICompiler.ProcessInput(srcPaths, "//"); + } public static ICompilerErrors Compile(string[] srcPaths, string dstPath, List referenced) { string args = GetCommandLineArguments(srcPaths, dstPath, referenced); diff --git a/MCGalaxy/Modules/Compiling/CompilerFrontends.cs b/MCGalaxy/Modules/Compiling/CompilerFrontends.cs index 11987b616..3b31af4fa 100644 --- a/MCGalaxy/Modules/Compiling/CompilerFrontends.cs +++ b/MCGalaxy/Modules/Compiling/CompilerFrontends.cs @@ -43,7 +43,7 @@ namespace MCGalaxy.Modules.Compiling } #else protected override ICompilerErrors DoCompile(string[] srcPaths, string dstPath) { - List referenced = ProcessInput(srcPaths, "//"); + List referenced = RoslynCSharpCompiler.PrepareInput(srcPaths); return RoslynCSharpCompiler.Compile(srcPaths, dstPath, referenced); } #endif