diff --git a/CachedDataManager/CachedDataManager.csproj b/CachedDataManager/CachedDataManager.csproj
deleted file mode 100644
index 811a7c0..0000000
--- a/CachedDataManager/CachedDataManager.csproj
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {F1C1B6BF-626C-4F10-8672-2F9596706CA6}
- Library
- Properties
- CachedDataManager
- Assembly-CSharp.CachedDataManager.mm
- v4.6.2
- 512
- latest
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
- ..\External\MonoMod.exe
- False
-
-
- ..\External\Assembly-CSharp.dll
- False
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CachedDataManager/Manager/MaiStudio/Serialize/patch_FilePath.cs b/CachedDataManager/Manager/MaiStudio/Serialize/patch_FilePath.cs
deleted file mode 100644
index 19262e0..0000000
--- a/CachedDataManager/Manager/MaiStudio/Serialize/patch_FilePath.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// ReSharper disable CheckNamespace
-// ReSharper disable InconsistentNaming
-
-using MonoMod;
-
-namespace Manager.MaiStudio.Serialize;
-
-public class patch_FilePath : FilePath
-{
- [MonoModReplace]
- public override void AddPath(string parentPath)
- {
- if (string.IsNullOrEmpty(path) || path.StartsWith(parentPath))
- {
- return;
- }
-
- path = parentPath + path;
- }
-}
diff --git a/CachedDataManager/Manager/patch_DataManager.cs b/CachedDataManager/Manager/patch_DataManager.cs
deleted file mode 100644
index ce89b60..0000000
--- a/CachedDataManager/Manager/patch_DataManager.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-// ReSharper disable CheckNamespace
-// ReSharper disable InconsistentNaming
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Xml.Serialization;
-
-namespace Manager;
-
-public class patch_DataManager : DataManager
-{
- private const string _cacheDirectory = "dataCache";
-
- [Serializable]
- [XmlType(TypeName="KeyValuePair")]
- public class SerializableKeyValuePair
- {
- public TK Key;
- public TV Value;
- }
-
- private static Dictionary LoadCacheFile(string fileName)
- {
- if (!File.Exists(fileName))
- {
- return new Dictionary();
- }
-
- using var fs = File.OpenRead(fileName);
- var serializer = new XmlSerializer(typeof(List>));
- var entries = (List>)serializer.Deserialize(fs);
-
- return entries.ToDictionary(e => e.Key, e => e.Value);
- }
-
- private static void SaveCacheFile(string destination, Dictionary collection)
- {
- if (collection == null)
- {
- return;
- }
-
- using var fs = File.Open(destination, FileMode.Create);
- var serializer = new XmlSerializer(typeof(List>));
-
- serializer.Serialize(
- fs,
- collection
- .Select(kvp => new SerializableKeyValuePair { Key = kvp.Key, Value = kvp.Value })
- .ToList());
- }
-
- private static void SaveCache()
- {
- if (!Directory.Exists(_cacheDirectory))
- {
- Directory.CreateDirectory(_cacheDirectory);
- }
-
- SaveCacheFile(Path.Combine(_cacheDirectory, "RomConfigs.xml"), Cache.RomConfigs);
- SaveCacheFile(Path.Combine(_cacheDirectory, "DataConfigs.xml"), Cache.DataConfigs);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Charas.xml"), Cache.Charas);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CharaAwakes.xml"), Cache.CharaAwakes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CharaGenres.xml"), Cache.CharaGenres);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Events.xml"), Cache.Events);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Musics.xml"), Cache.Musics);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicGenres.xml"), Cache.MusicGenres);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicGroups.xml"), Cache.MusicGroups);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicVersions.xml"), Cache.MusicVersions);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicNameSorts.xml"), Cache.MusicNameSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicClearRanks.xml"), Cache.MusicClearRanks);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicDifficultys.xml"), Cache.MusicDifficultys);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicLevels.xml"), Cache.MusicLevels);
- SaveCacheFile(Path.Combine(_cacheDirectory, "TournamentMusics.xml"), Cache.TournamentMusics);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Courses.xml"), Cache.Courses);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CourseModes.xml"), Cache.CourseModes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "LoginBonuses.xml"), Cache.LoginBonuses);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Maps.xml"), Cache.Maps);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MapColors.xml"), Cache.MapColors);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MapTreasures.xml"), Cache.MapTreasures);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MapBonusMusics.xml"), Cache.MapBonusMusics);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MapOtomodachis.xml"), Cache.MapOtomodachis);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MapSilhouettes.xml"), Cache.MapSilhouettes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MapTitles.xml"), Cache.MapTitles);
- SaveCacheFile(Path.Combine(_cacheDirectory, "ItemMusics.xml"), Cache.ItemMusics);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Icons.xml"), Cache.Icons);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Plates.xml"), Cache.Plates);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Titles.xml"), Cache.Titles);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Partners.xml"), Cache.Partners);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Frames.xml"), Cache.Frames);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Tickets.xml"), Cache.Tickets);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CollectionTypes.xml"), Cache.CollectionTypes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CollectionGenres.xml"), Cache.CollectionGenres);
- SaveCacheFile(Path.Combine(_cacheDirectory, "PhotoFrames.xml"), Cache.PhotoFrames);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Informations.xml"), Cache.Informations);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Udemaes.xml"), Cache.Udemaes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Classes.xml"), Cache.Classes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "UdemaeBosses.xml"), Cache.UdemaeBosses);
- SaveCacheFile(Path.Combine(_cacheDirectory, "UdemaeSeasonEvents.xml"), Cache.UdemaeSeasonEvents);
- SaveCacheFile(Path.Combine(_cacheDirectory, "UdemaeSeasonRewards.xml"), Cache.UdemaeSeasonRewards);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Cards.xml"), Cache.Cards);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CardCharas.xml"), Cache.CardCharas);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CardTypes.xml"), Cache.CardTypes);
- SaveCacheFile(Path.Combine(_cacheDirectory, "WeekdayBonuses.xml"), Cache.WeekdayBonuses);
- SaveCacheFile(Path.Combine(_cacheDirectory, "Challenges.xml"), Cache.Challenges);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicRankings.xml"), Cache.MusicRankings);
- SaveCacheFile(Path.Combine(_cacheDirectory, "MusicSorts.xml"), Cache.MusicSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "LoginBonusSorts.xml"), Cache.LoginBonusSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "IconSorts.xml"), Cache.IconSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "PlateSorts.xml"), Cache.PlateSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "TitleSorts.xml"), Cache.TitleSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "PartnerSorts.xml"), Cache.PartnerSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "FrameSorts.xml"), Cache.FrameSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "TicketSorts.xml"), Cache.TicketSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CollectionGenreSorts.xml"), Cache.CollectionGenreSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CharaSorts.xml"), Cache.CharaSorts);
- SaveCacheFile(Path.Combine(_cacheDirectory, "CharaGenreSorts.xml"), Cache.CharaGenreSorts);
- }
-
- private static extern bool orig_Deserialize(string filePath, out T dsr) where T : new();
- private static bool Deserialize(string filePath, out T dsr) where T : new()
- {
- var fileName = Path.GetFileName(filePath);
- var collectionName = fileName switch
- {
- "UdemaeBoss.xml" => "UdemaeBosses",
- "Class.xml" => "Classes",
- "LoginBonus.xml" => "LoginBonuses",
- "ScoreRanking.xml" => "TournamentMusics",
- "Holiday.xml" => "WeekdayBonuses",
- _ => fileName.Replace(".xml", "s"),
- };
- var collectionField =
- typeof(CachedDataManager.SerializationCache).GetField(collectionName, BindingFlags.Public | BindingFlags.Instance);
-
- if (collectionField == null)
- {
- System.Console.WriteLine("[CachedDataManager] [WARN] Could not find suitable collection for {0} (tried name {1})", fileName, collectionName);
- return orig_Deserialize(filePath, out dsr);
- }
-
- try
- {
- var collection = (Dictionary)collectionField.GetValue(Cache);
-
- if (collection == null)
- {
- collection = LoadCacheFile(Path.Combine(_cacheDirectory, $"{collectionName}.xml"));
- collectionField.SetValue(Cache, collection);
- }
-
- if (collection.TryGetValue(filePath, out dsr))
- {
- return true;
- }
-
- if (!orig_Deserialize(filePath, out dsr))
- {
- return false;
- }
-
- collection.Add(filePath, dsr);
- _cacheBusted = true;
-
- return true;
- }
- catch (Exception e)
- {
- System.Console.WriteLine("[CachedDataManager] [ERROR] Could not load from cache: {0}", e);
- return orig_Deserialize(filePath, out dsr);
- }
- }
-
- private extern bool orig_IsLoaded();
- public new bool IsLoaded()
- {
- var loaded = orig_IsLoaded();
-
- if (!loaded || !_cacheBusted)
- {
- return loaded;
- }
-
- try
- {
- SaveCache();
- }
- catch (Exception e)
- {
- System.Console.WriteLine("[CachedDataManager] [ERROR] Could not save to cache: {0}", e);
- }
-
- _cacheBusted = false;
-
- return true;
- }
-
- private static readonly CachedDataManager.SerializationCache Cache = new();
- private static bool _cacheBusted;
-}
-
-
diff --git a/CachedDataManager/Properties/AssemblyInfo.cs b/CachedDataManager/Properties/AssemblyInfo.cs
deleted file mode 100644
index 5b8bfcc..0000000
--- a/CachedDataManager/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("CachedDataManager")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("CachedDataManager")]
-[assembly: AssemblyCopyright("Copyright © 2024")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("F1C1B6BF-626C-4F10-8672-2F9596706CA6")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/CachedDataManager/SerializationCache.cs b/CachedDataManager/SerializationCache.cs
deleted file mode 100644
index b55c463..0000000
--- a/CachedDataManager/SerializationCache.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-// ReSharper disable UnassignedField.Global
-using System.Collections.Generic;
-using Manager.MaiStudio.Serialize;
-
-namespace CachedDataManager;
-
-public class SerializationCache
-{
- public Dictionary RomConfigs;
- public Dictionary DataConfigs;
- public Dictionary Charas;
- public Dictionary CharaAwakes;
- public Dictionary CharaGenres;
- public Dictionary Events;
- public Dictionary Musics;
- public Dictionary MusicGenres;
- public Dictionary MusicGroups;
- public Dictionary MusicVersions;
- public Dictionary MusicNameSorts;
- public Dictionary MusicClearRanks;
- public Dictionary MusicDifficultys;
- public Dictionary MusicLevels;
- public Dictionary TournamentMusics;
- public Dictionary Courses;
- public Dictionary CourseModes;
- public Dictionary LoginBonuses;
- public Dictionary Maps;
- public Dictionary MapColors;
- public Dictionary MapTreasures;
- public Dictionary MapBonusMusics;
- public Dictionary MapOtomodachis;
- public Dictionary MapSilhouettes;
- public Dictionary MapTitles;
- public Dictionary ItemMusics;
- public Dictionary Icons;
- public Dictionary Plates;
- public Dictionary Titles;
- public Dictionary Partners;
- public Dictionary Frames;
- public Dictionary Tickets;
- public Dictionary CollectionTypes;
- public Dictionary CollectionGenres;
- public Dictionary PhotoFrames;
- public Dictionary Informations;
- public Dictionary Udemaes;
- public Dictionary Classes;
- public Dictionary UdemaeBosses;
- public Dictionary UdemaeSeasonEvents;
- public Dictionary UdemaeSeasonRewards;
- public Dictionary Cards;
- public Dictionary CardCharas;
- public Dictionary CardTypes;
- public Dictionary WeekdayBonuses;
- public Dictionary Challenges;
- public Dictionary MusicRankings;
- public Dictionary MusicSorts;
- public Dictionary LoginBonusSorts;
- public Dictionary IconSorts;
- public Dictionary PlateSorts;
- public Dictionary TitleSorts;
- public Dictionary PartnerSorts;
- public Dictionary FrameSorts;
- public Dictionary TicketSorts;
- public Dictionary CollectionGenreSorts;
- public Dictionary CharaSorts;
- public Dictionary CharaGenreSorts;
-}
diff --git a/LooseDBTables.GeneratePatches/LooseDBTables.GeneratePatches.csproj b/LooseDBTables.GeneratePatches/LooseDBTables.GeneratePatches.csproj
deleted file mode 100644
index 5d9ec54..0000000
--- a/LooseDBTables.GeneratePatches/LooseDBTables.GeneratePatches.csproj
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
- Exe
- net9.0
- enable
- enable
-
-
-
-
-
-
-
diff --git a/LooseDBTables.GeneratePatches/Program.cs b/LooseDBTables.GeneratePatches/Program.cs
deleted file mode 100644
index a4a6185..0000000
--- a/LooseDBTables.GeneratePatches/Program.cs
+++ /dev/null
@@ -1,154 +0,0 @@
-// See https://aka.ms/new-console-template for more information
-
-using System.Collections.Immutable;
-using System.Reflection;
-using System.Text;
-
-var assemblyPath = args[0];
-var targetPath = args[1];
-var assembly = Assembly.LoadFrom(assemblyPath);
-var types = assembly.GetTypes().Where(t => t.FullName.StartsWith("DB.") && t.FullName.EndsWith("IDEnum")).ToImmutableList();
-
-foreach (var type in types)
-{
- var tableRecordType = assembly.GetType(type.FullName.Replace("IDEnum", "TableRecord"))!;
- var patchClassName = $"patch_{type.Name}";
- var readCommands = new StringBuilder();
- var writeCommands = new StringBuilder();
- var tableRecordFields = new StringBuilder();
-
- foreach (var field in tableRecordType.GetFields(BindingFlags.Public | BindingFlags.Instance))
- {
- tableRecordFields.Append("public ");
-
- if (field.FieldType.IsEnum)
- {
- tableRecordFields.Append("System.Int32 ");
- }
- else
- {
- tableRecordFields.Append(field.FieldType.FullName);
- tableRecordFields.Append(" ");
- }
-
- tableRecordFields.Append(field.Name);
- tableRecordFields.AppendLine(";");
-
- readCommands.Append(field.Name)
- .Append(" = (")
- .Append(field.FieldType.FullName)
- .Append(")src[i].")
- .Append(field.Name)
- .Append(", ");
- writeCommands.Append(field.Name)
- .Append(" = (")
- .Append(field.FieldType.IsEnum ? "int" : field.FieldType.FullName)
- .Append(")src[i].")
- .Append(field.Name)
- .Append(", ");
- }
-
- using var sw = File.CreateText(Path.Combine(targetPath, patchClassName + ".cs"));
- sw.WriteLine($$"""
- // 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 {{type.Name}}
- {
- public static extern bool LoadFromFile(string filename);
- public static extern void DumpToFile(string filename);
- protected static {{tableRecordType.Name}}[] records;
- }
-
- [GeneratedCode("LooseDBTables.GeneratePatches", "1.0.0.0")]
- [Serializable]
- public class Serializable{{tableRecordType.Name}} {
- {{tableRecordFields}}
- }
-
- [GeneratedCode("LooseDBTables.GeneratePatches", "1.0.0.0")]
- public class {{patchClassName}} : {{type.Name}} {
- public new static bool LoadFromFile(string filename) {
- if (!File.Exists(filename)) {
- return false;
- }
-
- var table = JsonUtility.FromJson>(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 {{tableRecordType.Name}} { {{readCommands}} };
- }
- }
- catch
- {
- Debug.LogError($"File read error: {filename}");
- return false;
- }
- return true;
- }
-
- public new static void DumpToFile(string filename) {
- var table = new Table() {
- records = new Serializable{{tableRecordType.Name}}[records.Length]
- };
-
- var src = records;
- var dst = table.records;
-
- for (var i = 0; i < records.Length; i++) {
- dst[i] = new Serializable{{tableRecordType.Name}} { {{writeCommands}} };
- }
-
- File.WriteAllText(filename, JsonUtility.ToJson(table, true), Encoding.UTF8);
- }
- }
- """);
-}
-
-using var dbLoaderSw = File.CreateText(Path.Combine(targetPath, "DBLoader.cs"));
-dbLoaderSw.WriteLine($$"""
- // ReSharper disable CheckNamespace
-
- using System;
- using System.CodeDom.Compiler;
- using System.IO;
- using System.Text;
-
- namespace DB;
-
- [GeneratedCode("LooseDBTables.GeneratePatches", "1.0.0.0")]
- public class DBLoader
- {
- public static void LoadAll(string dirPath)
- {
- {{string.Join("\n", types.Select(t => $"{t.Name}.LoadFromFile(Path.Combine(dirPath, \"{t.Name.Replace("IDEnum", "TableRecord")}.json\"));"))}}
- }
-
- public static void DumpAll(string dirPath)
- {
- {{string.Join("\n", types.Select(t => $"{t.Name}.DumpToFile(Path.Combine(dirPath, \"{t.Name.Replace("IDEnum", "TableRecord")}.json\"));"))}}
- }
- }
- """);