mirror of
https://gitea.tendokyu.moe/beerpsi/sinmai-mods.git
synced 2024-11-24 07:40:16 +01:00
82 lines
3.1 KiB
C#
82 lines
3.1 KiB
C#
// ReSharper disable CheckNamespace
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
using System;
|
|
using System.CodeDom.Compiler;
|
|
using System.IO;
|
|
using System.Text;
|
|
using MonoMod;
|
|
using LooseDBTables;
|
|
using UnityEngine;
|
|
|
|
namespace DB;
|
|
|
|
[MonoModIgnore]
|
|
[GeneratedCode("LooseDBTables.GeneratePatches", "1.0.0.0")]
|
|
public class PartyPartyClientStateIDEnum
|
|
{
|
|
public static extern bool LoadFromFile(string filename);
|
|
public static extern void DumpToFile(string filename);
|
|
protected static PartyPartyClientStateTableRecord[] records;
|
|
}
|
|
|
|
[GeneratedCode("LooseDBTables.GeneratePatches", "1.0.0.0")]
|
|
[Serializable]
|
|
public class SerializablePartyPartyClientStateTableRecord {
|
|
public System.Int32 EnumValue;
|
|
public System.String EnumName;
|
|
public System.String Name;
|
|
public System.Boolean isConnect;
|
|
public System.Boolean isNormal;
|
|
public System.Boolean isRequest;
|
|
public System.Boolean isWaitPlay;
|
|
|
|
}
|
|
|
|
[GeneratedCode("LooseDBTables.GeneratePatches", "1.0.0.0")]
|
|
public class patch_PartyPartyClientStateIDEnum : PartyPartyClientStateIDEnum {
|
|
public new static bool LoadFromFile(string filename) {
|
|
if (!File.Exists(filename)) {
|
|
return false;
|
|
}
|
|
|
|
var table = JsonUtility.FromJson<Table<SerializablePartyPartyClientStateTableRecord>>(File.ReadAllText(filename));
|
|
|
|
try
|
|
{
|
|
if (table.records.Length != records.Length) {
|
|
Debug.LogError($"Count read error: {filename}");
|
|
return false;
|
|
}
|
|
|
|
var src = table.records;
|
|
var dst = records;
|
|
|
|
for (var i = 0; i < table.records.Length; i++) {
|
|
dst[i] = new PartyPartyClientStateTableRecord { EnumValue = (System.Int32)src[i].EnumValue, EnumName = (System.String)src[i].EnumName, Name = (System.String)src[i].Name, isConnect = (System.Boolean)src[i].isConnect, isNormal = (System.Boolean)src[i].isNormal, isRequest = (System.Boolean)src[i].isRequest, isWaitPlay = (System.Boolean)src[i].isWaitPlay, };
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
Debug.LogError($"File read error: {filename}");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public new static void DumpToFile(string filename) {
|
|
var table = new Table<SerializablePartyPartyClientStateTableRecord>() {
|
|
records = new SerializablePartyPartyClientStateTableRecord[records.Length]
|
|
};
|
|
|
|
var src = records;
|
|
var dst = table.records;
|
|
|
|
for (var i = 0; i < records.Length; i++) {
|
|
dst[i] = new SerializablePartyPartyClientStateTableRecord { EnumValue = (System.Int32)src[i].EnumValue, EnumName = (System.String)src[i].EnumName, Name = (System.String)src[i].Name, isConnect = (System.Boolean)src[i].isConnect, isNormal = (System.Boolean)src[i].isNormal, isRequest = (System.Boolean)src[i].isRequest, isWaitPlay = (System.Boolean)src[i].isWaitPlay, };
|
|
}
|
|
|
|
File.WriteAllText(filename, JsonUtility.ToJson(table, true), Encoding.UTF8);
|
|
}
|
|
}
|