Skip to content

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Apr 19, 2022
1 parent e5a33f0 commit 9e6cf02
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ASFEnhance/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Reflection;

[assembly: System.CLSCompliant(false)]
[assembly: AssemblyVersion("1.5.16.287")]
[assembly: AssemblyFileVersion("1.5.16.287")]
[assembly: AssemblyVersion("1.5.17.289")]
[assembly: AssemblyFileVersion("1.5.17.289")]

[assembly: AssemblyCopyright("Copyright © 2022 Chr_")]
[assembly: AssemblyProduct("ASFEnhance")]
Expand Down
28 changes: 19 additions & 9 deletions ASFEnhance/Cart/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@ internal static class WebRequest
return HtmlParser.ParseCertPage(response);
}

/// <summary>
/// 添加到购物车
/// </summary>
/// <param name="bot"></param>
/// <param name="gameID"></param>
/// <returns></returns>
internal static async Task<bool?> AddCert(Bot bot, SteamGameID gameID)
{
switch (gameID.Type)
if(gameID.Type == SteamGameIDType.Sub || gameID.Type == SteamGameIDType.Bundle)
{
case SteamGameIDType.Sub:
return await AddCert(bot, gameID.GameID, false).ConfigureAwait(false);
case SteamGameIDType.Bundle:
return await AddCert(bot, gameID.GameID, true).ConfigureAwait(false);
default:
return null;
return await AddCert(bot, gameID.GameID, gameID.Type == SteamGameIDType.Bundle).ConfigureAwait(false);
}
else
{
return null;
}
}


/// <summary>
/// 添加到购物车
/// </summary>
Expand Down Expand Up @@ -380,12 +384,18 @@ internal static async Task<bool> CartSetCountry(Bot bot, string countryCode)

ObjectResponse<TransactionStatusResponse?> response2 = await bot.ArchiWebHandler.UrlGetToJsonObjectWithSession<TransactionStatusResponse>(request, referer: referer).ConfigureAwait(false);

if (response2 == null)
if (response == null)
{
bot.ArchiLogger.LogNullError(nameof(response));
return null;
}

if (response2 == null)
{
bot.ArchiLogger.LogNullError(nameof(response2));
return null;
}

return response2;
}
}
Expand Down

0 comments on commit 9e6cf02

Please sign in to comment.