mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 10:00:44 +08:00
fix: 修复 wpf gui 一些 resource path 读取
fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/14044
This commit is contained in:
@@ -78,13 +78,13 @@ namespace MaaWpfGui.Helper
|
||||
|
||||
private static void LoadBattleData()
|
||||
{
|
||||
const string FilePath = "resource/battle_data.json";
|
||||
if (!File.Exists(FilePath))
|
||||
string filePath = Path.Combine(AsstProxy.MainResourcePath(), "resource/battle_data.json");
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string jsonText = File.ReadAllText(FilePath);
|
||||
string jsonText = File.ReadAllText(filePath);
|
||||
var characterData = JsonConvert.DeserializeObject<Dictionary<string, CharacterInfo>>(JObject.Parse(jsonText)["chars"]?.ToString() ?? string.Empty) ?? [];
|
||||
|
||||
var characterNamesLangAdd = GetCharacterNamesAddAction(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.Localization, LocalizationHelper.DefaultLanguage));
|
||||
|
||||
@@ -24,6 +24,7 @@ using JetBrains.Annotations;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Extensions;
|
||||
using MaaWpfGui.Helper;
|
||||
using MaaWpfGui.Main;
|
||||
using MaaWpfGui.Models;
|
||||
using MaaWpfGui.Properties;
|
||||
using MaaWpfGui.Services;
|
||||
@@ -157,13 +158,13 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
|
||||
{
|
||||
bool isDefaultClient = new HashSet<string> { string.Empty, "Official", "Bilibili" }.Contains(clientType);
|
||||
|
||||
const string DefaultJsonPath = "resource/version.json";
|
||||
string defaultJsonPath = Path.Combine(AsstProxy.MainResourcePath(), "resource/version.json");
|
||||
var jsonPath = isDefaultClient
|
||||
? DefaultJsonPath
|
||||
? defaultJsonPath
|
||||
: $"resource/global/{clientType}/resource/version.json";
|
||||
|
||||
string versionName;
|
||||
if (!File.Exists(DefaultJsonPath) || (!isDefaultClient && !File.Exists(jsonPath)))
|
||||
if (!File.Exists(defaultJsonPath) || (!isDefaultClient && !File.Exists(jsonPath)))
|
||||
{
|
||||
return (DateTime.MinValue, string.Empty);
|
||||
}
|
||||
@@ -174,7 +175,7 @@ public class VersionUpdateSettingsUserControlModel : PropertyChangedBase
|
||||
var activityTime = (ulong?)versionJson?["activity"]?["time"]; // 活动的开始时间
|
||||
var lastUpdated = isDefaultClient
|
||||
? (string?)versionJson?["last_updated"]
|
||||
: (string?)LoadJson(DefaultJsonPath)?["last_updated"];
|
||||
: (string?)LoadJson(defaultJsonPath)?["last_updated"];
|
||||
|
||||
var dateTime = lastUpdated == null
|
||||
? DateTime.MinValue
|
||||
|
||||
Reference in New Issue
Block a user