mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
Added missing F functions set
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -290,7 +291,7 @@ internal class Program {
|
||||
|
||||
if(descrText != null) {
|
||||
|
||||
descrText = descrText.SanitizeLinebreakFormatting();
|
||||
descrText = descrText.SanitizeLinebreakFormatting().Replace("\"", "\\\"");
|
||||
|
||||
functionIns.Description = descrText;
|
||||
|
||||
@@ -318,10 +319,89 @@ internal class Program {
|
||||
|
||||
}
|
||||
|
||||
var funcsJson = JsonSerializer.Serialize(functions, new JsonSerializerOptions { WriteIndented = true });
|
||||
BuildFunctionNamesDictFile(functions);
|
||||
|
||||
File.WriteAllText("./function_names.json", funcsJson);
|
||||
}
|
||||
|
||||
static void BuildFunctionNamesDictFile (Dictionary<string, FPFunction> dict) {
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("using System.Collections.Generic;\n");
|
||||
sb.AppendLine("namespace MewtocolNet.AutoGeneratedData {\n");
|
||||
|
||||
sb.AppendLine("\tpublic class FPFunction {\n");
|
||||
|
||||
sb.AppendLine("\t\tpublic string RedundantName { get; private set; }\n");
|
||||
sb.AppendLine("\t\tpublic string Description { get; private set; }\n");
|
||||
sb.AppendLine("\t\tpublic Dictionary<string, string[]> ParametersIn { get; private set; }\n");
|
||||
sb.AppendLine("\t\tpublic Dictionary<string, string[]> ParametersOut { get; private set; }\n");
|
||||
|
||||
sb.AppendLine("\t\tpublic static readonly Dictionary<string, FPFunction> functions = new Dictionary<string, FPFunction> {\n");
|
||||
|
||||
foreach (var item in dict) {
|
||||
|
||||
sb.AppendLine($"\t\t\t{{ \"{item.Key}\", new FPFunction {{");
|
||||
|
||||
if(item.Value.RedundantName != null)
|
||||
sb.AppendLine($"\t\t\t\tRedundantName = \"{item.Value.RedundantName}\",");
|
||||
|
||||
if(item.Value.Description != null)
|
||||
sb.AppendLine($"\t\t\t\tDescription = \"{item.Value.Description}\",");
|
||||
|
||||
if (item.Value.ParametersIn != null) {
|
||||
|
||||
sb.AppendLine("\t\t\t\tParametersIn = new Dictionary<string, string[]> {");
|
||||
|
||||
foreach (var paramIn in item.Value.ParametersIn) {
|
||||
|
||||
sb.AppendLine($"\t\t\t\t\t{{ \"{paramIn.Key}\", new string[] {{");
|
||||
|
||||
foreach (var paramType in paramIn.Value) {
|
||||
|
||||
sb.AppendLine($"\t\t\t\t\t\t\"{paramType}\",");
|
||||
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t\t\t\t}},");
|
||||
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t\t\t},");
|
||||
|
||||
}
|
||||
|
||||
if (item.Value.ParametersOut != null) {
|
||||
|
||||
sb.AppendLine("\t\t\t\tParametersOut = new Dictionary<string, string[]> {");
|
||||
|
||||
foreach (var paramOut in item.Value.ParametersOut) {
|
||||
|
||||
sb.AppendLine($"\t\t\t\t\t{{ \"{paramOut.Key}\", new string[] {{");
|
||||
|
||||
foreach (var paramType in paramOut.Value) {
|
||||
|
||||
sb.AppendLine($"\t\t\t\t\t\t\"{paramType}\",");
|
||||
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t\t\t\t}},");
|
||||
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t\t\t},");
|
||||
|
||||
}
|
||||
|
||||
sb.AppendLine($"\t\t\t}}}},");
|
||||
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t};\n");
|
||||
sb.AppendLine("\t}\n");
|
||||
sb.AppendLine("}");
|
||||
|
||||
File.WriteAllText("../../../../MewtocolNet/AutoGeneratedData/FPFunction.cs", sb.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user