mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-12 17:44:43 +01:00
uniniform anomaly table fix
This commit is contained in:
@@ -79,6 +79,7 @@ namespace AscNet.Table
|
||||
string file = $@"// <auto-generated/>
|
||||
namespace AscNet.Table{ns}
|
||||
{{
|
||||
#nullable enable
|
||||
public class {Path.GetFileName(table.Path).Split('.').First()}Table
|
||||
{{
|
||||
{string.Join("\r\n\t\t", properties.Values)}
|
||||
@@ -87,14 +88,34 @@ namespace AscNet.Table{ns}
|
||||
public class {Path.GetFileName(table.Path).Split('.').First()}TableReader : global::AscNet.Common.Util.TableReader<{Path.GetFileName(table.Path).Split('.').First()}TableReader, {Path.GetFileName(table.Path).Split('.').First()}Table>
|
||||
{{
|
||||
protected override string FilePath {{ get {{ return ""{string.Join("", table.Path.Replace("\\", "/").Split(new string[] {"/Resources/"}, StringSplitOptions.None).Skip(1))}""; }} }}
|
||||
protected override void Load()
|
||||
|
||||
public override void Load()
|
||||
{{
|
||||
string tsvStr = global::System.Text.Encoding.UTF8.GetString(global::System.IO.File.ReadAllBytes(FilePath).Skip(128).ToArray());
|
||||
using var reader = new global::System.IO.StringReader(tsvStr.Replace(""\t"", "",""));
|
||||
string[] tsvValues = tsvStr.Split('\t');
|
||||
string[] csvValues = new string[tsvValues.Length];
|
||||
for (int i = 0; i < tsvValues.Length; i++)
|
||||
{{
|
||||
if (tsvValues[i].Contains("",""))
|
||||
{{
|
||||
csvValues[i] = ""\"""" + tsvValues[i].Replace(""\"""", ""\""\"""") + ""\"""";
|
||||
}}
|
||||
else
|
||||
{{
|
||||
csvValues[i] = tsvValues[i];
|
||||
}}
|
||||
}}
|
||||
using var reader = new global::System.IO.StringReader(string.Join("","", csvValues));
|
||||
using var csv = new global::CsvHelper.CsvReader(reader, new global::CsvHelper.Configuration.CsvConfiguration(global::System.Globalization.CultureInfo.InvariantCulture) {{ BadDataFound = null, HeaderValidated = null, MissingFieldFound = null }});
|
||||
csv.Context.RegisterClassMap<{Path.GetFileName(table.Path).Split('.').First()}TableMap>();
|
||||
All = csv.GetRecords<{Path.GetFileName(table.Path).Split('.').First()}Table>().ToList();
|
||||
}}
|
||||
{string.Join("\r\n", properties.Values.Select(x => x.Split(' ')).Where(x => !x[1].Contains("<")).Select(property => $@"
|
||||
public {Path.GetFileName(table.Path).Split('.').First()}Table? From{property[2]}({property[1]} val)
|
||||
{{
|
||||
return All.FirstOrDefault(x => x.{property[2]} == val);
|
||||
}}
|
||||
"))}
|
||||
}}
|
||||
|
||||
public sealed class {Path.GetFileName(table.Path).Split('.').First()}TableMap : global::CsvHelper.Configuration.ClassMap<{Path.GetFileName(table.Path).Split('.').First()}Table>
|
||||
@@ -106,10 +127,9 @@ namespace AscNet.Table{ns}
|
||||
Map(m => m.{x}).Convert(args =>
|
||||
{{
|
||||
{properties[x].Split(' ')[1]} tags = new {properties[x].Split(' ')[1]}();
|
||||
|
||||
for (int i = 1; i <= {listCount[x]}; i++)
|
||||
{(nameList.Contains($"{x}[0]") ? $"for (int i = 0; i < {listCount[x]}; i++)" : $"for (int i = 1; i <= {listCount[x]}; i++)")}
|
||||
{{
|
||||
string tagValue = args.Row.GetField<string>($""{x}[{{i}}]"");
|
||||
string? tagValue = args.Row.GetField<string>($""{x}[{{i}}]"");
|
||||
if (!string.IsNullOrEmpty(tagValue))
|
||||
{{
|
||||
{(properties[x].Split('<')[1].StartsWith("global::System.Int32") ? @"
|
||||
|
||||
Reference in New Issue
Block a user