干掉了浩方查马甲代码

This commit is contained in:
2024-08-24 01:54:11 +02:00
parent 08700abd4f
commit 66458e831c
15 changed files with 217 additions and 434 deletions

View File

@@ -103,7 +103,6 @@ namespace AnotherReplayReader
private readonly TaskQueue _taskQueue;
private readonly MainWindowProperties _properties = new();
private readonly Cache _cache = new();
private readonly PlayerIdentity _playerIdentity;
private readonly BigMinimapCache _minimapCache;
private readonly MinimapReader _minimapReader;
private readonly CancelManager _cancelLoadReplays = new();
@@ -116,10 +115,9 @@ namespace AnotherReplayReader
public MainWindow()
{
_taskQueue = new(Dispatcher);
_playerIdentity = new PlayerIdentity(_cache);
_minimapCache = new BigMinimapCache(_properties.RA3Directory);
_minimapReader = new MinimapReader(_minimapCache, _properties.CustomMapsDirectory, _properties.ModsDirectory);
_replayList = new(_playerIdentity);
_replayList = new();
DataContext = _properties;
InitializeComponent();
@@ -137,20 +135,9 @@ namespace AnotherReplayReader
ReplayAutoSaver.SpawnAutoSaveReplaysTask(_properties.RA3ReplayFolderPath);
var token = _cancelLoadReplays.ResetAndGetToken(CancellationToken.None);
_ = _taskQueue.Enqueue(() => LoadReplays(null, token), token);
var wantUsePlugin = true;
try
{
wantUsePlugin = await Plugin.LoadPlayerIdentityPlugin(_playerIdentity);
}
catch (Exception e)
{
Debug.Instance.DebugMessage += $"Failed to load plugin: {e}";
MessageBox.Show(this, $"插件加载失败:{e.Message}");
}
const string permissionKey = "questionAsked";
if (!wantUsePlugin && _cache.GetOrDefault(permissionKey, false) is not true)
if (_cache.GetOrDefault(permissionKey, false) is not true)
{
_cache.Set(permissionKey, true);
var sb = new StringWriter();
@@ -194,7 +181,7 @@ namespace AnotherReplayReader
}
cancelToken.ThrowIfCancellationRequested();
_replayList = new(_playerIdentity);
_replayList = new();
var path = _properties.ReplayFolderPath;
if (!Directory.Exists(path))
@@ -228,7 +215,7 @@ namespace AnotherReplayReader
clock.Restart();
}
}
return new ReplayPinyinList(list.ToImmutableArray(), _playerIdentity);
return new ReplayPinyinList(list.ToImmutableArray());
}, cancelToken);
cancelToken.ThrowIfCancellationRequested();
_replayList = result;
@@ -323,7 +310,7 @@ namespace AnotherReplayReader
minimapTask.Forget();
minimapTask = _minimapReader.TryReadTargaAsync(replay);
}
var newDetails = replay.GetDetails(_playerIdentity);
var newDetails = replay.GetDetails();
if (_properties.ReplayDetails != newDetails)
{
if (_replayList.Replays.FindIndex(r => r.PathEquals(replay)) is int index)
@@ -365,7 +352,6 @@ namespace AnotherReplayReader
_replayDetailsBox.Text += $"{jsonMagic}\r\n";
break;
case assemblyMagic:
Plugin.Sign();
break;
case jsonMagic:
UpdateChecker.Sign();
@@ -381,7 +367,7 @@ namespace AnotherReplayReader
}
var token = _cancelDisplayReplays.ResetAndGetToken(_cancelFilterReplays.Token);
_properties.ReplayDetails = replay.GetDetails(_playerIdentity);
_properties.ReplayDetails = replay.GetDetails();
await _taskQueue.Enqueue(() => DisplayReplayDetail(replay, _properties.ReplayDetails, token), token);
}
@@ -420,7 +406,7 @@ namespace AnotherReplayReader
private void OnDetailsButtonClick(object sender, RoutedEventArgs e)
{
var detailsWindow = new ApmWindow(_properties.CurrentReplay!, _playerIdentity)
var detailsWindow = new ApmWindow(_properties.CurrentReplay!)
{
Owner = this
};