存档读档功能

This commit is contained in:
2025-01-08 22:57:58 +08:00
parent 43b99f98e7
commit 674273ad80
56 changed files with 4142 additions and 2240 deletions
+2 -16
View File
@@ -71,7 +71,7 @@ namespace AibisDream.Utility
public static JObject ReadJObject(string path)
{
string json = File.ReadAllText(path);
string json = File.ReadAllText(FormatAsJsonPath(path));
return JObject.Parse(json);
}
@@ -90,7 +90,7 @@ namespace AibisDream.Utility
public static void SaveJObject(JObject jObject, string path)
{
string json = jObject.ToString();
File.WriteAllText(path, json);
File.WriteAllText(FormatAsJsonPath(path), json);
}
/// <summary>
@@ -125,20 +125,6 @@ namespace AibisDream.Utility
/// <returns>已改为json的文件名</returns>
public static string FormatAsJsonPath(string fileName)
{
// // 找到最后一个点的位置
// int lastDotIndex = fileName.LastIndexOf('.');
//
// // 如果没有点,说明没有扩展名
// if (lastDotIndex == -1)
// {
// return fileName + JsonSuffix;
// }
//
// // 提取文件名(不包括扩展名)
// string fileNameWithoutExtension = fileName.Substring(0, lastDotIndex);
// // 返回新的文件名,使用 .json 作为扩展名
// return fileNameWithoutExtension + JsonSuffix;
if (!fileName.EndsWith(JsonSuffix))
{
return fileName + JsonSuffix;