Merge branch 'main' of https://gitea.tendokyu.moe/akanyan/mu3-mods into InfiniteStory

This commit is contained in:
Jujuforce 2024-08-29 13:27:05 +02:00
commit a6da232705
2 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,9 @@ class patch_OperationManager: OperationManager {
~patch_OperationManager() { ~patch_OperationManager() {
try { try {
File.WriteAllText(_fileName, MovieIndex.ToString()); File.WriteAllText(_fileName, MovieIndex.ToString());
} catch(Exception) { } } catch(Exception ex) {
System.Console.WriteLine(ex);
}
} }
public int MovieIndex { public int MovieIndex {
set { set {
@ -41,7 +43,9 @@ class patch_OperationManager: OperationManager {
orig_initialize(); orig_initialize();
using IniFile iniFile = new("mu3.ini"); using IniFile iniFile = new("mu3.ini");
_fileName = Path.Combine(iniFile.getValue("Extra", "CacheDir", "."), "data_advert_cache.txt"); var dir = iniFile.getValue("Extra", "CacheDir", ".");
Directory.CreateDirectory(dir);
_fileName = Path.Combine(dir, "data_advert_cache.txt");
try { try {
_movieIndex = Math.Max(0, int.Parse(File.ReadAllText(_fileName))); _movieIndex = Math.Max(0, int.Parse(File.ReadAllText(_fileName)));

View File

@ -13,7 +13,9 @@ public class patch_DataStudioManager: DataStudioManager {
private static void initCache() { private static void initCache() {
using IniFile iniFile = new("mu3.ini"); using IniFile iniFile = new("mu3.ini");
_fileName = Path.Combine(iniFile.getValue("Extra", "CacheDir", "."), "data_cache.bin"); var dir = iniFile.getValue("Extra", "CacheDir", ".");
Directory.CreateDirectory(dir);
_fileName = Path.Combine(dir, "data_cache.bin");
if(File.Exists(_fileName)) { if(File.Exists(_fileName)) {
System.Console.WriteLine("Loading data cache..."); System.Console.WriteLine("Loading data cache...");