Skip to content

Commit

Permalink
style 修改代码格式
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Aug 1, 2023
1 parent e9b8847 commit 4cfe8d8
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 11 deletions.
32 changes: 32 additions & 0 deletions ASFEnhance/Data/CheckGameResponse.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
namespace ASFEnhance.Data;

/// <summary>
/// 获取游戏详情
/// </summary>
public sealed record CheckGameResponse
{
/// <summary>
/// 是否成功
/// </summary>
public bool Success { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否已拥有
/// </summary>
public bool Owned { get; set; }
/// <summary>
/// 是否添加愿望单
/// </summary>
public bool InWishlist { get; set; }
/// <summary>
/// 是否已关注
/// </summary>
public bool IsFollow { get; set; }

/// <summary>
/// 构造函数
/// </summary>
/// <param name="success"></param>
/// <param name="name"></param>
public CheckGameResponse(bool success, string name)
{
Success = success;
Name = name;
}

/// <summary>
/// 构造函数
/// </summary>
/// <param name="success"></param>
/// <param name="name"></param>
/// <param name="owned"></param>
/// <param name="inWishlist"></param>
/// <param name="isFollow"></param>
public CheckGameResponse(bool success, string name, bool owned, bool inWishlist, bool isFollow)
{
Success = success;
Expand Down
27 changes: 27 additions & 0 deletions ASFEnhance/Data/CuratorItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,56 @@

namespace ASFEnhance.Data;

/// <summary>
/// 鉴赏家信息
/// </summary>
public sealed record CuratorItem
{
/// <summary>
/// 名称
/// </summary>
[JsonProperty("name", Required = Required.Always)]
public string Name { get; set; } = "";

/// <summary>
/// 描述
/// </summary>
[JsonProperty("curator_description", Required = Required.Always)]
public string Description { get; set; } = "";

/// <summary>
/// ID
/// </summary>
[JsonProperty("clanId", Required = Required.Always)]
public string ClanId { get; set; } = "";

/// <summary>
/// 关注人数
/// </summary>
[JsonProperty("total_followers", Required = Required.Always)]
public uint TotalFollowers { get; set; }

/// <summary>
/// 评测数量
/// </summary>
[JsonProperty("total_reviews", Required = Required.Always)]
public uint TotalReviews { get; set; }

/// <summary>
/// 推荐评测数量
/// </summary>
[JsonProperty("total_recommended", Required = Required.Always)]
public uint TotalRecommanded { get; set; }

/// <summary>
/// 不推荐评测数量
/// </summary>
[JsonProperty("total_not_recommended", Required = Required.Always)]
public uint TotalNotRecommanded { get; set; }

/// <summary>
/// 情报评测数量
/// </summary>
[JsonProperty("total_informative", Required = Required.Always)]
public uint TotalInformative { get; set; }
}
4 changes: 2 additions & 2 deletions ASFEnhance/IPC/Controllers/PurchaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public async Task<ActionResult<GenericResponse>> PurchaseGame(string botNames, [
//记录购物车
{
var results = await Utilities.InParallel(bots.Select(
async bot =>
async bot =>
{
if (!bot.IsConnectedAndLoggedOn) { return (bot.BotName, new()); }
Expand All @@ -223,7 +223,7 @@ public async Task<ActionResult<GenericResponse>> PurchaseGame(string botNames, [
if (cartData == null)
{
result.CartItems.Add(new()
result.CartItems.Add(new CartItem
{
Type = "Error",
Id = 0,
Expand Down
5 changes: 4 additions & 1 deletion ASFEnhance/IPC/Requests/AppIDListRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ namespace ASFEnhance.IPC.Requests;
/// </summary>
public sealed record AppIdListRequest
{
/// <summary>
/// AppId列表
/// </summary>
[JsonProperty(Required = Required.Always)]
[Required]
public HashSet<uint> AppIds { get; set; } = new();
public HashSet<uint>? AppIds { get; set; }
}
5 changes: 4 additions & 1 deletion ASFEnhance/IPC/Requests/ClainIDListRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ namespace ASFEnhance.IPC.Requests;
/// </summary>
public sealed record ClanIdListRequest
{
/// <summary>
/// 鉴赏家ID列表
/// </summary>
[JsonProperty(Required = Required.Always)]
[Required]
public HashSet<uint> ClanIds { get; set; } = new();
public HashSet<uint>? ClanIds { get; set; }
}
12 changes: 12 additions & 0 deletions ASFEnhance/IPC/Requests/PurchaseRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,27 @@ namespace ASFEnhance.IPC.Requests;
/// </summary>
public sealed record PurchaseRequest
{
/// <summary>
/// SubID列表
/// </summary>
[JsonProperty(Required = Required.Default)]
public HashSet<uint>? SubIds { get; set; }

/// <summary>
/// BundleID列表
/// </summary>
[JsonProperty(Required = Required.Default)]
public HashSet<uint>? BundleIds { get; set; }

/// <summary>
/// 跳过已拥有
/// </summary>
[JsonProperty(Required = Required.DisallowNull)]
public bool SkipOwned { get; set; } = true;

/// <summary>
/// 卡单
/// </summary>
[JsonProperty(Required = Required.DisallowNull)]
public bool FakePurchase { get; set; }
}
23 changes: 22 additions & 1 deletion ASFEnhance/IPC/Requests/RecommendRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,52 @@ namespace ASFEnhance.IPC.Requests;
/// </summary>
public sealed record RecommendRequest
{
/// <summary>
/// 评测列表
/// </summary>
[JsonProperty(Required = Required.Always)]
[Required]
public HashSet<RecommendOption> Recommends { get; set; } = new();
public HashSet<RecommendOption>? Recommends { get; set; }
}
/// <summary>
/// 评测选项
/// </summary>
public sealed record RecommendOption
{
/// <summary>
/// AppId
/// </summary>
[JsonProperty(Required = Required.Always)]
[Required]
public uint AppId { get; set; }

/// <summary>
/// 是否推荐
/// </summary>
[JsonProperty(Required = Required.DisallowNull)]
public bool RateUp { get; set; } = true;

/// <summary>
/// 允许回复
/// </summary>
[JsonProperty(Required = Required.DisallowNull)]
public bool AllowReply { get; set; } = true;

/// <summary>
/// 免费获取的游戏
/// </summary>
[JsonProperty(Required = Required.DisallowNull)]
public bool ForFree { get; set; }

/// <summary>
/// 是否公开
/// </summary>
[JsonProperty(Required = Required.DisallowNull)]
public bool Public { get; set; } = true;

/// <summary>
/// 评测内容
/// </summary>
[JsonProperty(Required = Required.Always)]
[Required]
public string Comment { get; set; } = "";
Expand Down
38 changes: 37 additions & 1 deletion ASFEnhance/IPC/Responses/AppDetailResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,55 @@ public sealed class AppDetailDictResponse : Dictionary<string, AppDetail>
/// </summary>
public sealed record AppDetail
{
/// <summary>
/// 是否成功
/// </summary>
public bool Success { get; set; }
/// <summary>
/// AppID
/// </summary>
public uint AppId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; } = "";
/// <summary>
/// 说明
/// </summary>
public string Desc { get; set; } = "";
/// <summary>
/// 是否免费
/// </summary>
public bool IsFree { get; set; }
/// <summary>
/// 是否已发售
/// </summary>
public bool Released { get; set; }
public HashSet<SubInfo> Subs { get; set; } = new();
/// <summary>
/// SubID列表
/// </summary>
public HashSet<SubInfo>? Subs { get; set; }
}

/// <summary>
/// Sub信息
/// </summary>
public sealed record SubInfo
{
/// <summary>
/// SubID
/// </summary>
public uint SubId { get; set; }
/// <summary>
/// 是否免费
/// </summary>
public bool IsFree { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; } = "";
}
3 changes: 3 additions & 0 deletions ASFEnhance/IPC/Responses/BoolDictResponse.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace ASFEnhance.IPC.Responses;

/// <summary>
/// 机器人字典响应
/// </summary>
public sealed class BoolDictResponse : Dictionary<string, bool>
{
}
27 changes: 27 additions & 0 deletions ASFEnhance/IPC/Responses/BotSummaryResponse.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
namespace ASFEnhance.IPC.Responses;

/// <summary>
/// 机器人信息响应
/// </summary>
public sealed record BotSummaryResponse
{
/// <summary>
/// 是否成功
/// </summary>
public bool Success { get; set; }
/// <summary>
/// 货币
/// </summary>
public string Currency { get; set; } = "";
/// <summary>
/// 钱包余额
/// </summary>
public long Balance { get; set; }
/// <summary>
/// 格式化钱包余额
/// </summary>
public string FormatBalance { get; set; } = "";
/// <summary>
/// 昵称
/// </summary>
public string Nick { get; set; } = "";
/// <summary>
/// 个人资料链接
/// </summary>
public string ProfileLink { get; set; } = "";
/// <summary>
/// SteamId
/// </summary>
public ulong SteamId { get; set; }
/// <summary>
/// 好友代码
/// </summary>
public ulong FriendCode { get; set; }
}
3 changes: 3 additions & 0 deletions ASFEnhance/IPC/Responses/CheckGameDictResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace ASFEnhance.IPC.Responses;

/// <summary>
/// 获取游戏关注信息响应
/// </summary>
public sealed class CheckGameDictResponse : Dictionary<string, CheckGameResponse>
{
}
10 changes: 5 additions & 5 deletions ASFEnhance/IPC/Responses/PurchaseResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace ASFEnhance.IPC.Responses;
public sealed record PurchaseResultResponse
{
/// <inheritdoc cref="Responses.AddCartResult"/>
public AddCartResult? AddCartResult { get; set; }
public AddCartResult AddCartResult { get; set; } = new();
/// <inheritdoc cref="Responses.PurchaseResult"/>
public PurchaseResult? PurchaseResult { get; set; }
public PurchaseResult PurchaseResult { get; set; } = new();
}

/// <summary>
Expand All @@ -19,11 +19,11 @@ public sealed record AddCartResult
/// <summary>
/// SubIds
/// </summary>
public Dictionary<string, bool>? SubIds { get; set; }
public Dictionary<string, bool> SubIds { get; set; } = new();
/// <summary>
/// 捆绑包Ids
/// </summary>
public Dictionary<string, bool>? BundleIds { get; set; }
public Dictionary<string, bool> BundleIds { get; set; } = new();
/// <summary>
/// 是否能为自己购买
/// </summary>
Expand All @@ -40,7 +40,7 @@ public sealed record AddCartResult
public sealed record PurchaseResult
{
/// <inheritdoc cref="CartItem"/>
public HashSet<CartItem>? CartItems { get; set; }
public HashSet<CartItem> CartItems { get; set; } = new();
/// <summary>
/// 是否成功
/// </summary>
Expand Down

0 comments on commit 4cfe8d8

Please sign in to comment.