feat: 初回コミット (GameLauncher)
This commit is contained in:
commit
7ac4dbc825
45 files changed
+9779
No files matched your search
@@ -0,0 +1,97 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GameLauncher.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// アプリケーション設定DTO
|
||||
/// </summary>
|
||||
public class LauncherConfig
|
||||
{
|
||||
public GameSortOrder SortOrder { get; set; } = GameSortOrder.LastLaunchedDesc;
|
||||
|
||||
/// <summary>選択中のメインタブ (0: すべて, 1: ツクール・ティラノ, 2: Unity)</summary>
|
||||
public int SelectedTab { get; set; } = 0;
|
||||
|
||||
/// <summary>一度も変更していないゲームにおける「起動時に改造を適用する」の初期値</summary>
|
||||
public bool DefaultApplyMod { get; set; } = true;
|
||||
|
||||
/// <summary>一度も変更していないゲームにおける各改造プラグインの個別有効/無効の初期値</summary>
|
||||
public Dictionary<string, bool> DefaultPluginSettings { get; set; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>追加のスキャン対象ルートディレクトリ一覧</summary>
|
||||
public List<string> TargetDirectories { get; set; } = [];
|
||||
|
||||
// フィルター状態の保存(再起動時復元用)
|
||||
public string TkoolEngineFilter { get; set; } = "All";
|
||||
public bool TkoolFilterModdedOnly { get; set; }
|
||||
public bool TkoolFilterAsarOnly { get; set; }
|
||||
public string UnityBackendFilter { get; set; } = "All";
|
||||
public bool UnityFilterSaveOnly { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ゲーム一覧のソート用カスタムComparer(GameItemBase全般に対応)
|
||||
/// </summary>
|
||||
public class GameItemComparer : IComparer
|
||||
{
|
||||
public GameSortOrder SortOrder { get; set; } = GameSortOrder.LastLaunchedDesc;
|
||||
|
||||
public int Compare(object? x, object? y)
|
||||
{
|
||||
if (x is not GameItemBase a || y is not GameItemBase b)
|
||||
return 0;
|
||||
|
||||
return SortOrder switch
|
||||
{
|
||||
GameSortOrder.LastLaunchedDesc => CompareNullableDateTimeDesc(a.LastLaunched, b.LastLaunched, a.Title, b.Title),
|
||||
GameSortOrder.LastLaunchedAsc => CompareNullableDateTimeAsc(a.LastLaunched, b.LastLaunched, a.Title, b.Title),
|
||||
GameSortOrder.FolderLastModifiedDesc => CompareNullableDateTimeDesc(a.FolderLastModified, b.FolderLastModified, a.Title, b.Title),
|
||||
GameSortOrder.FolderLastModifiedAsc => CompareNullableDateTimeAsc(a.FolderLastModified, b.FolderLastModified, a.Title, b.Title),
|
||||
GameSortOrder.TitleAsc => string.Compare(a.Title, b.Title, StringComparison.CurrentCultureIgnoreCase),
|
||||
GameSortOrder.TitleDesc => string.Compare(b.Title, a.Title, StringComparison.CurrentCultureIgnoreCase),
|
||||
GameSortOrder.FolderNameAsc => string.Compare(a.FolderName, b.FolderName, StringComparison.CurrentCultureIgnoreCase),
|
||||
_ => string.Compare(a.Title, b.Title, StringComparison.CurrentCultureIgnoreCase)
|
||||
};
|
||||
}
|
||||
|
||||
private static int CompareNullableDateTimeDesc(DateTime? d1, DateTime? d2, string title1, string title2)
|
||||
{
|
||||
if (d1.HasValue && d2.HasValue)
|
||||
{
|
||||
int cmp = d2.Value.CompareTo(d1.Value);
|
||||
if (cmp != 0) return cmp;
|
||||
}
|
||||
else if (d1.HasValue)
|
||||
{
|
||||
return -1; // 値がある方を上に
|
||||
}
|
||||
else if (d2.HasValue)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return string.Compare(title1, title2, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
private static int CompareNullableDateTimeAsc(DateTime? d1, DateTime? d2, string title1, string title2)
|
||||
{
|
||||
if (d1.HasValue && d2.HasValue)
|
||||
{
|
||||
int cmp = d1.Value.CompareTo(d2.Value);
|
||||
if (cmp != 0) return cmp;
|
||||
}
|
||||
else if (d1.HasValue)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (d2.HasValue)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return string.Compare(title1, title2, StringComparison.CurrentCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user