mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 14:30:31 +00:00
EXPERIMENTAL: Make GetConfirmations() recursive
This commit is contained in:
@@ -14,6 +14,8 @@
|
|||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHING_EMPTY_BRACES/@EntryValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHING_EMPTY_BRACES/@EntryValue">True</s:Boolean>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/TYPE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/TYPE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
|
||||||
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">255</s:Int64>
|
||||||
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean>
|
||||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String>
|
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
|
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
|
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
|
||||||
|
|||||||
@@ -213,60 +213,62 @@ namespace ArchiSteamFarm {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetConfirmations(DeviceID, confirmationHash, time).ConfigureAwait(false);
|
|
||||||
|
|
||||||
HtmlNodeCollection confirmationNodes = htmlDocument?.DocumentNode.SelectNodes("//div[@class='mobileconf_list_entry']");
|
|
||||||
if (confirmationNodes == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
HashSet<Confirmation> result = new HashSet<Confirmation>();
|
HashSet<Confirmation> result = new HashSet<Confirmation>();
|
||||||
foreach (HtmlNode confirmationNode in confirmationNodes) {
|
|
||||||
string idString = confirmationNode.GetAttributeValue("data-confid", null);
|
while (true) {
|
||||||
if (string.IsNullOrEmpty(idString)) {
|
HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetConfirmations(DeviceID, confirmationHash, time).ConfigureAwait(false);
|
||||||
Logging.LogNullError(nameof(idString), Bot.BotName);
|
|
||||||
return null;
|
HtmlNodeCollection confirmationNodes = htmlDocument?.DocumentNode.SelectNodes("//div[@class='mobileconf_list_entry']");
|
||||||
|
if (confirmationNodes == null) {
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint id;
|
foreach (HtmlNode confirmationNode in confirmationNodes) {
|
||||||
if (!uint.TryParse(idString, out id) || (id == 0)) {
|
string idString = confirmationNode.GetAttributeValue("data-confid", null);
|
||||||
Logging.LogNullError(nameof(id), Bot.BotName);
|
if (string.IsNullOrEmpty(idString)) {
|
||||||
return null;
|
Logging.LogNullError(nameof(idString), Bot.BotName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint id;
|
||||||
|
if (!uint.TryParse(idString, out id) || (id == 0)) {
|
||||||
|
Logging.LogNullError(nameof(id), Bot.BotName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
string keyString = confirmationNode.GetAttributeValue("data-key", null);
|
||||||
|
if (string.IsNullOrEmpty(keyString)) {
|
||||||
|
Logging.LogNullError(nameof(keyString), Bot.BotName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong key;
|
||||||
|
if (!ulong.TryParse(keyString, out key) || (key == 0)) {
|
||||||
|
Logging.LogNullError(nameof(key), Bot.BotName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
HtmlNode descriptionNode = confirmationNode.SelectSingleNode(".//div[@class='mobileconf_list_entry_description']/div");
|
||||||
|
if (descriptionNode == null) {
|
||||||
|
Logging.LogNullError(nameof(descriptionNode), Bot.BotName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Steam.ConfirmationDetails.EType type;
|
||||||
|
|
||||||
|
string description = descriptionNode.InnerText;
|
||||||
|
if (description.Equals("Sell - Market Listing")) {
|
||||||
|
type = Steam.ConfirmationDetails.EType.Market;
|
||||||
|
} else if (description.StartsWith("Trade with ", StringComparison.Ordinal)) {
|
||||||
|
type = Steam.ConfirmationDetails.EType.Trade;
|
||||||
|
} else {
|
||||||
|
Logging.LogGenericWarning("Received unknown confirmation type, please report this: " + description, Bot.BotName);
|
||||||
|
type = Steam.ConfirmationDetails.EType.Other;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Add(new Confirmation(id, key, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
string keyString = confirmationNode.GetAttributeValue("data-key", null);
|
|
||||||
if (string.IsNullOrEmpty(keyString)) {
|
|
||||||
Logging.LogNullError(nameof(keyString), Bot.BotName);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ulong key;
|
|
||||||
if (!ulong.TryParse(keyString, out key) || (key == 0)) {
|
|
||||||
Logging.LogNullError(nameof(key), Bot.BotName);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
HtmlNode descriptionNode = confirmationNode.SelectSingleNode(".//div[@class='mobileconf_list_entry_description']/div");
|
|
||||||
if (descriptionNode == null) {
|
|
||||||
Logging.LogNullError(nameof(descriptionNode), Bot.BotName);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Steam.ConfirmationDetails.EType type;
|
|
||||||
|
|
||||||
string description = descriptionNode.InnerText;
|
|
||||||
if (description.Equals("Sell - Market Listing")) {
|
|
||||||
type = Steam.ConfirmationDetails.EType.Market;
|
|
||||||
} else if (description.StartsWith("Trade with ", StringComparison.Ordinal)) {
|
|
||||||
type = Steam.ConfirmationDetails.EType.Trade;
|
|
||||||
} else {
|
|
||||||
type = Steam.ConfirmationDetails.EType.Other;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Add(new Confirmation(id, key, type));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<uint> GetSteamTime() {
|
private async Task<uint> GetSteamTime() {
|
||||||
|
|||||||
Reference in New Issue
Block a user