Compare commits

..

14 Commits

Author SHA1 Message Date
JustArchi
0dc57a3532 Translations update 2020-04-08 14:17:45 +02:00
JustArchi
47b729a14d Correct wrong retrying logic for streams 2020-04-08 13:01:21 +02:00
JustArchi
7a521da68b Update WebBrowser.cs 2020-04-08 12:52:01 +02:00
JustArchi
960dbf9b71 Misc refactor 2020-04-08 12:50:58 +02:00
dependabot-preview[bot]
e8097be48a Bump ASF-WebConfigGenerator from 75e2e8e to a366c05
Bumps [ASF-WebConfigGenerator](https://github.com/JustArchiNET/ASF-WebConfigGenerator) from `75e2e8e` to `a366c05`.
- [Release notes](https://github.com/JustArchiNET/ASF-WebConfigGenerator/releases)
- [Commits](75e2e8eec6...a366c05e95)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-08 01:26:07 +00:00
dependabot-preview[bot]
00c53244c4 Bump ASF-ui from 42324c9 to 9a32c65
Bumps [ASF-ui](https://github.com/JustArchiNET/ASF-ui) from `42324c9` to `9a32c65`.
- [Release notes](https://github.com/JustArchiNET/ASF-ui/releases)
- [Commits](42324c94be...9a32c656df)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-08 01:22:24 +00:00
Vitaliy
5e39731a27 Catch exceptions when creating HtmlDocument from stream (#1725)
* Catch exceptions when creating HtmlDocument from stream

* Use proper retry logic if exception occured

* Add null check for document
2020-04-07 22:12:01 +02:00
dependabot-preview[bot]
c852f024a2 Bump ASF-ui from 6e3c497 to 42324c9
Bumps [ASF-ui](https://github.com/JustArchiNET/ASF-ui) from `6e3c497` to `42324c9`.
- [Release notes](https://github.com/JustArchiNET/ASF-ui/releases)
- [Commits](6e3c4972ff...42324c94be)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-07 01:26:25 +00:00
dependabot-preview[bot]
45ac5ac6f6 Bump ASF-WebConfigGenerator from cd7f4c1 to 75e2e8e
Bumps [ASF-WebConfigGenerator](https://github.com/JustArchiNET/ASF-WebConfigGenerator) from `cd7f4c1` to `75e2e8e`.
- [Release notes](https://github.com/JustArchiNET/ASF-WebConfigGenerator/releases)
- [Commits](cd7f4c14ad...75e2e8eec6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-07 01:21:13 +00:00
JustArchi
704fb06460 Misc refactor 2020-04-06 20:42:26 +02:00
JustArchi
ae2f3ce1ff Handle new notifications for comments 2020-04-06 20:37:53 +02:00
JustArchi
5360cba93a Remove deprecated features 2020-04-06 17:33:31 +02:00
dependabot-preview[bot]
15fe5c60fc Bump wiki from 4da8c3a to 266a95c
Bumps [wiki](https://github.com/JustArchiNET/ArchiSteamFarm.wiki) from `4da8c3a` to `266a95c`.
- [Release notes](https://github.com/JustArchiNET/ArchiSteamFarm.wiki/releases)
- [Commits](4da8c3a2ea...266a95c29c)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-06 01:23:33 +00:00
JustArchi
184bc32847 Bump 2020-04-04 13:18:36 +02:00
9 changed files with 175 additions and 171 deletions

2
ASF-ui

Submodule ASF-ui updated: 6e3c4972ff...fdb3c4f11f

View File

@@ -326,24 +326,6 @@ namespace ArchiSteamFarm {
return (true, Strings.BotLootingSuccess);
}
[Obsolete]
[PublicAPI]
public async Task<(bool Success, string Message)> SendTradeOffer(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, IReadOnlyCollection<uint> wantedRealAppIDs = null, IReadOnlyCollection<uint> unwantedRealAppIDs = null, IReadOnlyCollection<Steam.Asset.EType> wantedTypes = null) {
if ((appID == 0) || (contextID == 0)) {
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
return (false, string.Format(Strings.ErrorObjectIsNull, nameof(appID) + " || " + nameof(contextID)));
}
if ((wantedRealAppIDs?.Count == 0) || (unwantedRealAppIDs?.Count == 0) || (wantedTypes?.Count == 0)) {
Bot.ArchiLogger.LogNullError(nameof(wantedRealAppIDs) + " || " + nameof(unwantedRealAppIDs) + " || " + nameof(wantedTypes));
return (false, string.Format(Strings.ErrorObjectIsNull, nameof(wantedRealAppIDs) + " || " + nameof(unwantedRealAppIDs) + " || " + nameof(wantedTypes)));
}
return await SendInventory(appID, contextID, targetSteamID, tradeToken, item => (wantedRealAppIDs?.Contains(item.RealAppID) != false) && (unwantedRealAppIDs?.Contains(item.RealAppID) != true) && (wantedTypes?.Contains(item.Type) != false)).ConfigureAwait(false);
}
[PublicAPI]
public (bool Success, string Message) Start() {
if (Bot.KeepRunning) {

View File

@@ -70,32 +70,44 @@ namespace ArchiSteamFarm {
LastPacketReceived = DateTime.UtcNow;
switch (packetMsg.MsgType) {
case EMsg.ClientCommentNotifications:
ClientMsgProtobuf<CMsgClientCommentNotifications> commentNotifications = new ClientMsgProtobuf<CMsgClientCommentNotifications>(packetMsg);
Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, commentNotifications.Body));
break;
case EMsg.ClientItemAnnouncements:
HandleItemAnnouncements(packetMsg);
ClientMsgProtobuf<CMsgClientItemAnnouncements> itemAnnouncements = new ClientMsgProtobuf<CMsgClientItemAnnouncements>(packetMsg);
Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, itemAnnouncements.Body));
break;
case EMsg.ClientPlayingSessionState:
HandlePlayingSessionState(packetMsg);
ClientMsgProtobuf<CMsgClientPlayingSessionState> playingSessionState = new ClientMsgProtobuf<CMsgClientPlayingSessionState>(packetMsg);
Client.PostCallback(new PlayingSessionStateCallback(packetMsg.TargetJobID, playingSessionState.Body));
break;
case EMsg.ClientPurchaseResponse:
HandlePurchaseResponse(packetMsg);
ClientMsgProtobuf<CMsgClientPurchaseResponse> purchaseResponse = new ClientMsgProtobuf<CMsgClientPurchaseResponse>(packetMsg);
Client.PostCallback(new PurchaseResponseCallback(packetMsg.TargetJobID, purchaseResponse.Body));
break;
case EMsg.ClientRedeemGuestPassResponse:
HandleRedeemGuestPassResponse(packetMsg);
ClientMsgProtobuf<CMsgClientRedeemGuestPassResponse> redeemGuestPassResponse = new ClientMsgProtobuf<CMsgClientRedeemGuestPassResponse>(packetMsg);
Client.PostCallback(new RedeemGuestPassResponseCallback(packetMsg.TargetJobID, redeemGuestPassResponse.Body));
break;
case EMsg.ClientSharedLibraryLockStatus:
HandleSharedLibraryLockStatus(packetMsg);
ClientMsgProtobuf<CMsgClientSharedLibraryLockStatus> sharedLibraryLockStatus = new ClientMsgProtobuf<CMsgClientSharedLibraryLockStatus>(packetMsg);
Client.PostCallback(new SharedLibraryLockStatusCallback(packetMsg.TargetJobID, sharedLibraryLockStatus.Body));
break;
case EMsg.ClientUserNotifications:
HandleUserNotifications(packetMsg);
ClientMsgProtobuf<CMsgClientUserNotifications> userNotifications = new ClientMsgProtobuf<CMsgClientUserNotifications>(packetMsg);
Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, userNotifications.Body));
break;
case EMsg.ClientVanityURLChangedNotification:
HandleVanityURLChangedNotification(packetMsg);
ClientMsgProtobuf<CMsgClientVanityURLChangedNotification> vanityURLChangedNotification = new ClientMsgProtobuf<CMsgClientVanityURLChangedNotification>(packetMsg);
Client.PostCallback(new VanityURLChangedCallback(packetMsg.TargetJobID, vanityURLChangedNotification.Body));
break;
}
@@ -629,83 +641,6 @@ namespace ArchiSteamFarm {
Client.Send(request);
}
private void HandleItemAnnouncements(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientItemAnnouncements> response = new ClientMsgProtobuf<CMsgClientItemAnnouncements>(packetMsg);
Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, response.Body));
}
private void HandlePlayingSessionState(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientPlayingSessionState> response = new ClientMsgProtobuf<CMsgClientPlayingSessionState>(packetMsg);
Client.PostCallback(new PlayingSessionStateCallback(packetMsg.TargetJobID, response.Body));
}
private void HandlePurchaseResponse(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientPurchaseResponse> response = new ClientMsgProtobuf<CMsgClientPurchaseResponse>(packetMsg);
Client.PostCallback(new PurchaseResponseCallback(packetMsg.TargetJobID, response.Body));
}
private void HandleRedeemGuestPassResponse(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientRedeemGuestPassResponse> response = new ClientMsgProtobuf<CMsgClientRedeemGuestPassResponse>(packetMsg);
Client.PostCallback(new RedeemGuestPassResponseCallback(packetMsg.TargetJobID, response.Body));
}
private void HandleSharedLibraryLockStatus(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientSharedLibraryLockStatus> response = new ClientMsgProtobuf<CMsgClientSharedLibraryLockStatus>(packetMsg);
Client.PostCallback(new SharedLibraryLockStatusCallback(packetMsg.TargetJobID, response.Body));
}
private void HandleUserNotifications(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientUserNotifications> response = new ClientMsgProtobuf<CMsgClientUserNotifications>(packetMsg);
Client.PostCallback(new UserNotificationsCallback(packetMsg.TargetJobID, response.Body));
}
private void HandleVanityURLChangedNotification(IPacketMsg packetMsg) {
if (packetMsg == null) {
ArchiLogger.LogNullError(nameof(packetMsg));
return;
}
ClientMsgProtobuf<CMsgClientVanityURLChangedNotification> response = new ClientMsgProtobuf<CMsgClientVanityURLChangedNotification>(packetMsg);
Client.PostCallback(new VanityURLChangedCallback(packetMsg.TargetJobID, response.Body));
}
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
public sealed class PurchaseResponseCallback : CallbackMsg {
public readonly Dictionary<uint, string> Items;
@@ -837,6 +772,15 @@ namespace ArchiSteamFarm {
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Items, msg.count_new_items } };
}
internal UserNotificationsCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientCommentNotifications msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
JobID = jobID;
Notifications = new Dictionary<EUserNotification, uint>(1) { { EUserNotification.Comments, msg.count_new_comments + msg.count_new_comments_owner + msg.count_new_comments_subscriptions } };
}
[PublicAPI]
public enum EUserNotification : byte {
Unknown,

View File

@@ -2,14 +2,14 @@
<PropertyGroup>
<ApplicationIcon>ASF.ico</ApplicationIcon>
<AssemblyVersion>4.2.0.1</AssemblyVersion>
<AssemblyVersion>4.2.0.2</AssemblyVersion>
<Authors>JustArchi</Authors>
<Company>JustArchi</Company>
<Copyright>Copyright © ArchiSteamFarm 2015-2020</Copyright>
<DefaultItemExcludes>$(DefaultItemExcludes);config/**;debug/**;out/**;overlay/**</DefaultItemExcludes>
<Description>ASF is a C# application with primary purpose of idling Steam cards from multiple accounts simultaneously.</Description>
<ErrorReport>none</ErrorReport>
<FileVersion>4.2.0.1</FileVersion>
<FileVersion>4.2.0.2</FileVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<LangVersion>8.0</LangVersion>
<NoWarn>1591</NoWarn>

View File

@@ -121,37 +121,6 @@ namespace ArchiSteamFarm {
return string.IsNullOrEmpty(VanityURL) ? "/profiles/" + Bot.SteamID : "/id/" + VanityURL;
}
[ItemCanBeNull]
[Obsolete]
[PublicAPI]
public async Task<HashSet<Steam.Asset>> GetInventory(ulong steamID = 0, uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, bool? marketable = null, bool? tradable = null, IReadOnlyCollection<uint> wantedRealAppIDs = null, IReadOnlyCollection<uint> unwantedRealAppIDs = null, IReadOnlyCollection<Steam.Asset.EType> wantedTypes = null, IReadOnlyCollection<(uint RealAppID, Steam.Asset.EType Type, Steam.Asset.ERarity Rarity)> wantedSets = null) {
if ((appID == 0) || (contextID == 0)) {
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
return null;
}
Bot.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningDeprecated, nameof(GetInventory) + " (" + nameof(Plugins) + ")", nameof(GetInventoryAsync)));
try {
return await GetInventoryAsync(steamID, appID, contextID).Where(
item =>
(!marketable.HasValue || (item.Marketable == marketable.Value)) &&
(!tradable.HasValue || (item.Tradable == tradable.Value)) &&
(wantedRealAppIDs?.Contains(item.RealAppID) != false) &&
(unwantedRealAppIDs?.Contains(item.RealAppID) != true) &&
(wantedTypes?.Contains(item.Type) != false) &&
(wantedSets?.Contains((item.RealAppID, item.Type, item.Rarity)) != false)
).ToHashSetAsync().ConfigureAwait(false);
} catch (HttpRequestException) {
return null;
} catch (Exception e) {
Bot.ArchiLogger.LogGenericException(e);
return null;
}
}
[JetBrains.Annotations.NotNull]
[PublicAPI]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]

View File

@@ -643,7 +643,10 @@ StackTrace:
<data name="BotLevel" xml:space="preserve">
<value>Το bot βρίσκεται στο επίπεδο {0}.</value>
<comment>{0} will be replaced by bot's level</comment>
</data>
<data name="ErrorAborted" xml:space="preserve">
@@ -651,7 +654,10 @@ StackTrace:
</data>
<data name="PluginLoaded" xml:space="preserve">
<value>{0} φορτώθηκε με επιτυχία!</value>
<comment>{0} will be replaced by the name of the custom ASF plugin</comment>
</data>
<data name="PluginLoading" xml:space="preserve">
<value>Φόρτωση του {0} Εκδ.{1}...</value>
<comment>{0} will be replaced by the name of the custom ASF plugin, {1} will be replaced by its version</comment>

View File

@@ -105,9 +105,44 @@ namespace ArchiSteamFarm {
return null;
}
using StreamResponse response = await UrlGetToStream(request, referer, requestOptions, maxTries).ConfigureAwait(false);
HtmlDocumentResponse result = null;
return response != null ? await HtmlDocumentResponse.Create(response).ConfigureAwait(false) : null;
for (int i = 0; i < maxTries; i++) {
using StreamResponse response = await UrlGetToStream(request, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
return null;
}
if (response.StatusCode.IsClientErrorCode()) {
if (requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
result = new HtmlDocumentResponse(response);
}
break;
}
if (response.Content == null) {
continue;
}
try {
result = await HtmlDocumentResponse.Create(response).ConfigureAwait(false);
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
continue;
}
return result;
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, maxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
}
return result;
}
[ItemCanBeNull]
@@ -149,13 +184,9 @@ namespace ArchiSteamFarm {
JsonSerializer serializer = new JsonSerializer();
obj = serializer.Deserialize<T>(jsonReader);
} catch (JsonException e) {
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
if (Debugging.IsUserDebugging) {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, response.Content));
}
continue;
}
@@ -305,9 +336,44 @@ namespace ArchiSteamFarm {
return null;
}
using StreamResponse response = await UrlPostToStream(request, data, referer, requestOptions, maxTries).ConfigureAwait(false);
HtmlDocumentResponse result = null;
return response != null ? await HtmlDocumentResponse.Create(response).ConfigureAwait(false) : null;
for (int i = 0; i < maxTries; i++) {
using StreamResponse response = await UrlPostToStream(request, data, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
return null;
}
if (response.StatusCode.IsClientErrorCode()) {
if (requestOptions.HasFlag(ERequestOptions.ReturnClientErrors)) {
result = new HtmlDocumentResponse(response);
}
break;
}
if (response.Content == null) {
continue;
}
try {
result = await HtmlDocumentResponse.Create(response).ConfigureAwait(false);
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
continue;
}
return result;
}
if (maxTries > 1) {
ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorRequestFailedTooManyTimes, maxTries));
ArchiLogger.LogGenericDebug(string.Format(Strings.ErrorFailingRequest, request));
}
return result;
}
[ItemCanBeNull]
@@ -348,13 +414,9 @@ namespace ArchiSteamFarm {
JsonSerializer serializer = new JsonSerializer();
obj = serializer.Deserialize<T>(jsonReader);
} catch (JsonException e) {
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
if (Debugging.IsUserDebugging) {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, response.Content));
}
continue;
}
@@ -411,7 +473,7 @@ namespace ArchiSteamFarm {
const byte printPercentage = 10;
const byte maxBatches = 99 / printPercentage;
using StreamResponse response = await UrlGetToStream(request, referer, requestOptions).ConfigureAwait(false);
using StreamResponse response = await UrlGetToStream(request, referer, requestOptions | ERequestOptions.ReturnClientErrors, 1).ConfigureAwait(false);
if (response == null) {
continue;
@@ -749,18 +811,37 @@ namespace ArchiSteamFarm {
[PublicAPI]
public readonly IDocument Content;
private HtmlDocumentResponse(BasicResponse streamResponse, IDocument document) : base(streamResponse) => Content = document;
internal HtmlDocumentResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) {
if (basicResponse == null) {
throw new ArgumentNullException(nameof(basicResponse));
}
}
[ItemNotNull]
private HtmlDocumentResponse([NotNull] StreamResponse streamResponse, [NotNull] IDocument document) : this(streamResponse) {
if ((streamResponse == null) || (document == null)) {
throw new ArgumentNullException(nameof(streamResponse) + " || " + nameof(document));
}
Content = document;
}
[ItemCanBeNull]
internal static async Task<HtmlDocumentResponse> Create([NotNull] StreamResponse streamResponse) {
if (streamResponse == null) {
throw new ArgumentNullException(nameof(streamResponse));
}
IBrowsingContext context = BrowsingContext.New(Configuration.Default.WithXPath());
IDocument document = await context.OpenAsync(req => req.Content(streamResponse.Content, true)).ConfigureAwait(false);
return new HtmlDocumentResponse(streamResponse, document);
try {
IDocument document = await context.OpenAsync(req => req.Content(streamResponse.Content, true)).ConfigureAwait(false);
return new HtmlDocumentResponse(streamResponse, document);
} catch (Exception e) {
ASF.ArchiLogger.LogGenericWarningException(e);
return null;
}
}
}
@@ -768,7 +849,7 @@ namespace ArchiSteamFarm {
[PublicAPI]
public readonly T Content;
internal ObjectResponse([NotNull] StreamResponse streamResponse, T content) : base(streamResponse) {
internal ObjectResponse([NotNull] StreamResponse streamResponse, T content) : this(streamResponse) {
if (streamResponse == null) {
throw new ArgumentNullException(nameof(streamResponse));
}
@@ -776,14 +857,18 @@ namespace ArchiSteamFarm {
Content = content;
}
internal ObjectResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) { }
internal ObjectResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) {
if (basicResponse == null) {
throw new ArgumentNullException(nameof(basicResponse));
}
}
}
public sealed class XmlDocumentResponse : BasicResponse {
[PublicAPI]
public readonly XmlDocument Content;
internal XmlDocumentResponse([NotNull] StreamResponse streamResponse, XmlDocument content) : base(streamResponse) {
internal XmlDocumentResponse([NotNull] StreamResponse streamResponse, XmlDocument content) : this(streamResponse) {
if (streamResponse == null) {
throw new ArgumentNullException(nameof(streamResponse));
}
@@ -791,7 +876,11 @@ namespace ArchiSteamFarm {
Content = content;
}
internal XmlDocumentResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) { }
internal XmlDocumentResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) {
if (basicResponse == null) {
throw new ArgumentNullException(nameof(basicResponse));
}
}
}
[Flags]
@@ -803,7 +892,7 @@ namespace ArchiSteamFarm {
internal sealed class BinaryResponse : BasicResponse {
internal readonly byte[] Content;
internal BinaryResponse([NotNull] BasicResponse basicResponse, [NotNull] byte[] content) : base(basicResponse) {
internal BinaryResponse([NotNull] BasicResponse basicResponse, [NotNull] byte[] content) : this(basicResponse) {
if ((basicResponse == null) || (content == null)) {
throw new ArgumentNullException(nameof(basicResponse) + " || " + nameof(content));
}
@@ -811,7 +900,11 @@ namespace ArchiSteamFarm {
Content = content;
}
internal BinaryResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) { }
internal BinaryResponse([NotNull] BasicResponse basicResponse) : base(basicResponse) {
if (basicResponse == null) {
throw new ArgumentNullException(nameof(basicResponse));
}
}
}
internal sealed class StreamResponse : BasicResponse, IDisposable {
@@ -820,20 +913,26 @@ namespace ArchiSteamFarm {
private readonly HttpResponseMessage ResponseMessage;
internal StreamResponse([NotNull] HttpResponseMessage httpResponseMessage, [NotNull] Stream content) : base(httpResponseMessage) {
internal StreamResponse([NotNull] HttpResponseMessage httpResponseMessage, [NotNull] Stream content) : this(httpResponseMessage) {
if ((httpResponseMessage == null) || (content == null)) {
throw new ArgumentNullException(nameof(httpResponseMessage) + " || " + nameof(content));
}
Content = content;
}
internal StreamResponse([NotNull] HttpResponseMessage httpResponseMessage) : base(httpResponseMessage) {
if (httpResponseMessage == null) {
throw new ArgumentNullException(nameof(httpResponseMessage));
}
Length = (uint) httpResponseMessage.Content.Headers.ContentLength.GetValueOrDefault();
ResponseMessage = httpResponseMessage;
}
internal StreamResponse([NotNull] HttpResponseMessage httpResponseMessage) : base(httpResponseMessage) { }
public void Dispose() {
Content.Dispose();
Content?.Dispose();
ResponseMessage.Dispose();
}
}
@@ -841,7 +940,7 @@ namespace ArchiSteamFarm {
internal sealed class StringResponse : BasicResponse {
internal readonly string Content;
internal StringResponse([NotNull] HttpResponseMessage httpResponseMessage, [NotNull] string content) : base(httpResponseMessage) {
internal StringResponse([NotNull] HttpResponseMessage httpResponseMessage, [NotNull] string content) : this(httpResponseMessage) {
if ((httpResponseMessage == null) || (content == null)) {
throw new ArgumentNullException(nameof(httpResponseMessage) + " || " + nameof(content));
}
@@ -849,7 +948,11 @@ namespace ArchiSteamFarm {
Content = content;
}
internal StringResponse([NotNull] HttpResponseMessage httpResponseMessage) : base(httpResponseMessage) { }
internal StringResponse([NotNull] HttpResponseMessage httpResponseMessage) : base(httpResponseMessage) {
if (httpResponseMessage == null) {
throw new ArgumentNullException(nameof(httpResponseMessage));
}
}
}
}
}

2
wiki

Submodule wiki updated: 4da8c3a2ea...ade6af6cea