feat: ツクールVX/VX Ace改造対応、Backupsフォルダ統一、全エンジンの種類別一覧表示タブの実装
This commit is contained in:
1 parent
7ac4dbc825
commit
bc5ba43ce7
14 files changed
+2157
-130
No files matched your search
@@ -178,15 +178,25 @@ namespace GameLauncher.Services
|
||||
Directory.CreateDirectory(pluginsDir);
|
||||
}
|
||||
|
||||
var backupPath = pluginsJsPath + BackupSuffix;
|
||||
var gameBackupDir = AppPathHelper.GetGameBackupDirectory(game.FolderName, game.RootDirectory);
|
||||
var backupPath = Path.Combine(gameBackupDir, "plugins.js" + BackupSuffix);
|
||||
var legacyBackupPath = pluginsJsPath + BackupSuffix;
|
||||
|
||||
// 1. バックアップが存在しない場合、バックアップを作成する
|
||||
// 1. バックアップが存在しない場合、バックアップを作成する (Backups フォルダに保存)
|
||||
if (!File.Exists(backupPath))
|
||||
{
|
||||
string currentContent = File.ReadAllText(pluginsJsPath, Encoding.UTF8);
|
||||
// 既に改造プラグイン(新旧問わず)が埋め込まれている場合はクリーンアップしたものをバックアップとして保持
|
||||
string cleanContent = CleanManagedPluginsFromContent(currentContent);
|
||||
File.WriteAllText(backupPath, cleanContent, new UTF8Encoding(false));
|
||||
if (File.Exists(legacyBackupPath))
|
||||
{
|
||||
// 既存のゲーム内バックアップがあれば Backups フォルダへコピー
|
||||
File.Copy(legacyBackupPath, backupPath, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
string currentContent = File.ReadAllText(pluginsJsPath, Encoding.UTF8);
|
||||
// 既に改造プラグイン(新旧問わず)が埋め込まれている場合はクリーンアップしたものをバックアップとして保持
|
||||
string cleanContent = CleanManagedPluginsFromContent(currentContent);
|
||||
File.WriteAllText(backupPath, cleanContent, new UTF8Encoding(false));
|
||||
}
|
||||
}
|
||||
|
||||
// 2. バックアップ(クリーン状態)を元に編集を開始
|
||||
@@ -245,7 +255,9 @@ namespace GameLauncher.Services
|
||||
{
|
||||
var pluginsJsPath = game.PluginsJsPath;
|
||||
var pluginsDir = game.PluginsDirPath;
|
||||
var backupPath = pluginsJsPath + BackupSuffix;
|
||||
var gameBackupDir = AppPathHelper.GetGameBackupDirectory(game.FolderName, game.RootDirectory);
|
||||
var backupPath = Path.Combine(gameBackupDir, "plugins.js" + BackupSuffix);
|
||||
var legacyBackupPath = pluginsJsPath + BackupSuffix;
|
||||
|
||||
// 1. バックアップが存在する場合はバックアップから復元(再構築を通すことで壊れたバックアップも修復)
|
||||
if (File.Exists(backupPath))
|
||||
@@ -254,6 +266,14 @@ namespace GameLauncher.Services
|
||||
string cleanContent = RebuildPluginsJs(backupContent, null);
|
||||
File.WriteAllText(pluginsJsPath, cleanContent, new UTF8Encoding(false));
|
||||
}
|
||||
else if (File.Exists(legacyBackupPath))
|
||||
{
|
||||
string backupContent = File.ReadAllText(legacyBackupPath, Encoding.UTF8);
|
||||
string cleanContent = RebuildPluginsJs(backupContent, null);
|
||||
File.WriteAllText(pluginsJsPath, cleanContent, new UTF8Encoding(false));
|
||||
// Backups フォルダへもコピー
|
||||
try { File.Copy(legacyBackupPath, backupPath, true); } catch { }
|
||||
}
|
||||
else
|
||||
{
|
||||
// バックアップがなくても、現在の plugins.js から新旧すべての管理プラグインを綺麗に除去
|
||||
@@ -276,6 +296,12 @@ namespace GameLauncher.Services
|
||||
}
|
||||
}
|
||||
|
||||
// 3. ゲームフォルダ内の旧バックアップファイルがあれば削除してBackupsフォルダに一本化
|
||||
if (File.Exists(legacyBackupPath))
|
||||
{
|
||||
try { File.Delete(legacyBackupPath); } catch { }
|
||||
}
|
||||
|
||||
game.IsModded = false;
|
||||
return (true, "ゲームを改造前のオリジナル状態に正常に復元しました。(旧プラグインも完全削除済み)");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user