mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 09:00:13 +00:00
Use streams for http responses instead of strings where possible, replace HtmlAgilityPack with AngleSharp (#1703)
* Replace HAP with AngleSharp, add stream support to WebBrowser * Fix skipped nullable operator * Add extension method * Rename function to be closer to HAP API * Add JSON deserialization from stream, fix variable names, remove obsolete code * Add more extension methods * Fixes after review: Remove excessive dependency Move string value to const Different handling for null and empty cases for confirmations Use more human-friendly names * Add http completion options, make GetToStream private * Cleanup * Add null checks, make StreamResponse disposable * Refactor UrlGetToBinaryWithProgress into using UrlGetToStream
This commit is contained in:
@@ -23,8 +23,8 @@ using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AngleSharp.Dom;
|
||||
using ArchiSteamFarm.Localization;
|
||||
using HtmlAgilityPack;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
@@ -83,20 +83,20 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
private async Task<bool?> IsDiscoveryQueueAvailable() {
|
||||
HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetDiscoveryQueuePage().ConfigureAwait(false);
|
||||
IDocument htmlDocument = await Bot.ArchiWebHandler.GetDiscoveryQueuePage().ConfigureAwait(false);
|
||||
|
||||
if (htmlDocument == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
HtmlNode htmlNode = htmlDocument.DocumentNode.SelectSingleNode("//div[@class='subtext']");
|
||||
IElement htmlNode = htmlDocument.SelectSingleNode("//div[@class='subtext']");
|
||||
|
||||
if (htmlNode == null) {
|
||||
// Valid, no cards for exploring the queue available
|
||||
return false;
|
||||
}
|
||||
|
||||
string text = htmlNode.InnerText;
|
||||
string text = htmlNode.TextContent;
|
||||
|
||||
if (string.IsNullOrEmpty(text)) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(text));
|
||||
|
||||
Reference in New Issue
Block a user