public bool TryGetHistoricalStatDefinition(string key, BungieLocales locale,
                                               out DestinyHistoricalStatsDefinition definition)
    {
        if (Repository.TryGetDestinyHistoricalDefinition(locale, key, out definition))
        {
            return(true);
        }

        var getterTask = DefinitionProvider.LoadHistoricalStatsDefinition(key, locale);

        definition = getterTask.GetAwaiter().GetResult();

        if (!getterTask.IsCompleted)
        {
            throw new Exception("ValueTask faulted to get result.");
        }

        if (definition is null)
        {
            return(false);
        }
        if (_configuration.CacheDefinitions)
        {
            Repository.AddDestinyHistoricalDefinition(locale, definition);
        }
        return(true);
    }
Beispiel #2
0
 public bool TryGetDestinyHistoricalDefinition(
     BungieLocales locale,
     string key,
     out DestinyHistoricalStatsDefinition statsDefinition)
 {
     statsDefinition = default;
     return(_localisedRepositories.TryGetValue(locale, out var repository) &&
            repository.TryGetHistoricalStatsDefinition(key, out statsDefinition));
 }
Beispiel #3
0
 public bool AddDestinyHistoricalStatsDefinition(DestinyHistoricalStatsDefinition definition)
 {
     return(_historicalStatsDefinitions.TryAdd(definition.StatId, definition));
 }
Beispiel #4
0
 public bool TryGetHistoricalStatsDefinition(string name, out DestinyHistoricalStatsDefinition val)
 {
     return(_historicalStatsDefinitions.TryGetValue(name, out val));
 }
Beispiel #5
0
 public bool AddDestinyHistoricalDefinition(BungieLocales locale,
                                            DestinyHistoricalStatsDefinition statsDefinition)
 {
     return(_localisedRepositories.TryGetValue(locale, out var repository) &&
            repository.AddDestinyHistoricalStatsDefinition(statsDefinition));
 }
Beispiel #6
0
 public bool TryGetDestinyHistoricalDefinition(BungieLocales locale, string key,
                                               out DestinyHistoricalStatsDefinition statsDefinition)
 {
     return(_localisedRepositories[locale].TryGetHistoricalStatsDefinition(key, out statsDefinition));
 }
Beispiel #7
0
 public bool AddDestinyHistoricalDefinition(BungieLocales locale,
                                            DestinyHistoricalStatsDefinition statsDefinition)
 {
     return(_localisedRepositories[locale].AddDestinyHistoricalStatsDefinition(statsDefinition));
 }