~ruther/NosSmooth

321ecad945d1e052a6d94128dbc5e6e705922c94 — František Boháček 3 years ago 193df6e
feat(data): make info and language service asynchronous
M Data/NosSmooth.Data.Abstractions/IInfoService.cs => Data/NosSmooth.Data.Abstractions/IInfoService.cs +8 -4
@@ 18,27 18,31 @@ public interface IInfoService
    /// Gets the information about an item.
    /// </summary>
    /// <param name="vnum">The vnum identifier of the item.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>An item info or an error.</returns>
    public Result<IItemInfo> GetItemInfo(int vnum);
    public Task<Result<IItemInfo>> GetItemInfoAsync(int vnum, CancellationToken ct = default);

    /// <summary>
    /// Gets the information about a map.
    /// </summary>
    /// <param name="id">The identifier of the map.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>A map info or an error.</returns>
    public Result<IMapInfo> GetMapInfo(int id);
    public Task<Result<IMapInfo>> GetMapInfoAsync(int id, CancellationToken ct = default);

    /// <summary>
    /// Gets the information about a monster.
    /// </summary>
    /// <param name="vnum">The vnum identifier of the monster.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>A monster or an error.</returns>
    public Result<IMonsterInfo> GetMonsterInfo(int vnum);
    public Task<Result<IMonsterInfo>> GetMonsterInfoAsync(int vnum, CancellationToken ct = default);

    /// <summary>
    /// Gets the information about a skill.
    /// </summary>
    /// <param name="vnum">The vnum identifier of the skill.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>A map or an error.</returns>
    public Result<ISkillInfo> GetSkillInfo(int vnum);
    public Task<Result<ISkillInfo>> GetSkillInfoAsync(int vnum, CancellationToken ct = default);
}
\ No newline at end of file

M Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs => Data/NosSmooth.Data.Abstractions/Language/ILanguageService.cs +4 -2
@@ 24,14 24,16 @@ public interface ILanguageService
    /// <param name="root">The root type of the key.</param>
    /// <param name="key">The key to translate.</param>
    /// <param name="language">The language, <see cref="CurrentLanguage"/> will be used if null.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>The translated string or an error.</returns>
    public Result<string> GetTranslation(TranslationRoot root, string key, Language? language = default);
    public Task<Result<string>> GetTranslationAsync(TranslationRoot root, string key, Language? language = default, CancellationToken ct = default);

    /// <summary>
    /// Gets the translation of the given key.
    /// </summary>
    /// <param name="translatableString">The translatable string containing .</param>
    /// <param name="language">The language, <see cref="CurrentLanguage"/> will be used if null.</param>
    /// <param name="ct">The cancellation token for cancelling the operation.</param>
    /// <returns>The translated string or an error.</returns>
    public Result<string> GetTranslation(TranslatableString translatableString, Language? language = default);
    public Task<Result<string>> GetTranslationAsync(TranslatableString translatableString, Language? language = default, CancellationToken ct = default);
}
\ No newline at end of file

Do not follow this link