Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
shuo committed Jun 4, 2024
1 parent 4676789 commit 69479eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions AmiyaBotPlayerRatingServer/Data/ArknightsMemoryCache.Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public void LoadObject(Object obj, String key)
return null;
}

public object? GetObject(String key)
public T? GetObject<T>(String key)
{
if (_cache.TryGetValue<Object>("JToken:" + key, out var value))
if (_cache.TryGetValue<T>("JToken:" + key, out var value))
{
return value;
}
return null;
return default;
}

public List<String> GetKeys()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ private string RemovePunctuation(string text)

private void GenerateOperatorArchiveTable()
{
var characterTable = JsonConvert.DeserializeObject<JToken>(GetText("character_table.json")!) as JObject;
var characterNames = JsonConvert.DeserializeObject<Dictionary<String,String>>(GetText("character_names.json")!);
var characterTable = GetJson("character_table.json") as JObject;
var characterNames = GetObject<Dictionary<String, String>>("character_names.json");
var subClassesTable = GetJson("uniequip_table.json")?["subProfDict"];
var teamTable = GetJson("handbook_team_table.json");
var itemTable = GetJson("item_table.json")!["items"];
var itemTable = GetJson("item_table.json")?["items"];
var handbookInfoTable = GetJson("handbook_info_table.json")?["handbookDict"];

var wordTable = GetJson("charword_table.json");
Expand Down

0 comments on commit 69479eb

Please sign in to comment.