Skip to content

Commit

Permalink
update to recent breaking change with LogNullError
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudokhvist committed May 4, 2022
1 parent 99db074 commit a668901
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 23 deletions.
2 changes: 1 addition & 1 deletion ArchiSteamFarm
Submodule ArchiSteamFarm updated 95 files
+1 −1 .github/CONTRIBUTING.md
+1 −1 .github/FUNDING.yml
+2 −2 .github/RELEASE_TEMPLATE.md
+9 −2 .github/crowdin.yml
+0 −8 .github/renovate.json5
+2 −3 .github/workflows/ci.yml
+3 −3 .github/workflows/docker-ci.yml
+3 −3 .github/workflows/docker-publish-latest.yml
+4 −4 .github/workflows/docker-publish-main.yml
+3 −3 .github/workflows/docker-publish-released.yml
+15 −15 .github/workflows/publish.yml
+3 −3 .github/workflows/translations.yml
+1 −1 ASF-ui
+1 −1 ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs
+1 −1 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/GlobalCache.cs
+31 −10 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/Localization/Strings.he-IL.resx
+0 −0 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/Localization/Strings.zh-Hans.resx
+0 −0 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/Localization/Strings.zh-Hant-HK.resx
+5 −5 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/Localization/Strings.zh-Hant.resx
+7 −7 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/RequestData.cs
+8 −8 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/ResponseData.cs
+1 −1 ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/SteamTokenDumperConfig.cs
+28 −0 ArchiSteamFarm.Tests/Utilities.cs
+1 −2 ArchiSteamFarm/ArchiSteamFarm.csproj
+1 −1 ArchiSteamFarm/Collections/FixedSizeConcurrentQueue.cs
+5 −5 ArchiSteamFarm/Core/ASF.cs
+9 −9 ArchiSteamFarm/Core/ArchiNet.cs
+1 −1 ArchiSteamFarm/Core/OS.cs
+3 −3 ArchiSteamFarm/Core/RemoteCommunication.cs
+26 −13 ArchiSteamFarm/Core/Utilities.cs
+4 −0 ArchiSteamFarm/Helpers/ArchiCryptoHelper.cs
+5 −1 ArchiSteamFarm/Helpers/CrossProcessFileBasedSemaphore.cs
+1 −1 ArchiSteamFarm/IPC/Controllers/Api/ASFController.cs
+4 −1 ArchiSteamFarm/IPC/Controllers/Api/BotController.cs
+1 −1 ArchiSteamFarm/IPC/Controllers/Api/TypeController.cs
+0 −84 ArchiSteamFarm/IPC/Integration/LocalizationMiddleware.cs
+1 −1 ArchiSteamFarm/IPC/Requests/TwoFactorAuthenticationConfirmationsRequest.cs
+5 −32 ArchiSteamFarm/IPC/Startup.cs
+0 −13 ArchiSteamFarm/IPC/WebUtilities.cs
+1 −1 ArchiSteamFarm/Localization/Strings.cs-CZ.resx
+77 −21 ArchiSteamFarm/Localization/Strings.da-DK.resx
+25 −25 ArchiSteamFarm/Localization/Strings.de-DE.resx
+5 −2 ArchiSteamFarm/Localization/Strings.el-GR.resx
+1 −1 ArchiSteamFarm/Localization/Strings.es-ES.resx
+1 −1 ArchiSteamFarm/Localization/Strings.fr-FR.resx
+19 −6 ArchiSteamFarm/Localization/Strings.he-IL.resx
+1 −1 ArchiSteamFarm/Localization/Strings.it-IT.resx
+16 −4 ArchiSteamFarm/Localization/Strings.nl-NL.resx
+1 −1 ArchiSteamFarm/Localization/Strings.pl-PL.resx
+2 −2 ArchiSteamFarm/Localization/Strings.pt-BR.resx
+374 −115 ArchiSteamFarm/Localization/Strings.pt-PT.resx
+1 −1 ArchiSteamFarm/Localization/Strings.qps-Ploc.resx
+1 −1 ArchiSteamFarm/Localization/Strings.ru-RU.resx
+13 −13 ArchiSteamFarm/Localization/Strings.tr-TR.resx
+1 −1 ArchiSteamFarm/Localization/Strings.vi-VN.resx
+1 −1 ArchiSteamFarm/Localization/Strings.zh-Hans.resx
+0 −0 ArchiSteamFarm/Localization/Strings.zh-Hant-HK.resx
+29 −29 ArchiSteamFarm/Localization/Strings.zh-Hant.resx
+1 −1 ArchiSteamFarm/NLog/ArchiLogger.cs
+1 −1 ArchiSteamFarm/NLog/Logging.cs
+1 −1 ArchiSteamFarm/NLog/Targets/HistoryTarget.cs
+8 −1 ArchiSteamFarm/Program.cs
+95 −69 ArchiSteamFarm/Steam/Bot.cs
+34 −34 ArchiSteamFarm/Steam/Cards/CardsFarmer.cs
+2 −2 ArchiSteamFarm/Steam/Data/AccessTokenResponse.cs
+17 −16 ArchiSteamFarm/Steam/Data/Asset.cs
+1 −1 ArchiSteamFarm/Steam/Data/BooleanResponse.cs
+21 −19 ArchiSteamFarm/Steam/Data/InventoryResponse.cs
+1 −1 ArchiSteamFarm/Steam/Data/NewDiscoveryQueueResponse.cs
+35 −0 ArchiSteamFarm/Steam/Data/OptionalResultResponse.cs
+1 −1 ArchiSteamFarm/Steam/Data/RedeemWalletResponse.cs
+1 −3 ArchiSteamFarm/Steam/Data/ResultResponse.cs
+2 −2 ArchiSteamFarm/Steam/Data/Tag.cs
+2 −2 ArchiSteamFarm/Steam/Data/TradeOfferAcceptResponse.cs
+3 −3 ArchiSteamFarm/Steam/Data/TradeOfferSendRequest.cs
+5 −5 ArchiSteamFarm/Steam/Data/TradeOfferSendResponse.cs
+8 −8 ArchiSteamFarm/Steam/Data/UserPrivacy.cs
+2 −1 ArchiSteamFarm/Steam/Exchange/Trading.cs
+53 −51 ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs
+1 −1 ArchiSteamFarm/Steam/Integration/SteamSaleEvent.cs
+2 −2 ArchiSteamFarm/Steam/Integration/SteamUtilities.cs
+12 −12 ArchiSteamFarm/Steam/Security/MobileAuthenticator.cs
+5 −26 ArchiSteamFarm/Steam/Storage/BotConfig.cs
+3 −3 ArchiSteamFarm/Steam/Storage/BotDatabase.cs
+3 −13 ArchiSteamFarm/Storage/GlobalConfig.cs
+3 −3 ArchiSteamFarm/Storage/GlobalDatabase.cs
+16 −16 ArchiSteamFarm/Web/GitHub.cs
+5 −1 ArchiSteamFarm/Web/WebBrowser.cs
+4 −1 Directory.Build.props
+10 −11 Directory.Packages.props
+1 −4 Dockerfile
+1 −4 Dockerfile.Service
+0 −0 LICENSE.txt
+5 −5 README.md
+1 −1 wiki
4 changes: 2 additions & 2 deletions BoosterCreator/BoosterCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ public async Task OnBotInitModules(Bot bot, IReadOnlyDictionary<string, JToken>?
foreach (KeyValuePair<string, JToken> configProperty in additionalConfigProperties) {
switch (configProperty.Key) {
case "GamesToBooster" when configProperty.Value.Type == JTokenType.Array && configProperty.Value.Any(): {
if (BoosterHandler.BoosterHandlers.ContainsKey(bot.BotName)&&(BoosterHandler.BoosterHandlers[bot.BotName] != null)) {
if (BoosterHandler.BoosterHandlers.ContainsKey(bot.BotName) && (BoosterHandler.BoosterHandlers[bot.BotName] != null)) {
BoosterHandler.BoosterHandlers[bot.BotName]!.Dispose();
BoosterHandler.BoosterHandlers[bot.BotName] = null;
}

bot.ArchiLogger.LogGenericInfo("Games To Booster : " + string.Join(",", configProperty.Value));
IReadOnlyCollection<uint>? gameIDs = configProperty.Value.ToObject<HashSet<uint>>();
if (gameIDs == null) {
bot.ArchiLogger.LogNullError(nameof(gameIDs));
bot.ArchiLogger.LogNullError(gameIDs);
} else {
await Task.Run(() => BoosterHandler.BoosterHandlers[bot.BotName] = new BoosterHandler(bot, gameIDs)).ConfigureAwait(false);
}
Expand Down
2 changes: 1 addition & 1 deletion BoosterCreator/BoosterCreator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0;net48</TargetFrameworks>
<Authors>Out</Authors>
<AssemblyVersion>1.2.2.0</AssemblyVersion>
<AssemblyVersion>1.2.3.0</AssemblyVersion>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
20 changes: 8 additions & 12 deletions BoosterCreator/BoosterHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ internal BoosterHandler(Bot bot, IReadOnlyCollection<uint> gameIDs) {
foreach (uint gameID in gameIDs) {
if (GameIDs.TryAdd(gameID, DateTime.Now.AddMinutes(GetBotIndex(bot) * DelayBetweenBots))) {
bot.ArchiLogger.LogGenericInfo(Commands.FormatBotResponse(bot, "Auto-attempt to make booster from " + gameID.ToString() + " is planned at " + GameIDs[gameID]!.Value.ToShortDateString() + " " + GameIDs[gameID]!.Value.ToShortTimeString()));
}
else {
} else {
bot.ArchiLogger.LogGenericError("Unable to schedule next auto-attempt");
}
}
Expand All @@ -63,13 +62,13 @@ private async Task AutoBooster() {

internal static async Task<string?> CreateBooster(Bot bot, ConcurrentDictionary<uint, DateTime?> gameIDs) {
if (!gameIDs.Any()) {
bot.ArchiLogger.LogNullError(nameof(gameIDs));
bot.ArchiLogger.LogNullError(null, nameof(gameIDs));

return null;
}
IDocument? boosterPage = await WebRequest.GetBoosterPage(bot).ConfigureAwait(false);
if (boosterPage == null) {
bot.ArchiLogger.LogNullError(nameof(boosterPage));
bot.ArchiLogger.LogNullError(boosterPage);

return Commands.FormatBotResponse(bot, string.Format(Strings.ErrorFailingRequest, nameof(boosterPage)));
;
Expand All @@ -86,7 +85,7 @@ private async Task AutoBooster() {

IEnumerable<Steam.BoosterInfo>? enumerableBoosters = JsonConvert.DeserializeObject<IEnumerable<Steam.BoosterInfo>>(info.Value);
if (enumerableBoosters == null) {
bot.ArchiLogger.LogNullError(nameof(enumerableBoosters));
bot.ArchiLogger.LogNullError(enumerableBoosters);
return Commands.FormatBotResponse(bot, string.Format(Strings.ErrorParsingObject, nameof(enumerableBoosters)));
}

Expand Down Expand Up @@ -124,17 +123,15 @@ private async Task AutoBooster() {
string timeFormat;
if (!string.IsNullOrWhiteSpace(bi.AvailableAtTime) && char.IsDigit(bi.AvailableAtTime.Trim()[0])) {
timeFormat = "d MMM @ h:mmtt";
}
else {
} else {
timeFormat = "MMM d @ h:mmtt";
}

response.AppendLine(Commands.FormatBotResponse(bot, "Crafting booster from " + gameID.Key.ToString() + " will be available at time: " + bi.AvailableAtTime));
bot.ArchiLogger.LogGenericInfo(Commands.FormatBotResponse(bot, "Crafting booster from " + gameID.Key.ToString() + " is not available now"));
//Wait until specified time
if (DateTime.TryParseExact(bi.AvailableAtTime, timeFormat, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime availableAtTime)) {
}
else {
} else {
bot.ArchiLogger.LogGenericInfo("Unable to parse time \"" + bi.AvailableAtTime + "\", please report this.");
availableAtTime = DateTime.Now.AddHours(8); //fallback to 8 hours in case of error
}
Expand All @@ -148,9 +145,8 @@ private async Task AutoBooster() {
uint nTp;

if (unTradableGooAmount > 0) {
nTp = tradableGooAmount > bi.Price ? (uint)1 : 3;
}
else {
nTp = tradableGooAmount > bi.Price ? (uint) 1 : 3;
} else {
nTp = 2;
}
Steam.BoostersResponse? result = await WebRequest.CreateBooster(bot, bi.AppID, bi.Series, nTp).ConfigureAwait(false);
Expand Down
6 changes: 3 additions & 3 deletions BoosterCreator/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ internal static class Commands {
}

private static async Task<string?> ResponseBooster(Bot bot, EAccess access, string targetGameIDs) {
if ( string.IsNullOrEmpty(targetGameIDs)) {
ASF.ArchiLogger.LogNullError(nameof(targetGameIDs));
if (string.IsNullOrEmpty(targetGameIDs)) {
ASF.ArchiLogger.LogNullError(null, nameof(targetGameIDs));

return null;
}
Expand Down Expand Up @@ -58,7 +58,7 @@ internal static class Commands {

private static async Task<string?> ResponseBooster(EAccess access, ulong steamID, string botNames, string targetGameIDs) {
if (string.IsNullOrEmpty(botNames) || string.IsNullOrEmpty(targetGameIDs)) {
ASF.ArchiLogger.LogNullError(nameof(botNames) + " || " + nameof(targetGameIDs));
ASF.ArchiLogger.LogNullError(null, nameof(botNames) + " || " + nameof(targetGameIDs));

return null;
}
Expand Down
2 changes: 1 addition & 1 deletion BoosterCreator/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal static class WebRequest {

internal static async Task<Steam.BoostersResponse?> CreateBooster(Bot bot, uint appID, uint series, uint nTradabilityPreference) {
if (appID == 0) {
bot.ArchiLogger.LogNullError(nameof(appID));
bot.ArchiLogger.LogNullError(null, nameof(appID));

return null;
}
Expand Down
24 changes: 21 additions & 3 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ rem release generic version
dotnet publish -c "Release" -f "net6.0" -o "out/generic" "/p:LinkDuringPublish=false"
mkdir .\out\%CurrDirName%
copy .\out\generic\%CurrDirName%.dll .\out\%CurrDirName%
copy .\README.md .\out\%CurrDirName%
rem comment section below (downto :zip label) if you don't want to include documentation
if not exist README.md (goto zip)
where /q pandoc.exe
if ERRORLEVEL 1 (
copy README.md .\out\%CurrDirName%
goto zip
) else (
pandoc --metadata title="%CurrDirName%" --standalone --columns 2000 -f markdown -t html --self-contained -c .\github-pandoc.css -o .\out\%CurrDirName%\README.html README.md
)
:zip
7z a -tzip -mx7 .\out\%CurrDirName%.zip .\out\%CurrDirName%
rmdir /Q /S out\%CurrDirName%

Expand All @@ -34,6 +43,15 @@ rem comment section below if you don't target netf ASF version
dotnet publish -c "Release" -f "net48" -o "out/generic-netf"
mkdir .\out\%CurrDirName%
copy .\out\generic-netf\%CurrDirName%.dll .\out\%CurrDirName%
copy .\README.md .\out\%CurrDirName%
rem comment section below (downto :zipnetf label) if you don't want to include documentation
if not exist README.md (goto zipnetf)
where /q pandoc.exe
if ERRORLEVEL 1 (
copy README.md .\out\%CurrDirName%
goto zipnetf
) else (
pandoc --metadata title="%CurrDirName%" --standalone --columns 2000 -f markdown -t html --self-contained -c .\github-pandoc.css -o .\out\%CurrDirName%\README.html README.md
)
:zipnetf
7z a -tzip -mx7 .\out\%CurrDirName%-netf.zip .\out\%CurrDirName%
rmdir /Q /S out\%CurrDirName%
rmdir /Q /S out\%CurrDirName%
Loading

0 comments on commit a668901

Please sign in to comment.