wip
This commit is contained in:
+20
-2
@@ -121,7 +121,20 @@ namespace AnotherReplayReader
|
||||
|
||||
public void LoadStringHashes()
|
||||
{
|
||||
var stringHashes = File.ReadAllText(@"C:\Apps\RA3-MODSDK-X\builtmods\StringHashes.xml");
|
||||
// 临时方案:优先使用随程序分发的快照,找不到再回退到本地 SDK。
|
||||
// 该快照后续应改为可配置路径,或只打包当前命令实际用到的 hash 子集。
|
||||
var bundledPath = Path.Combine(AppContext.BaseDirectory, "Data", "StringHashes.xml");
|
||||
var externalPath = @"C:\Apps\RA3-MODSDK-X\builtmods\StringHashes.xml";
|
||||
var sourcePath = File.Exists(bundledPath) ? bundledPath : externalPath;
|
||||
if (!File.Exists(sourcePath))
|
||||
{
|
||||
throw new FileNotFoundException(
|
||||
"未找到 StringHashes.xml;请检查程序目录下的 Data\\StringHashes.xml,或安装 RA3-MODSDK-X。",
|
||||
sourcePath);
|
||||
}
|
||||
Debug.Instance.DebugMessage += $"StringHashes 来源: {sourcePath}\r\n";
|
||||
|
||||
var stringHashes = File.ReadAllText(sourcePath);
|
||||
XDocument doc = XDocument.Parse(stringHashes);
|
||||
XNamespace ns = "uri:ea.com:eala:asset";
|
||||
var table = doc
|
||||
@@ -175,7 +188,7 @@ namespace AnotherReplayReader
|
||||
_cached = text;
|
||||
_cachedPrefixSums = prefixSums;
|
||||
_cachedSpans = spans;
|
||||
_cachedFactIndex = ReplayFactIndex.Build(_model.Commands, _stringHashes);
|
||||
_cachedFactIndex = await Task.Run(() => ReplayFactIndex.Build(_model.Commands, _stringHashes));
|
||||
// display KB and K tokens in _tokenUsageLabel
|
||||
_tokenUsageLabel.Content = $"大小: {bytesCount / 1024.0:0.00} KiB,估计Token数: {estimatedTokenCount / 1000.0:0.00} K";
|
||||
}
|
||||
@@ -454,6 +467,11 @@ namespace AnotherReplayReader
|
||||
MessageBox.Show(this, "请先选择录像");
|
||||
return;
|
||||
}
|
||||
if (_model.Level == CompactLevel.NoCompact)
|
||||
{
|
||||
MessageBox.Show(this, "AI 分析需要使用 AI 压缩级别(ForAI 或 VeryCompactedForAI),请先在右上角切换。");
|
||||
return;
|
||||
}
|
||||
if (_cached is not { } cached || _cachedPrefixSums is not { } cachedPrefixSums || _cachedFactIndex is not { } factIndex)
|
||||
{
|
||||
MessageBox.Show(this, "请先生成文本");
|
||||
|
||||
Reference in New Issue
Block a user