mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 16:08:15 +08:00
optimization request http
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Application;
|
||||
using System.Application.Services;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Application
|
||||
{
|
||||
/// <summary>
|
||||
/// 图片下载渠道类型
|
||||
/// </summary>
|
||||
public enum ImageChannelType
|
||||
{
|
||||
/// <summary>
|
||||
/// Steam 头像图片
|
||||
/// </summary>
|
||||
SteamAvatars,
|
||||
|
||||
/// <summary>
|
||||
/// Steam 游戏图片
|
||||
/// </summary>
|
||||
SteamGames,
|
||||
}
|
||||
}
|
||||
|
||||
namespace System
|
||||
{
|
||||
public static class ImageChannelTypeEnumExtensions
|
||||
{
|
||||
/// <inheritdoc cref="IHttpService.GetImageAsync(string, string, CancellationToken)"/>
|
||||
public static Task<Stream?> GetImageAsync(this IHttpService httpService,
|
||||
string requestUri,
|
||||
ImageChannelType channelType,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var channelType_ = channelType.ToString();
|
||||
return httpService.GetImageAsync(requestUri, channelType_, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user