mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dc57a3532 | ||
|
|
47b729a14d | ||
|
|
7a521da68b | ||
|
|
960dbf9b71 | ||
|
|
e8097be48a | ||
|
|
00c53244c4 | ||
|
|
5e39731a27 | ||
|
|
c852f024a2 | ||
|
|
45ac5ac6f6 | ||
|
|
704fb06460 | ||
|
|
ae2f3ce1ff | ||
|
|
5360cba93a | ||
|
|
15fe5c60fc | ||
|
|
184bc32847 |
Submodule ASF-WebConfigGenerator updated: cd7f4c14ad...5646123e30
2
ASF-ui
2
ASF-ui
Submodule ASF-ui updated: 6e3c4972ff...fdb3c4f11f
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
2
wiki
Submodule wiki updated: 4da8c3a2ea...ade6af6cea
Reference in New Issue
Block a user