最適化: ラベル表示状態のキャッシュ永続化および実在検証の超高速化
- UnifiedGameCacheEntryにIsModded等のラベル状態を保持し、起動直後の0秒時点から全ラベルを即時表示 - フォルダ更新日時(LastWriteTime)比較により、不変ゲームの重いディスクI/O検証を完全スキップ - 実在検証完了後に一覧およびステータスラベルの最新描画リフレッシュを追加
This commit is contained in:
1 parent
b0fdea2411
commit
f50976a6c0
2 files changed
+44
-6
No files matched your search
+6
-1
@@ -399,6 +399,12 @@ namespace GameLauncher
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
ct: ct);
|
ct: ct);
|
||||||
|
|
||||||
|
this.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
this.UpdateStatusLabels();
|
||||||
|
this._gamesView.Refresh();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2-2. 差分スキャン(新規フォルダの走査)
|
// 2-2. 差分スキャン(新規フォルダの走査)
|
||||||
@@ -2209,4 +2215,3 @@ namespace GameLauncher
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +54,7 @@ namespace GameLauncher.Services
|
|||||||
public int TkoolEngineType { get; set; }
|
public int TkoolEngineType { get; set; }
|
||||||
public bool HasCustomApplyMod { get; set; }
|
public bool HasCustomApplyMod { get; set; }
|
||||||
public bool ApplyMod { get; set; } = true;
|
public bool ApplyMod { get; set; } = true;
|
||||||
|
public bool IsModded { get; set; }
|
||||||
public Dictionary<string, bool>? PluginSettings { get; set; }
|
public Dictionary<string, bool>? PluginSettings { get; set; }
|
||||||
public bool IsAsar { get; set; }
|
public bool IsAsar { get; set; }
|
||||||
public bool IsAsarExtracted { get; set; }
|
public bool IsAsarExtracted { get; set; }
|
||||||
@@ -198,7 +199,7 @@ namespace GameLauncher.Services
|
|||||||
LastLaunched = entry.LastLaunched,
|
LastLaunched = entry.LastLaunched,
|
||||||
FolderLastModified = entry.FolderLastModified,
|
FolderLastModified = entry.FolderLastModified,
|
||||||
IsBookmarked = entry.IsBookmarked,
|
IsBookmarked = entry.IsBookmarked,
|
||||||
IsModded = false,
|
IsModded = entry.IsModded,
|
||||||
IsAsar = entry.IsAsar,
|
IsAsar = entry.IsAsar,
|
||||||
IsAsarExtracted = entry.IsAsarExtracted,
|
IsAsarExtracted = entry.IsAsarExtracted,
|
||||||
AsarPath = entry.AsarPath,
|
AsarPath = entry.AsarPath,
|
||||||
@@ -471,6 +472,7 @@ namespace GameLauncher.Services
|
|||||||
TkoolEngineType = (int)tg.EngineType,
|
TkoolEngineType = (int)tg.EngineType,
|
||||||
HasCustomApplyMod = tg.HasCustomApplyMod,
|
HasCustomApplyMod = tg.HasCustomApplyMod,
|
||||||
ApplyMod = tg.ApplyMod,
|
ApplyMod = tg.ApplyMod,
|
||||||
|
IsModded = tg.IsModded,
|
||||||
PluginSettings = tg.PluginSettings.Count > 0 ? tg.PluginSettings : null,
|
PluginSettings = tg.PluginSettings.Count > 0 ? tg.PluginSettings : null,
|
||||||
IsAsar = tg.IsAsar,
|
IsAsar = tg.IsAsar,
|
||||||
IsAsarExtracted = tg.IsAsarExtracted,
|
IsAsarExtracted = tg.IsAsarExtracted,
|
||||||
@@ -637,14 +639,45 @@ namespace GameLauncher.Services
|
|||||||
onProgress(current, total, $"実在検証中... ({current}/{total})");
|
onProgress(current, total, $"実在検証中... ({current}/{total})");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 実在検証
|
// 実在検証および更新日時の取得
|
||||||
if (!Directory.Exists(game.RootDirectory))
|
DateTime currentLastWrite;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(game.RootDirectory))
|
||||||
|
{
|
||||||
|
onGameRemoved(game);
|
||||||
|
Interlocked.Exchange(ref cacheNeedsSave, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
currentLastWrite = Directory.GetLastWriteTime(game.RootDirectory);
|
||||||
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
onGameRemoved(game);
|
|
||||||
Interlocked.Exchange(ref cacheNeedsSave, 1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// キャッシュのフォルダ更新日時と完全一致している場合、内部構成(exe/plugins/アーカイブ/EVB等)は不変のため
|
||||||
|
// 重いディスクI/O(EVBバイナリ解析、plugins.js読み取り、wolf走査等)を完全にスキップして超高速化
|
||||||
|
bool isUnchanged = game.FolderLastModified.HasValue && game.FolderLastModified.Value == currentLastWrite;
|
||||||
|
if (isUnchanged)
|
||||||
|
{
|
||||||
|
// 未ロードのアイコンのみ必要に応じてロード
|
||||||
|
if (game.IconImage == null)
|
||||||
|
{
|
||||||
|
var icon = LoadIcon(game.ExecutablePath, game.RootDirectory);
|
||||||
|
if (icon != null)
|
||||||
|
{
|
||||||
|
game.IconImage = icon;
|
||||||
|
onGameUpdated(game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新があった、または初回検証の場合は更新日時を最新化
|
||||||
|
game.FolderLastModified = currentLastWrite;
|
||||||
|
Interlocked.Exchange(ref cacheNeedsSave, 1);
|
||||||
|
|
||||||
if (game is UnityGameItem ug)
|
if (game is UnityGameItem ug)
|
||||||
{
|
{
|
||||||
if (!File.Exists(ug.ExecutablePath))
|
if (!File.Exists(ug.ExecutablePath))
|
||||||
|
|||||||
Reference in new issue
Block a user