mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-17 15:00:29 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c88d9bf123 | ||
|
|
053ebe15bb | ||
|
|
b03bfb6bbc | ||
|
|
e48867000e | ||
|
|
e08cdbd74d | ||
|
|
0b4c585a58 | ||
|
|
6213e77fab | ||
|
|
fccca6a4fc | ||
|
|
d4f4ec3401 | ||
|
|
b23dd3612d | ||
|
|
ca4fa4ac27 | ||
|
|
5e53a208d5 | ||
|
|
895c69642d | ||
|
|
765f9d29bb | ||
|
|
99af5c86a5 | ||
|
|
0bb2b3ed5f | ||
|
|
4181f3ba21 | ||
|
|
c189b398c0 | ||
|
|
de4fbf8b04 | ||
|
|
f91a558314 | ||
|
|
7587ff024c | ||
|
|
06778c9bb0 | ||
|
|
7a97045412 | ||
|
|
5d9bedfd28 | ||
|
|
575992c25d | ||
|
|
72db5bc9f3 | ||
|
|
b015720a3e | ||
|
|
84a6d4501b | ||
|
|
07049e71c0 | ||
|
|
4710d9c1eb | ||
|
|
d08462745a | ||
|
|
eb4e9ee077 | ||
|
|
601a486b13 | ||
|
|
14867f470d | ||
|
|
187f0800b2 | ||
|
|
3afa202d0b | ||
|
|
d33e76c8b0 | ||
|
|
3061c55eaf |
@@ -265,6 +265,36 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Please remove me immediately after https://github.com/SteamRE/SteamKit/issues/254 gets fixed
|
||||
internal void HackedLogOn(SteamUser.LogOnDetails details) {
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
SteamID steamID = new SteamID(details.AccountID, details.AccountInstance, Client.ConnectedUniverse, EAccountType.Individual);
|
||||
|
||||
var logon = new ClientMsgProtobuf<CMsgClientLogon>(EMsg.ClientLogon);
|
||||
logon.Body.obfustucated_private_ip = details.LoginID.Value;
|
||||
logon.ProtoHeader.client_sessionid = 0;
|
||||
logon.ProtoHeader.steamid = steamID.ConvertToUInt64();
|
||||
logon.Body.account_name = details.Username;
|
||||
logon.Body.password = details.Password;
|
||||
logon.Body.should_remember_password = details.ShouldRememberPassword;
|
||||
logon.Body.protocol_version = MsgClientLogon.CurrentProtocol;
|
||||
logon.Body.client_os_type = (uint) details.ClientOSType;
|
||||
logon.Body.client_language = details.ClientLanguage;
|
||||
logon.Body.cell_id = details.CellID;
|
||||
logon.Body.steam2_ticket_request = details.RequestSteam2Ticket;
|
||||
logon.Body.client_package_version = 1771;
|
||||
logon.Body.auth_code = details.AuthCode;
|
||||
logon.Body.two_factor_code = details.TwoFactorCode;
|
||||
logon.Body.login_key = details.LoginKey;
|
||||
logon.Body.sha_sentryfile = details.SentryFileHash;
|
||||
logon.Body.eresult_sentryfile = (int) (details.SentryFileHash != null ? EResult.OK : EResult.FileNotFound);
|
||||
|
||||
Client.Send(logon);
|
||||
}
|
||||
|
||||
/*
|
||||
_ _ _ _
|
||||
| | | | __ _ _ __ __| || | ___ _ __ ___
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="protobuf-net, Version=2.0.0.668, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL">
|
||||
|
||||
@@ -31,9 +31,14 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal sealed class ArchiWebHandler {
|
||||
private const string SteamCommunity = "steamcommunity.com";
|
||||
|
||||
private static string SteamCommunityURL = "https://" + SteamCommunity;
|
||||
|
||||
private static int Timeout = 30 * 1000;
|
||||
|
||||
private readonly Bot Bot;
|
||||
@@ -43,6 +48,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
internal static void Init() {
|
||||
Timeout = Program.GlobalConfig.HttpTimeout * 1000;
|
||||
SteamCommunityURL = (Program.GlobalConfig.ForceHttp ? "http://" : "https://") + SteamCommunity;
|
||||
}
|
||||
|
||||
internal ArchiWebHandler(Bot bot) {
|
||||
@@ -91,7 +97,7 @@ namespace ArchiSteamFarm {
|
||||
sessionkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedSessionKey, 0, cryptedSessionKey.Length)),
|
||||
encrypted_loginkey: Encoding.ASCII.GetString(WebUtility.UrlEncodeToBytes(cryptedLoginKey, 0, cryptedLoginKey.Length)),
|
||||
method: WebRequestMethods.Http.Post,
|
||||
secure: true
|
||||
secure: !Program.GlobalConfig.ForceHttp
|
||||
);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, Bot.BotName);
|
||||
@@ -126,7 +132,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
HtmlDocument htmlDocument = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && htmlDocument == null; i++) {
|
||||
htmlDocument = await WebBrowser.UrlGetToHtmlDocument("https://steamcommunity.com/my/profile", Cookie).ConfigureAwait(false);
|
||||
htmlDocument = await WebBrowser.UrlGetToHtmlDocument(SteamCommunityURL + "/my/profile", Cookie).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (htmlDocument == null) {
|
||||
@@ -149,6 +155,51 @@ namespace ArchiSteamFarm {
|
||||
return false;
|
||||
}
|
||||
|
||||
internal async Task<Dictionary<uint, string>> GetOwnedGames() {
|
||||
if (SteamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
string request = SteamCommunityURL + "/profiles/" + SteamID + "/games/?xml=1";
|
||||
|
||||
XmlDocument response = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && response == null; i++) {
|
||||
response = await WebBrowser.UrlGetToXML(request, Cookie).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (response == null) {
|
||||
Logging.LogGenericWTF("Request failed even after " + WebBrowser.MaxRetries + " tries", Bot.BotName);
|
||||
return null;
|
||||
}
|
||||
|
||||
XmlNodeList xmlNodeList = response.SelectNodes("gamesList/games/game");
|
||||
if (xmlNodeList == null || xmlNodeList.Count == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Dictionary<uint, string> result = new Dictionary<uint, string>(xmlNodeList.Count);
|
||||
foreach (XmlNode xmlNode in xmlNodeList) {
|
||||
XmlNode appNode = xmlNode.SelectSingleNode("appID");
|
||||
if (appNode == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint appID;
|
||||
if (!uint.TryParse(appNode.InnerText, out appID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
XmlNode nameNode = xmlNode.SelectSingleNode("name");
|
||||
if (nameNode == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
result[appID] = nameNode.InnerText;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
internal List<Steam.TradeOffer> GetTradeOffers() {
|
||||
if (string.IsNullOrEmpty(Bot.BotConfig.SteamApiKey)) {
|
||||
return null;
|
||||
@@ -163,7 +214,7 @@ namespace ArchiSteamFarm {
|
||||
response = iEconService.GetTradeOffers(
|
||||
get_received_offers: 1,
|
||||
active_only: 1,
|
||||
secure: true
|
||||
secure: !Program.GlobalConfig.ForceHttp
|
||||
);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, Bot.BotName);
|
||||
@@ -180,7 +231,7 @@ namespace ArchiSteamFarm {
|
||||
foreach (KeyValue trade in response["trade_offers_received"].Children) {
|
||||
Steam.TradeOffer tradeOffer = new Steam.TradeOffer {
|
||||
tradeofferid = trade["tradeofferid"].AsString(),
|
||||
accountid_other = trade["accountid_other"].AsInteger(),
|
||||
accountid_other = (uint) trade["accountid_other"].AsUnsignedLong(), // TODO: Correct this when SK2 with https://github.com/SteamRE/SteamKit/pull/255 gets released
|
||||
trade_offer_state = trade["trade_offer_state"].AsEnum<Steam.TradeOffer.ETradeOfferState>()
|
||||
};
|
||||
foreach (KeyValue item in trade["items_to_give"].Children) {
|
||||
@@ -219,7 +270,7 @@ namespace ArchiSteamFarm {
|
||||
return false;
|
||||
}
|
||||
|
||||
string request = "https://steamcommunity.com/gid/" + clanID;
|
||||
string request = SteamCommunityURL + "/gid/" + clanID;
|
||||
|
||||
Dictionary<string, string> data = new Dictionary<string, string>(2) {
|
||||
{"sessionID", sessionID},
|
||||
@@ -249,7 +300,7 @@ namespace ArchiSteamFarm {
|
||||
return false;
|
||||
}
|
||||
|
||||
string referer = "https://steamcommunity.com/tradeoffer/" + tradeID;
|
||||
string referer = SteamCommunityURL + "/tradeoffer/" + tradeID;
|
||||
string request = referer + "/accept";
|
||||
|
||||
Dictionary<string, string> data = new Dictionary<string, string>(3) {
|
||||
@@ -285,7 +336,7 @@ namespace ArchiSteamFarm {
|
||||
response = iEconService.DeclineTradeOffer(
|
||||
tradeofferid: tradeID.ToString(),
|
||||
method: WebRequestMethods.Http.Post,
|
||||
secure: true
|
||||
secure: !Program.GlobalConfig.ForceHttp
|
||||
);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, Bot.BotName);
|
||||
@@ -304,7 +355,7 @@ namespace ArchiSteamFarm {
|
||||
internal async Task<List<Steam.Item>> GetMyTradableInventory() {
|
||||
JObject jObject = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && jObject == null; i++) {
|
||||
jObject = await WebBrowser.UrlGetToJObject("https://steamcommunity.com/my/inventory/json/753/6?trading=1", Cookie).ConfigureAwait(false);
|
||||
jObject = await WebBrowser.UrlGetToJObject(SteamCommunityURL + "/my/inventory/json/753/6?trading=1", Cookie).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (jObject == null) {
|
||||
@@ -362,7 +413,7 @@ namespace ArchiSteamFarm {
|
||||
});
|
||||
}
|
||||
|
||||
string referer = "https://steamcommunity.com/tradeoffer/new";
|
||||
string referer = SteamCommunityURL + "/tradeoffer/new";
|
||||
string request = referer + "/send";
|
||||
|
||||
foreach (Steam.TradeOfferRequest trade in trades) {
|
||||
@@ -396,7 +447,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
HtmlDocument htmlDocument = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && htmlDocument == null; i++) {
|
||||
htmlDocument = await WebBrowser.UrlGetToHtmlDocument("https://steamcommunity.com/profiles/" + SteamID + "/badges?l=english&p=" + page, Cookie).ConfigureAwait(false);
|
||||
htmlDocument = await WebBrowser.UrlGetToHtmlDocument(SteamCommunityURL + "/profiles/" + SteamID + "/badges?l=english&p=" + page, Cookie).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (htmlDocument == null) {
|
||||
@@ -414,7 +465,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
HtmlDocument htmlDocument = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && htmlDocument == null; i++) {
|
||||
htmlDocument = await WebBrowser.UrlGetToHtmlDocument("https://steamcommunity.com/profiles/" + SteamID + "/gamecards/" + appID + "?l=english", Cookie).ConfigureAwait(false);
|
||||
htmlDocument = await WebBrowser.UrlGetToHtmlDocument(SteamCommunityURL + "/profiles/" + SteamID + "/gamecards/" + appID + "?l=english", Cookie).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (htmlDocument == null) {
|
||||
@@ -432,7 +483,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
HttpResponseMessage response = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && response == null; i++) {
|
||||
response = await WebBrowser.UrlGet("https://steamcommunity.com/profiles/" + SteamID + "/inventory", Cookie).ConfigureAwait(false);
|
||||
response = await WebBrowser.UrlGet(SteamCommunityURL + "/profiles/" + SteamID + "/inventory", Cookie).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (response == null) {
|
||||
@@ -453,9 +504,12 @@ namespace ArchiSteamFarm {
|
||||
{ "pin", parentalPin }
|
||||
};
|
||||
|
||||
string referer = SteamCommunityURL;
|
||||
string request = referer + "/parental/ajaxunlock";
|
||||
|
||||
HttpResponseMessage response = null;
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && response == null; i++) {
|
||||
response = await WebBrowser.UrlPost("https://steamcommunity.com/parental/ajaxunlock", data, Cookie, "https://steamcommunity.com/").ConfigureAwait(false);
|
||||
response = await WebBrowser.UrlPost(request, data, Cookie, referer).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (response == null) {
|
||||
|
||||
@@ -87,6 +87,14 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsOwner(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return steamID == Program.GlobalConfig.SteamOwnerID;
|
||||
}
|
||||
|
||||
private static bool IsValidCdKey(string key) {
|
||||
if (string.IsNullOrEmpty(key)) {
|
||||
return false;
|
||||
@@ -172,26 +180,16 @@ namespace ArchiSteamFarm {
|
||||
SentryFile = botPath + ".bin";
|
||||
|
||||
// Support and convert SDA files
|
||||
if (BotDatabase.SteamGuardAccount == null && File.Exists(botPath + ".maFile")) {
|
||||
Logging.LogGenericInfo("Converting SDA .maFile into ASF format...", botName);
|
||||
try {
|
||||
BotDatabase.SteamGuardAccount = JsonConvert.DeserializeObject<SteamGuardAccount>(File.ReadAllText(botPath + ".maFile"));
|
||||
File.Delete(botPath + ".maFile");
|
||||
Logging.LogGenericInfo("Success!", botName);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, botName);
|
||||
}
|
||||
string maFilePath = botPath + ".maFile";
|
||||
if (BotDatabase.SteamGuardAccount == null && File.Exists(maFilePath)) {
|
||||
ImportAuthenticator(maFilePath);
|
||||
}
|
||||
|
||||
// Initialize
|
||||
SteamClient = new SteamClient();
|
||||
|
||||
if (Program.GlobalConfig.Debug && !Debugging.NetHookAlreadyInitialized) {
|
||||
if (Program.GlobalConfig.Debug && !Debugging.NetHookAlreadyInitialized && Directory.Exists(Program.DebugDirectory)) {
|
||||
try {
|
||||
if (Directory.Exists(Program.DebugDirectory)) {
|
||||
Directory.Delete(Program.DebugDirectory, true);
|
||||
}
|
||||
Directory.CreateDirectory(Program.DebugDirectory);
|
||||
SteamClient.DebugNetworkListener = new NetHookNetworkListener(Program.DebugDirectory);
|
||||
Debugging.NetHookAlreadyInitialized = true;
|
||||
} catch (Exception e) {
|
||||
@@ -233,7 +231,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
if (BotConfig.AcceptConfirmationsPeriod > 0 && AcceptConfirmationsTimer == null) {
|
||||
AcceptConfirmationsTimer = new Timer(
|
||||
async e => await AcceptAllConfirmations().ConfigureAwait(false),
|
||||
async e => await AcceptConfirmations().ConfigureAwait(false),
|
||||
null,
|
||||
TimeSpan.FromMinutes(BotConfig.AcceptConfirmationsPeriod), // Delay
|
||||
TimeSpan.FromMinutes(BotConfig.AcceptConfirmationsPeriod) // Period
|
||||
@@ -242,7 +240,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
if (BotConfig.SendTradePeriod > 0 && SendItemsTimer == null) {
|
||||
SendItemsTimer = new Timer(
|
||||
async e => await ResponseSendTrade().ConfigureAwait(false),
|
||||
async e => await ResponseSendTrade(BotConfig.SteamMasterID).ConfigureAwait(false),
|
||||
null,
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod), // Delay
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod) // Period
|
||||
@@ -257,32 +255,43 @@ namespace ArchiSteamFarm {
|
||||
Start().Wait();
|
||||
}
|
||||
|
||||
internal async Task AcceptAllConfirmations() {
|
||||
internal bool IsMaster(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return steamID == BotConfig.SteamMasterID || IsOwner(steamID);
|
||||
}
|
||||
|
||||
internal async Task AcceptConfirmations(Confirmation.ConfirmationType allowedConfirmationType = Confirmation.ConfirmationType.Unknown) {
|
||||
if (BotDatabase.SteamGuardAccount == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!await BotDatabase.SteamGuardAccount.RefreshSessionAsync().ConfigureAwait(false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Confirmation[] confirmations = await BotDatabase.SteamGuardAccount.FetchConfirmationsAsync().ConfigureAwait(false);
|
||||
if (confirmations == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!await BotDatabase.SteamGuardAccount.RefreshSessionAsync().ConfigureAwait(false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Confirmation[] confirmations = await BotDatabase.SteamGuardAccount.FetchConfirmationsAsync().ConfigureAwait(false);
|
||||
if (confirmations == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (Confirmation confirmation in confirmations) {
|
||||
if (BotDatabase.SteamGuardAccount.AcceptConfirmation(confirmation)) {
|
||||
Logging.LogGenericInfo("Accepting confirmation: Success!", BotName);
|
||||
} else {
|
||||
Logging.LogGenericWarning("Accepting confirmation: Failed!", BotName);
|
||||
if (allowedConfirmationType != Confirmation.ConfirmationType.Unknown && confirmation.ConfType != allowedConfirmationType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BotDatabase.SteamGuardAccount.AcceptConfirmation(confirmation);
|
||||
}
|
||||
} catch (SteamGuardAccount.WGTokenInvalidException) {
|
||||
Logging.LogGenericWarning("Accepting confirmation: Failed!", BotName);
|
||||
Logging.LogGenericWarning("Confirmation could not be accepted because of invalid token exception", BotName);
|
||||
Logging.LogGenericWarning("If issue persists, consider removing and readding ASF 2FA", BotName);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, BotName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,53 +304,54 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal async Task Restart() {
|
||||
Stop();
|
||||
await Utilities.SleepAsync(500).ConfigureAwait(false);
|
||||
await Stop().ConfigureAwait(false);
|
||||
await Start().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal async Task OnFarmingFinished(bool farmedSomething) {
|
||||
if (farmedSomething && BotConfig.SendOnFarmingFinished) {
|
||||
await ResponseSendTrade().ConfigureAwait(false);
|
||||
await ResponseSendTrade(BotConfig.SteamMasterID).ConfigureAwait(false);
|
||||
}
|
||||
if (BotConfig.ShutdownOnFarmingFinished) {
|
||||
Shutdown();
|
||||
await Shutdown().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
internal async Task<string> HandleMessage(string message) {
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
internal async Task<string> Response(ulong steamID, string message) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(message)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!message.StartsWith("!")) {
|
||||
return await ResponseRedeem(BotName, message, true).ConfigureAwait(false);
|
||||
return await ResponseRedeem(steamID, BotName, message, true).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (!message.Contains(" ")) {
|
||||
switch (message) {
|
||||
case "!2fa":
|
||||
return Response2FA();
|
||||
return Response2FA(steamID);
|
||||
case "!2faoff":
|
||||
return Response2FAOff();
|
||||
return Response2FAOff(steamID);
|
||||
case "!2faok":
|
||||
return await Response2FAOK().ConfigureAwait(false);
|
||||
return await Response2FAOK(steamID).ConfigureAwait(false);
|
||||
case "!exit":
|
||||
Program.Exit();
|
||||
return null;
|
||||
case "!rejoinchat":
|
||||
return ResponseRejoinChat();
|
||||
case "!restart":
|
||||
Program.Restart();
|
||||
return null;
|
||||
case "!status":
|
||||
return ResponseStatus();
|
||||
case "!statusall":
|
||||
return ResponseStatusAll();
|
||||
case "!stop":
|
||||
return ResponseStop();
|
||||
return ResponseExit(steamID);
|
||||
case "!farm":
|
||||
return await ResponseFarm(steamID).ConfigureAwait(false);
|
||||
case "!loot":
|
||||
return await ResponseSendTrade().ConfigureAwait(false);
|
||||
return await ResponseSendTrade(steamID).ConfigureAwait(false);
|
||||
case "!rejoinchat":
|
||||
return ResponseRejoinChat(steamID);
|
||||
case "!restart":
|
||||
return ResponseRestart(steamID);
|
||||
case "!status":
|
||||
return ResponseStatus(steamID);
|
||||
case "!statusall":
|
||||
return ResponseStatusAll(steamID);
|
||||
case "!stop":
|
||||
return await ResponseStop(steamID).ConfigureAwait(false);
|
||||
case "!update":
|
||||
return await ResponseUpdate(steamID).ConfigureAwait(false);
|
||||
default:
|
||||
return "Unrecognized command: " + message;
|
||||
}
|
||||
@@ -349,37 +359,45 @@ namespace ArchiSteamFarm {
|
||||
string[] args = message.Split(' ');
|
||||
switch (args[0]) {
|
||||
case "!2fa":
|
||||
return Response2FA(args[1]);
|
||||
return Response2FA(steamID, args[1]);
|
||||
case "!2faoff":
|
||||
return Response2FAOff(args[1]);
|
||||
return Response2FAOff(steamID, args[1]);
|
||||
case "!2faok":
|
||||
return await Response2FAOK(args[1]).ConfigureAwait(false);
|
||||
return await Response2FAOK(steamID, args[1]).ConfigureAwait(false);
|
||||
case "!addlicense":
|
||||
if (args.Length > 2) {
|
||||
return await ResponseAddLicense(args[1], args[2]).ConfigureAwait(false);
|
||||
return await ResponseAddLicense(steamID, args[1], args[2]).ConfigureAwait(false);
|
||||
} else {
|
||||
return await ResponseAddLicense(BotName, args[1]).ConfigureAwait(false);
|
||||
return await ResponseAddLicense(steamID, BotName, args[1]).ConfigureAwait(false);
|
||||
}
|
||||
case "!farm":
|
||||
return await ResponseFarm(steamID, args[1]).ConfigureAwait(false);
|
||||
case "!loot":
|
||||
return await ResponseSendTrade(steamID, args[1]).ConfigureAwait(false);
|
||||
case "!owns":
|
||||
if (args.Length > 2) {
|
||||
return await ResponseOwns(steamID, args[1], args[2]).ConfigureAwait(false);
|
||||
} else {
|
||||
return await ResponseOwns(steamID, BotName, args[1]).ConfigureAwait(false);
|
||||
}
|
||||
case "!play":
|
||||
if (args.Length > 2) {
|
||||
return await ResponsePlay(args[1], args[2]).ConfigureAwait(false);
|
||||
return await ResponsePlay(steamID, args[1], args[2]).ConfigureAwait(false);
|
||||
} else {
|
||||
return await ResponsePlay(BotName, args[1]).ConfigureAwait(false);
|
||||
return await ResponsePlay(steamID, BotName, args[1]).ConfigureAwait(false);
|
||||
}
|
||||
case "!redeem":
|
||||
if (args.Length > 2) {
|
||||
return await ResponseRedeem(args[1], args[2], false).ConfigureAwait(false);
|
||||
return await ResponseRedeem(steamID, args[1], args[2], false).ConfigureAwait(false);
|
||||
} else {
|
||||
return await ResponseRedeem(BotName, args[1], false).ConfigureAwait(false);
|
||||
return await ResponseRedeem(steamID, BotName, args[1], false).ConfigureAwait(false);
|
||||
}
|
||||
case "!start":
|
||||
return await ResponseStart(args[1]).ConfigureAwait(false);
|
||||
case "!stop":
|
||||
return ResponseStop(args[1]);
|
||||
return await ResponseStart(steamID, args[1]).ConfigureAwait(false);
|
||||
case "!status":
|
||||
return ResponseStatus(args[1]);
|
||||
case "!loot":
|
||||
return await ResponseSendTrade(args[1]).ConfigureAwait(false);
|
||||
return ResponseStatus(steamID, args[1]);
|
||||
case "!stop":
|
||||
return await ResponseStop(steamID, args[1]).ConfigureAwait(false);
|
||||
default:
|
||||
return "Unrecognized command: " + args[0];
|
||||
}
|
||||
@@ -406,23 +424,96 @@ namespace ArchiSteamFarm {
|
||||
SteamClient.Connect();
|
||||
}
|
||||
|
||||
private void Stop() {
|
||||
private async Task Stop() {
|
||||
if (!SteamClient.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.LogGenericInfo("Stopping...", BotName);
|
||||
|
||||
SteamClient.Disconnect();
|
||||
for (byte i = 0; i < WebBrowser.MaxRetries && SteamClient.IsConnected; i++) {
|
||||
SteamClient.Disconnect();
|
||||
await Utilities.SleepAsync(1000).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (SteamClient.IsConnected) {
|
||||
Logging.LogGenericWarning("Could not stop this bot instance!", BotName);
|
||||
} else {
|
||||
Logging.LogGenericInfo("Stopped!", BotName);
|
||||
}
|
||||
}
|
||||
|
||||
private void Shutdown() {
|
||||
private async Task Shutdown() {
|
||||
KeepRunning = false;
|
||||
Stop();
|
||||
await Stop().ConfigureAwait(false);
|
||||
Program.OnBotShutdown();
|
||||
}
|
||||
|
||||
private string ResponseStatus() {
|
||||
private void ImportAuthenticator(string maFilePath) {
|
||||
if (BotDatabase.SteamGuardAccount != null || !File.Exists(maFilePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.LogGenericInfo("Converting SDA .maFile into ASF format...", BotName);
|
||||
try {
|
||||
BotDatabase.SteamGuardAccount = JsonConvert.DeserializeObject<SteamGuardAccount>(File.ReadAllText(maFilePath));
|
||||
File.Delete(maFilePath);
|
||||
Logging.LogGenericInfo("Success!", BotName);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, BotName);
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is SDA file, then we should already have everything ready
|
||||
if (BotDatabase.SteamGuardAccount.Session != null) {
|
||||
Logging.LogGenericInfo("Successfully finished importing mobile authenticator!", BotName);
|
||||
return;
|
||||
}
|
||||
|
||||
// But here we're dealing with WinAuth authenticator
|
||||
Logging.LogGenericInfo("ASF requires a few more steps to complete authenticator import...", BotName);
|
||||
|
||||
InitializeLoginAndPassword();
|
||||
|
||||
UserLogin userLogin = new UserLogin(BotConfig.SteamLogin, BotConfig.SteamPassword);
|
||||
LoginResult loginResult;
|
||||
while ((loginResult = userLogin.DoLogin()) != LoginResult.LoginOkay) {
|
||||
switch (loginResult) {
|
||||
case LoginResult.Need2FA:
|
||||
userLogin.TwoFactorCode = Program.GetUserInput(BotName, Program.EUserInputType.TwoFactorAuthentication);
|
||||
break;
|
||||
default:
|
||||
Logging.LogGenericError("Unhandled situation: " + loginResult, BotName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (userLogin.Session == null) {
|
||||
BotDatabase.SteamGuardAccount = null;
|
||||
Logging.LogGenericError("Session is invalid, linking can't be completed!", BotName);
|
||||
return;
|
||||
}
|
||||
|
||||
BotDatabase.SteamGuardAccount.FullyEnrolled = true;
|
||||
BotDatabase.SteamGuardAccount.Session = userLogin.Session;
|
||||
|
||||
if (string.IsNullOrEmpty(BotDatabase.SteamGuardAccount.DeviceID)) {
|
||||
BotDatabase.SteamGuardAccount.DeviceID = Program.GetUserInput(BotName, Program.EUserInputType.DeviceID);
|
||||
}
|
||||
|
||||
BotDatabase.Save();
|
||||
Logging.LogGenericInfo("Successfully finished importing mobile authenticator!", BotName);
|
||||
}
|
||||
|
||||
private string ResponseStatus(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (CardsFarmer.CurrentGamesFarming.Count > 0) {
|
||||
return "Bot " + BotName + " is currently farming appIDs: " + string.Join(", ", CardsFarmer.CurrentGamesFarming) + " and has a total of " + CardsFarmer.GamesToFarm.Count + " games left to farm.";
|
||||
} else {
|
||||
@@ -430,8 +521,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
private static string ResponseStatus(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static string ResponseStatus(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -440,17 +531,25 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return bot.ResponseStatus();
|
||||
return bot.ResponseStatus(steamID);
|
||||
}
|
||||
|
||||
private static string ResponseStatusAll() {
|
||||
private static string ResponseStatusAll(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
StringBuilder result = new StringBuilder(Environment.NewLine);
|
||||
|
||||
int totalBotsCount = Bots.Count;
|
||||
int runningBotsCount = 0;
|
||||
|
||||
foreach (Bot bot in Bots.Values) {
|
||||
result.Append(bot.ResponseStatus() + Environment.NewLine);
|
||||
result.Append(bot.ResponseStatus(steamID) + Environment.NewLine);
|
||||
if (bot.KeepRunning) {
|
||||
runningBotsCount++;
|
||||
}
|
||||
@@ -460,7 +559,15 @@ namespace ArchiSteamFarm {
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private async Task<string> ResponseSendTrade() {
|
||||
private async Task<string> ResponseSendTrade(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (BotConfig.SteamMasterID == 0) {
|
||||
return "Trade couldn't be send because SteamMasterID is not defined!";
|
||||
}
|
||||
@@ -473,15 +580,15 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
if (await ArchiWebHandler.SendTradeOffer(inventory, BotConfig.SteamMasterID, BotConfig.SteamTradeToken).ConfigureAwait(false)) {
|
||||
await AcceptAllConfirmations().ConfigureAwait(false);
|
||||
await AcceptConfirmations(Confirmation.ConfirmationType.Trade).ConfigureAwait(false);
|
||||
return "Trade offer sent successfully!";
|
||||
} else {
|
||||
return "Trade offer failed due to error!";
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseSendTrade(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static async Task<string> ResponseSendTrade(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -490,10 +597,18 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return await bot.ResponseSendTrade().ConfigureAwait(false);
|
||||
return await bot.ResponseSendTrade(steamID).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private string Response2FA() {
|
||||
private string Response2FA(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (BotDatabase.SteamGuardAccount == null) {
|
||||
return "That bot doesn't have ASF 2FA enabled!";
|
||||
}
|
||||
@@ -502,8 +617,8 @@ namespace ArchiSteamFarm {
|
||||
return "2FA Token: " + BotDatabase.SteamGuardAccount.GenerateSteamGuardCode() + " (expires in " + timeLeft + " seconds)";
|
||||
}
|
||||
|
||||
private static string Response2FA(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static string Response2FA(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -512,10 +627,18 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return bot.Response2FA();
|
||||
return bot.Response2FA(steamID);
|
||||
}
|
||||
|
||||
private string Response2FAOff() {
|
||||
private string Response2FAOff(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (BotDatabase.SteamGuardAccount == null) {
|
||||
return "That bot doesn't have ASF 2FA enabled!";
|
||||
}
|
||||
@@ -527,8 +650,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
private static string Response2FAOff(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static string Response2FAOff(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -537,20 +660,28 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return bot.Response2FAOff();
|
||||
return bot.Response2FAOff(steamID);
|
||||
}
|
||||
|
||||
private async Task<string> Response2FAOK() {
|
||||
private async Task<string> Response2FAOK(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (BotDatabase.SteamGuardAccount == null) {
|
||||
return "That bot doesn't have ASF 2FA enabled!";
|
||||
}
|
||||
|
||||
await AcceptAllConfirmations().ConfigureAwait(false);
|
||||
await AcceptConfirmations().ConfigureAwait(false);
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private static async Task<string> Response2FAOK(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static async Task<string> Response2FAOK(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -559,14 +690,57 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return await bot.Response2FAOK().ConfigureAwait(false);
|
||||
return await bot.Response2FAOK(steamID).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<string> ResponseRedeem(string message, bool validate) {
|
||||
if (string.IsNullOrEmpty(message)) {
|
||||
private static string ResponseExit(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
Program.Exit();
|
||||
return null;
|
||||
}
|
||||
|
||||
private async Task<string> ResponseFarm(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
await CardsFarmer.RestartFarming().ConfigureAwait(false);
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseFarm(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Bot bot;
|
||||
if (!Bots.TryGetValue(botName, out bot)) {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return await bot.ResponseFarm(steamID).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<string> ResponseRedeem(ulong steamID, string message, bool validate) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(message)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
StringBuilder response = new StringBuilder();
|
||||
using (StringReader reader = new StringReader(message)) {
|
||||
string key = reader.ReadLine();
|
||||
@@ -703,8 +877,8 @@ namespace ArchiSteamFarm {
|
||||
return response.ToString();
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseRedeem(string botName, string message, bool validate) {
|
||||
if (string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(message)) {
|
||||
private static async Task<string> ResponseRedeem(ulong steamID, string botName, string message, bool validate) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(message)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -713,10 +887,18 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return await bot.ResponseRedeem(message, validate).ConfigureAwait(false);
|
||||
return await bot.ResponseRedeem(steamID, message, validate).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static string ResponseRejoinChat() {
|
||||
private static string ResponseRejoinChat(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
foreach (Bot bot in Bots.Values) {
|
||||
bot.JoinMasterChat();
|
||||
}
|
||||
@@ -724,11 +906,28 @@ namespace ArchiSteamFarm {
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private async Task<string> ResponseAddLicense(HashSet<uint> gameIDs) {
|
||||
if (gameIDs == null || gameIDs.Count == 0) {
|
||||
private static string ResponseRestart(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
Program.Restart();
|
||||
return null;
|
||||
}
|
||||
|
||||
private async Task<string> ResponseAddLicense(ulong steamID, HashSet<uint> gameIDs) {
|
||||
if (steamID == 0 || gameIDs == null || gameIDs.Count == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
foreach (uint gameID in gameIDs) {
|
||||
SteamApps.FreeLicenseCallback callback;
|
||||
@@ -745,8 +944,8 @@ namespace ArchiSteamFarm {
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseAddLicense(string botName, string games) {
|
||||
if (string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(games)) {
|
||||
private static async Task<string> ResponseAddLicense(ulong steamID, string botName, string games) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(games)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -770,14 +969,74 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't parse any games given!";
|
||||
}
|
||||
|
||||
return await bot.ResponseAddLicense(gamesToRedeem).ConfigureAwait(false);
|
||||
return await bot.ResponseAddLicense(steamID, gamesToRedeem).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<string> ResponsePlay(HashSet<uint> gameIDs) {
|
||||
if (gameIDs == null || gameIDs.Count == 0) {
|
||||
private async Task<string> ResponseOwns(ulong steamID, string games) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(games)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
Dictionary<uint, string> ownedGames = await ArchiWebHandler.GetOwnedGames().ConfigureAwait(false);
|
||||
if (ownedGames == null || ownedGames.Count == 0) {
|
||||
return "List of owned games is empty!";
|
||||
}
|
||||
|
||||
// Check if this is uint
|
||||
uint appID;
|
||||
if (uint.TryParse(games, out appID)) {
|
||||
string ownedName;
|
||||
if (ownedGames.TryGetValue(appID, out ownedName)) {
|
||||
return "Owned already: " + appID + " | " + ownedName;
|
||||
} else {
|
||||
return "Not owned yet: " + appID;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder response = new StringBuilder();
|
||||
|
||||
// This is a string
|
||||
foreach (KeyValuePair<uint, string> game in ownedGames) {
|
||||
if (game.Value.IndexOf(games, StringComparison.OrdinalIgnoreCase) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
response.AppendLine(Environment.NewLine + "Owned already: " + game.Key + " | " + game.Value);
|
||||
}
|
||||
|
||||
if (response.Length > 0) {
|
||||
return response.ToString();
|
||||
} else {
|
||||
return "Not owned yet: " + games;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseOwns(ulong steamID, string botName, string games) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(games)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Bot bot;
|
||||
if (!Bots.TryGetValue(botName, out bot)) {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return await bot.ResponseOwns(steamID, games).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<string> ResponsePlay(ulong steamID, HashSet<uint> gameIDs) {
|
||||
if (steamID == 0 || gameIDs == null || gameIDs.Count == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (gameIDs.Contains(0)) {
|
||||
if (await CardsFarmer.SwitchToManualMode(false).ConfigureAwait(false)) {
|
||||
ResetGamesPlayed();
|
||||
@@ -790,8 +1049,8 @@ namespace ArchiSteamFarm {
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private static async Task<string> ResponsePlay(string botName, string games) {
|
||||
if (string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(games)) {
|
||||
private static async Task<string> ResponsePlay(ulong steamID, string botName, string games) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(games)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -815,10 +1074,18 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't parse any games given!";
|
||||
}
|
||||
|
||||
return await bot.ResponsePlay(gamesToPlay).ConfigureAwait(false);
|
||||
return await bot.ResponsePlay(steamID, gamesToPlay).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<string> ResponseStart() {
|
||||
private async Task<string> ResponseStart(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (KeepRunning) {
|
||||
return "That bot instance is already running!";
|
||||
}
|
||||
@@ -827,8 +1094,8 @@ namespace ArchiSteamFarm {
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseStart(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static async Task<string> ResponseStart(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -837,20 +1104,28 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return await bot.ResponseStart().ConfigureAwait(false);
|
||||
return await bot.ResponseStart(steamID).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private string ResponseStop() {
|
||||
private async Task<string> ResponseStop(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsMaster(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
if (!KeepRunning) {
|
||||
return "That bot instance is already inactive!";
|
||||
}
|
||||
|
||||
Shutdown();
|
||||
await Shutdown().ConfigureAwait(false);
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private static string ResponseStop(string botName) {
|
||||
if (string.IsNullOrEmpty(botName)) {
|
||||
private static async Task<string> ResponseStop(ulong steamID, string botName) {
|
||||
if (steamID == 0 || string.IsNullOrEmpty(botName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -859,7 +1134,20 @@ namespace ArchiSteamFarm {
|
||||
return "Couldn't find any bot named " + botName + "!";
|
||||
}
|
||||
|
||||
return bot.ResponseStop();
|
||||
return await bot.ResponseStop(steamID).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task<string> ResponseUpdate(ulong steamID) {
|
||||
if (steamID == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!IsOwner(steamID)) {
|
||||
return "ERROR: Not authorized!";
|
||||
}
|
||||
|
||||
await Program.CheckForUpdate().ConfigureAwait(false);
|
||||
return "Done!";
|
||||
}
|
||||
|
||||
private void HandleCallbacks() {
|
||||
@@ -874,7 +1162,7 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
SendMessage(steamID, await HandleMessage(message).ConfigureAwait(false));
|
||||
SendMessage(steamID, await Response(steamID, message).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
private void SendMessage(ulong steamID, string message) {
|
||||
@@ -895,6 +1183,9 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
Logging.LogGenericInfo("Linking new ASF MobileAuthenticator...", BotName);
|
||||
|
||||
InitializeLoginAndPassword();
|
||||
|
||||
UserLogin userLogin = new UserLogin(BotConfig.SteamLogin, BotConfig.SteamPassword);
|
||||
LoginResult loginResult;
|
||||
while ((loginResult = userLogin.DoLogin()) != LoginResult.LoginOkay) {
|
||||
@@ -957,6 +1248,16 @@ namespace ArchiSteamFarm {
|
||||
SteamFriends.JoinChat(BotConfig.SteamMasterClanID);
|
||||
}
|
||||
|
||||
private void InitializeLoginAndPassword() {
|
||||
if (string.IsNullOrEmpty(BotConfig.SteamLogin)) {
|
||||
BotConfig.SteamLogin = Program.GetUserInput(BotName, Program.EUserInputType.Login);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(BotConfig.SteamPassword) && string.IsNullOrEmpty(BotDatabase.LoginKey)) {
|
||||
BotConfig.SteamPassword = Program.GetUserInput(BotName, Program.EUserInputType.Password);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnConnected(SteamClient.ConnectedCallback callback) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
@@ -985,12 +1286,24 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(BotConfig.SteamLogin)) {
|
||||
BotConfig.SteamLogin = Program.GetUserInput(BotName, Program.EUserInputType.Login);
|
||||
}
|
||||
InitializeLoginAndPassword();
|
||||
|
||||
if (string.IsNullOrEmpty(BotConfig.SteamPassword) && string.IsNullOrEmpty(BotDatabase.LoginKey)) {
|
||||
BotConfig.SteamPassword = Program.GetUserInput(BotName, Program.EUserInputType.Password);
|
||||
Logging.LogGenericInfo("Logging in...", BotName);
|
||||
|
||||
// TODO: Please remove me immediately after https://github.com/SteamRE/SteamKit/issues/254 gets fixed
|
||||
if (Program.GlobalConfig.HackIgnoreMachineID) {
|
||||
Logging.LogGenericWarning("Using workaround for broken GenerateMachineID()!", BotName);
|
||||
ArchiHandler.HackedLogOn(new SteamUser.LogOnDetails {
|
||||
Username = BotConfig.SteamLogin,
|
||||
Password = BotConfig.SteamPassword,
|
||||
AuthCode = AuthCode,
|
||||
LoginID = LoginID,
|
||||
LoginKey = BotDatabase.LoginKey,
|
||||
TwoFactorCode = TwoFactorAuth,
|
||||
SentryFileHash = sentryHash,
|
||||
ShouldRememberPassword = true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
SteamUser.LogOn(new SteamUser.LogOnDetails {
|
||||
@@ -1058,7 +1371,7 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback.PatronID != BotConfig.SteamMasterID) {
|
||||
if (!IsMaster(callback.PatronID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1074,7 +1387,7 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback.ChatterID != BotConfig.SteamMasterID) {
|
||||
if (!IsMaster(callback.ChatterID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1103,9 +1416,10 @@ namespace ArchiSteamFarm {
|
||||
// TODO: Accept clan invites from master?
|
||||
break;
|
||||
default:
|
||||
if (friend.SteamID == BotConfig.SteamMasterID) {
|
||||
SteamFriends.AddFriend(friend.SteamID);
|
||||
if (!IsMaster(friend.SteamID)) {
|
||||
break;
|
||||
}
|
||||
SteamFriends.AddFriend(friend.SteamID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1120,7 +1434,7 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback.Sender != BotConfig.SteamMasterID) {
|
||||
if (!IsMaster(callback.Sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1136,7 +1450,7 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
if (callback.SteamID != BotConfig.SteamMasterID) {
|
||||
if (!IsMaster(callback.SteamID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1217,14 +1531,7 @@ namespace ArchiSteamFarm {
|
||||
// Support and convert SDA files
|
||||
string maFilePath = Path.Combine(Program.ConfigDirectory, callback.ClientSteamID.ConvertToUInt64() + ".maFile");
|
||||
if (BotDatabase.SteamGuardAccount == null && File.Exists(maFilePath)) {
|
||||
Logging.LogGenericInfo("Converting SDA .maFile into ASF format...", BotName);
|
||||
try {
|
||||
BotDatabase.SteamGuardAccount = JsonConvert.DeserializeObject<SteamGuardAccount>(File.ReadAllText(maFilePath));
|
||||
File.Delete(maFilePath);
|
||||
Logging.LogGenericInfo("Success!", BotName);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, BotName);
|
||||
}
|
||||
ImportAuthenticator(maFilePath);
|
||||
}
|
||||
|
||||
if (BotConfig.UseAsfAsMobileAuthenticator && TwoFactorAuth == null && BotDatabase.SteamGuardAccount == null) {
|
||||
@@ -1272,7 +1579,7 @@ namespace ArchiSteamFarm {
|
||||
break;
|
||||
default: // Unexpected result, shutdown immediately
|
||||
Logging.LogGenericWarning("Unable to login to Steam: " + callback.Result, BotName);
|
||||
Shutdown();
|
||||
await Shutdown().ConfigureAwait(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace ArchiSteamFarm {
|
||||
// This constructor is used only by deserializer
|
||||
private BotDatabase() { }
|
||||
|
||||
private void Save() {
|
||||
internal void Save() {
|
||||
lock (FilePath) {
|
||||
try {
|
||||
File.WriteAllText(FilePath, JsonConvert.SerializeObject(this));
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace ArchiSteamFarm {
|
||||
await StartFarming().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<bool?> ShouldFarm(ulong appID) {
|
||||
private async Task<bool?> ShouldFarm(uint appID) {
|
||||
if (appID == 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -425,12 +425,12 @@ namespace ArchiSteamFarm {
|
||||
|
||||
bool? keepFarming = await ShouldFarm(appID).ConfigureAwait(false);
|
||||
for (ushort farmingTime = 0; farmingTime <= 60 * Program.GlobalConfig.MaxFarmingTime && keepFarming.GetValueOrDefault(true); farmingTime += Program.GlobalConfig.FarmingDelay) {
|
||||
Logging.LogGenericInfo("Still farming: " + appID, Bot.BotName);
|
||||
if (FarmResetEvent.WaitOne(60 * 1000 * Program.GlobalConfig.FarmingDelay)) {
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
keepFarming = await ShouldFarm(appID).ConfigureAwait(false);
|
||||
Logging.LogGenericInfo("Still farming: " + appID, Bot.BotName);
|
||||
}
|
||||
|
||||
Bot.ResetGamesPlayed();
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
*/
|
||||
|
||||
using SteamKit2;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class Debugging {
|
||||
#if DEBUG
|
||||
@@ -33,5 +37,27 @@ namespace ArchiSteamFarm {
|
||||
internal static bool IsReleaseBuild => !IsDebugBuild;
|
||||
|
||||
internal static bool NetHookAlreadyInitialized { get; set; } = false;
|
||||
|
||||
internal sealed class DebugListener : IDebugListener {
|
||||
private readonly string FilePath;
|
||||
|
||||
internal DebugListener(string filePath) {
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
FilePath = filePath;
|
||||
}
|
||||
|
||||
public void WriteLine(string category, string msg) {
|
||||
lock (FilePath) {
|
||||
try {
|
||||
File.AppendAllText(FilePath, category + " | " + msg + Environment.NewLine);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal EUpdateChannel UpdateChannel { get; private set; } = EUpdateChannel.Stable;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal ulong SteamOwnerID { get; private set; } = 0;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal byte MaxFarmingTime { get; private set; } = 10;
|
||||
|
||||
@@ -66,7 +69,10 @@ namespace ArchiSteamFarm {
|
||||
internal byte InventoryLimiterDelay { get; private set; } = 3;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal byte HttpTimeout { get; private set; } = 30;
|
||||
internal bool ForceHttp { get; private set; } = false;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal byte HttpTimeout { get; private set; } = 60;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal string WCFHostname { get; private set; } = "localhost";
|
||||
@@ -74,9 +80,16 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal ushort WCFPort { get; private set; } = 1242;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal bool LogToFile { get; private set; } = true;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal bool Statistics { get; private set; } = true;
|
||||
|
||||
// TODO: Please remove me immediately after https://github.com/SteamRE/SteamKit/issues/254 gets fixed
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal bool HackIgnoreMachineID { get; private set; } = false;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal HashSet<uint> Blacklist { get; private set; } = new HashSet<uint>(GlobalBlacklist);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace ArchiSteamFarm {
|
||||
internal string tradeofferid { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
internal int accountid_other { get; set; }
|
||||
internal uint accountid_other { get; set; }
|
||||
|
||||
[JsonProperty(Required = Required.Always)]
|
||||
internal ETradeOfferState trade_offer_state { get; set; }
|
||||
@@ -97,7 +97,7 @@ namespace ArchiSteamFarm {
|
||||
internal ulong OtherSteamID64 {
|
||||
get {
|
||||
if (_OtherSteamID64 == 0 && accountid_other != 0) {
|
||||
_OtherSteamID64 = new SteamID((uint) accountid_other, EUniverse.Public, EAccountType.Individual).ConvertToUInt64();
|
||||
_OtherSteamID64 = new SteamID(accountid_other, EUniverse.Public, EAccountType.Individual).ConvertToUInt64();
|
||||
}
|
||||
|
||||
return _OtherSteamID64;
|
||||
|
||||
@@ -31,18 +31,18 @@ namespace ArchiSteamFarm {
|
||||
internal static class Logging {
|
||||
private static readonly object FileLock = new object();
|
||||
|
||||
internal static bool? LogToFile { get; set; } = null;
|
||||
private static bool LogToFile = false;
|
||||
|
||||
internal static void Init() {
|
||||
if (!LogToFile.HasValue) {
|
||||
LogToFile = true;
|
||||
}
|
||||
LogToFile = Program.GlobalConfig.LogToFile;
|
||||
|
||||
lock (FileLock) {
|
||||
try {
|
||||
File.Delete(Program.LogFile);
|
||||
} catch (Exception e) {
|
||||
LogGenericException(e);
|
||||
if (LogToFile) {
|
||||
lock (FileLock) {
|
||||
try {
|
||||
File.Delete(Program.LogFile);
|
||||
} catch (Exception e) {
|
||||
LogGenericException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,11 +69,10 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
Log("[!] EXCEPTION: " + previousMethodName + "() <" + botName + "> " + exception.Message);
|
||||
Log("[!] StackTrace: " + exception.StackTrace);
|
||||
Log("[!] StackTrace:" + Environment.NewLine + exception.StackTrace);
|
||||
|
||||
Exception innerException = exception.InnerException;
|
||||
if (innerException != null) {
|
||||
LogGenericException(innerException, botName, previousMethodName);
|
||||
if (exception.InnerException != null) {
|
||||
LogGenericException(exception.InnerException, botName, previousMethodName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,17 +118,18 @@ namespace ArchiSteamFarm {
|
||||
|
||||
// Write on console only when not awaiting response from user
|
||||
if (!Program.ConsoleIsBusy) {
|
||||
Console.Write(loggedMessage);
|
||||
try {
|
||||
Console.Write(loggedMessage);
|
||||
} catch { }
|
||||
}
|
||||
|
||||
if (LogToFile.GetValueOrDefault()) {
|
||||
if (LogToFile) {
|
||||
lock (FileLock) {
|
||||
try {
|
||||
File.AppendAllText(Program.LogFile, loggedMessage);
|
||||
} catch (Exception e) {
|
||||
LogToFile = false;
|
||||
LogGenericException(e);
|
||||
LogToFile = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ using System.Threading.Tasks;
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class Program {
|
||||
internal enum EUserInputType : byte {
|
||||
Unknown,
|
||||
DeviceID,
|
||||
Login,
|
||||
Password,
|
||||
PhoneNumber,
|
||||
@@ -46,13 +48,12 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal enum EMode : byte {
|
||||
Unknown,
|
||||
Normal, // Standard most common usage
|
||||
Client, // WCF client only
|
||||
Server // Normal + WCF server
|
||||
}
|
||||
|
||||
private const string GithubReleaseURL = "https://api.github.com/repos/JustArchi/ArchiSteamFarm/releases";
|
||||
|
||||
internal const string ASF = "ASF";
|
||||
internal const string ConfigDirectory = "config";
|
||||
internal const string DebugDirectory = "debug";
|
||||
@@ -60,17 +61,19 @@ namespace ArchiSteamFarm {
|
||||
internal const string GlobalConfigFile = ASF + ".json";
|
||||
internal const string GlobalDatabaseFile = ASF + ".db";
|
||||
|
||||
private const string GithubReleaseURL = "https://api.github.com/repos/JustArchi/ArchiSteamFarm/releases"; // GitHub API is HTTPS only
|
||||
|
||||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
||||
internal static readonly Version Version = Assembly.GetName().Version;
|
||||
|
||||
private static readonly object ConsoleLock = new object();
|
||||
private static readonly SemaphoreSlim SteamSemaphore = new SemaphoreSlim(1);
|
||||
private static readonly ManualResetEvent ShutdownResetEvent = new ManualResetEvent(false);
|
||||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
||||
private static readonly string ExecutableFile = Assembly.Location;
|
||||
private static readonly string ExecutableName = Path.GetFileName(ExecutableFile);
|
||||
private static readonly string ExecutableDirectory = Path.GetDirectoryName(ExecutableFile);
|
||||
private static readonly WCF WCF = new WCF();
|
||||
|
||||
internal static readonly string Version = Assembly.GetName().Version.ToString();
|
||||
|
||||
internal static GlobalConfig GlobalConfig { get; private set; }
|
||||
internal static GlobalDatabase GlobalDatabase { get; private set; }
|
||||
internal static bool ConsoleIsBusy { get; private set; } = false;
|
||||
@@ -78,7 +81,7 @@ namespace ArchiSteamFarm {
|
||||
private static Timer AutoUpdatesTimer;
|
||||
private static EMode Mode = EMode.Normal;
|
||||
|
||||
private static async Task CheckForUpdate() {
|
||||
internal static async Task CheckForUpdate() {
|
||||
string oldExeFile = ExecutableFile + ".old";
|
||||
|
||||
// We booted successfully so we can now remove old exe file
|
||||
@@ -141,9 +144,11 @@ namespace ArchiSteamFarm {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.LogGenericInfo("Local version: " + Version + " | Remote version: " + releaseResponse.Tag);
|
||||
Version newVersion = new Version(releaseResponse.Tag);
|
||||
|
||||
if (string.Compare(Version, releaseResponse.Tag, StringComparison.Ordinal) >= 0) { // If local version is the same or newer than remote version
|
||||
Logging.LogGenericInfo("Local version: " + Version + " | Remote version: " + newVersion);
|
||||
|
||||
if (Version.CompareTo(newVersion) >= 0) { // If local version is the same or newer than remote version
|
||||
if (GlobalConfig.AutoUpdates && AutoUpdatesTimer == null) {
|
||||
Logging.LogGenericInfo("ASF will automatically check for new versions every 24 hours");
|
||||
AutoUpdatesTimer = new Timer(
|
||||
@@ -277,10 +282,17 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal static string GetUserInput(string botLogin, EUserInputType userInputType, string extraInformation = null) {
|
||||
if (userInputType == EUserInputType.Unknown) {
|
||||
return null;
|
||||
}
|
||||
|
||||
string result;
|
||||
lock (ConsoleLock) {
|
||||
ConsoleIsBusy = true;
|
||||
switch (userInputType) {
|
||||
case EUserInputType.DeviceID:
|
||||
Console.Write("<" + botLogin + "> Please enter your Device ID (including \"android:\"): ");
|
||||
break;
|
||||
case EUserInputType.Login:
|
||||
Console.Write("<" + botLogin + "> Please enter your login: ");
|
||||
break;
|
||||
@@ -307,6 +319,9 @@ namespace ArchiSteamFarm {
|
||||
case EUserInputType.TwoFactorAuthentication:
|
||||
Console.Write("<" + botLogin + "> Please enter your 2 factor auth code from your authenticator app: ");
|
||||
break;
|
||||
default:
|
||||
Console.Write("<" + botLogin + "> Please enter not documented yet value of \"" + userInputType + "\": ");
|
||||
break;
|
||||
}
|
||||
result = Console.ReadLine();
|
||||
Console.Clear(); // For security purposes
|
||||
@@ -334,7 +349,7 @@ namespace ArchiSteamFarm {
|
||||
private static void InitServices() {
|
||||
GlobalConfig = GlobalConfig.Load();
|
||||
if (GlobalConfig == null) {
|
||||
Logging.LogGenericError("Global config could not be loaded, please make sure that ASF.db exists and is valid!");
|
||||
Logging.LogGenericError("Global config could not be loaded, please make sure that ASF.json exists and is valid!");
|
||||
Thread.Sleep(5000);
|
||||
Exit(1);
|
||||
}
|
||||
@@ -356,13 +371,6 @@ namespace ArchiSteamFarm {
|
||||
switch (arg) {
|
||||
case "--client":
|
||||
Mode = EMode.Client;
|
||||
Logging.LogToFile = false;
|
||||
break;
|
||||
case "--log":
|
||||
Logging.LogToFile = true;
|
||||
break;
|
||||
case "--no-log":
|
||||
Logging.LogToFile = false;
|
||||
break;
|
||||
case "--server":
|
||||
Mode = EMode.Server;
|
||||
@@ -379,10 +387,10 @@ namespace ArchiSteamFarm {
|
||||
continue;
|
||||
}
|
||||
|
||||
Logging.LogGenericInfo("Command sent: \"" + arg + "\"");
|
||||
Logging.LogGenericInfo("Command sent: " + arg);
|
||||
|
||||
// We intentionally execute this async block synchronously
|
||||
Logging.LogGenericInfo("Response received: \"" + WCF.SendCommand(arg) + "\"");
|
||||
Logging.LogGenericInfo("Response received: " + WCF.SendCommand(arg));
|
||||
/*
|
||||
Task.Run(async () => {
|
||||
Logging.LogGenericNotice("WCF", "Response received: " + await WCF.SendCommand(arg).ConfigureAwait(false));
|
||||
@@ -401,8 +409,17 @@ namespace ArchiSteamFarm {
|
||||
Logging.LogGenericException((Exception) args.ExceptionObject);
|
||||
}
|
||||
|
||||
private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs args) {
|
||||
if (sender == null || args == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging.LogGenericException(args.Exception);
|
||||
}
|
||||
|
||||
private static void Main(string[] args) {
|
||||
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
|
||||
TaskScheduler.UnobservedTaskException += UnobservedTaskExceptionHandler;
|
||||
|
||||
Logging.LogGenericInfo("Archi's Steam Farm, version " + Version);
|
||||
Directory.SetCurrentDirectory(ExecutableDirectory);
|
||||
@@ -425,6 +442,18 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
// If debugging is on, we prepare debug directory prior to running
|
||||
if (GlobalConfig.Debug) {
|
||||
if (Directory.Exists(DebugDirectory)) {
|
||||
Directory.Delete(DebugDirectory, true);
|
||||
Thread.Sleep(1000); // Dirty workaround giving Windows some time to sync
|
||||
}
|
||||
Directory.CreateDirectory(DebugDirectory);
|
||||
|
||||
SteamKit2.DebugLog.AddListener(new Debugging.DebugListener(Path.Combine(Program.DebugDirectory, "debug.txt")));
|
||||
SteamKit2.DebugLog.Enabled = true;
|
||||
}
|
||||
|
||||
// Parse args
|
||||
ParseArgs(args);
|
||||
|
||||
@@ -454,7 +483,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
Bot bot = new Bot(botName);
|
||||
if (!bot.BotConfig.Enabled) {
|
||||
if (bot.BotConfig == null || !bot.BotConfig.Enabled) {
|
||||
Logging.LogGenericInfo("Not starting this instance because it's disabled in config file", botName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.0.0.5")]
|
||||
[assembly: AssemblyFileVersion("2.0.0.5")]
|
||||
[assembly: AssemblyVersion("2.0.1.2")]
|
||||
[assembly: AssemblyFileVersion("2.0.1.2")]
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
*/
|
||||
|
||||
using SteamAuth;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -35,6 +36,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
private readonly Bot Bot;
|
||||
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
|
||||
|
||||
private volatile byte ParsingTasks = 0;
|
||||
|
||||
internal static async Task LimitInventoryRequestsAsync() {
|
||||
@@ -81,7 +83,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
await Bot.AcceptAllConfirmations().ConfigureAwait(false);
|
||||
await Bot.AcceptConfirmations(Confirmation.ConfirmationType.Trade).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task ParseTrade(Steam.TradeOffer tradeOffer) {
|
||||
|
||||
@@ -113,12 +113,12 @@ namespace ArchiSteamFarm {
|
||||
return "ERROR: Couldn't find any bot named: " + botName;
|
||||
}
|
||||
|
||||
Logging.LogGenericInfo("Received command: \"" + input + "\"");
|
||||
Logging.LogGenericInfo("Received command: " + input);
|
||||
|
||||
string command = '!' + input;
|
||||
string output = bot.HandleMessage(command).Result; // TODO: This should be asynchronous
|
||||
string output = bot.Response(Program.GlobalConfig.SteamOwnerID, command).Result; // TODO: This should be asynchronous
|
||||
|
||||
Logging.LogGenericInfo("Answered to command: \"" + input + "\" with: \"" + output + "\"");
|
||||
Logging.LogGenericInfo("Answered to command: " + input + " with: " + output);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,18 +31,20 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace ArchiSteamFarm {
|
||||
internal static class WebBrowser {
|
||||
internal const byte MaxConnections = 10; // Defines maximum number of connections per ServicePoint. Be careful, as it also defines maximum number of sockets in CLOSE_WAIT state
|
||||
internal const byte MaxIdleTime = 15; // In seconds, how long socket is allowed to stay in CLOSE_WAIT state after there are no connections to it
|
||||
internal const byte MaxRetries = 5; // Defines maximum number of retries, UrlRequest() does not handle retry by itself (it's app responsibility)
|
||||
|
||||
private const byte MaxConnections = 10; // Defines maximum number of connections per ServicePoint. Be careful, as it also defines maximum number of sockets in CLOSE_WAIT state
|
||||
private const byte MaxIdleTime = 15; // In seconds, how long socket is allowed to stay in CLOSE_WAIT state after there are no connections to it
|
||||
|
||||
private static readonly string DefaultUserAgent = "ArchiSteamFarm/" + Program.Version;
|
||||
private static readonly HttpClient HttpClient = new HttpClient(new HttpClientHandler {
|
||||
UseCookies = false
|
||||
}) {
|
||||
Timeout = TimeSpan.FromSeconds(30)
|
||||
Timeout = TimeSpan.FromSeconds(60)
|
||||
};
|
||||
|
||||
internal static void Init() {
|
||||
@@ -155,6 +157,28 @@ namespace ArchiSteamFarm {
|
||||
return jObject;
|
||||
}
|
||||
|
||||
internal static async Task<XmlDocument> UrlGetToXML(string request, Dictionary<string, string> cookies = null, string referer = null) {
|
||||
if (string.IsNullOrEmpty(request)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
string content = await UrlGetToContent(request, cookies, referer).ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(content)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
|
||||
try {
|
||||
xmlDocument.LoadXml(content);
|
||||
} catch (XmlException e) {
|
||||
Logging.LogGenericException(e);
|
||||
return null;
|
||||
}
|
||||
|
||||
return xmlDocument;
|
||||
}
|
||||
|
||||
private static async Task<HttpResponseMessage> UrlRequest(string request, HttpMethod httpMethod, Dictionary<string, string> data = null, Dictionary<string, string> cookies = null, string referer = null) {
|
||||
if (string.IsNullOrEmpty(request) || httpMethod == null) {
|
||||
return null;
|
||||
|
||||
@@ -2,16 +2,20 @@
|
||||
"Debug": false,
|
||||
"AutoUpdates": true,
|
||||
"UpdateChannel": 1,
|
||||
"SteamOwnerID": 0,
|
||||
"MaxFarmingTime": 10,
|
||||
"IdleFarmingPeriod": 3,
|
||||
"FarmingDelay": 5,
|
||||
"AccountPlayingDelay": 5,
|
||||
"LoginLimiterDelay": 7,
|
||||
"InventoryLimiterDelay": 3,
|
||||
"HttpTimeout": 30,
|
||||
"ForceHttp": false,
|
||||
"HttpTimeout": 60,
|
||||
"WCFHostname": "localhost",
|
||||
"WCFPort": 1242,
|
||||
"LogToFile": true,
|
||||
"Statistics": true,
|
||||
"HackIgnoreMachineID": false,
|
||||
"Blacklist": [
|
||||
267420,
|
||||
303700,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
|
||||
<package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
|
||||
<package id="SteamKit2" version="1.7.0" targetFramework="net452" />
|
||||
</packages>
|
||||
@@ -33,7 +33,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
|
||||
</packages>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
packages/Newtonsoft.Json.8.0.3/Newtonsoft.Json.8.0.3.nupkg
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/Newtonsoft.Json.8.0.3.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/Newtonsoft.Json.8.0.3/lib/net20/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/lib/net20/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
@@ -604,6 +604,12 @@
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.#ctor(System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
<param name="camelCaseText"><c>true</c> if the written enum text will be camel case; otherwise, <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Writes the JSON representation of the object.
|
||||
@@ -1058,6 +1064,12 @@
|
||||
</summary>
|
||||
<value>The method used when merging JSON arrays.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JsonMergeSettings.MergeNullValueHandling">
|
||||
<summary>
|
||||
Gets or sets how how null value properties are merged.
|
||||
</summary>
|
||||
<value>How null value properties are merged.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeArrayHandling">
|
||||
<summary>
|
||||
Specifies how JSON arrays are merged together.
|
||||
@@ -1075,6 +1087,21 @@
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeArrayHandling.Merge">
|
||||
<summary>Merge array items together, matched by index.</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeNullValueHandling">
|
||||
<summary>
|
||||
Specifies how null value properties are merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Ignore">
|
||||
<summary>
|
||||
The content's null value properties will be ignored during merging.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Merge">
|
||||
<summary>
|
||||
The content's null value properties will be merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JPropertyDescriptor">
|
||||
<summary>
|
||||
Represents a view of a <see cref="T:Newtonsoft.Json.Linq.JProperty"/>.
|
||||
@@ -3511,9 +3538,9 @@
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.CreateUndefined">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.
|
||||
</summary>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.</returns>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JValue.Type">
|
||||
<summary>
|
||||
@@ -6646,7 +6673,7 @@
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.MemberSerialization.OptIn">
|
||||
<summary>
|
||||
Only members must be marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="!:DataMemberAttribute"/> are serialized.
|
||||
Only members marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="!:DataMemberAttribute"/> are serialized.
|
||||
This member serialization mode can also be set by marking the class with <see cref="!:DataContractAttribute"/>.
|
||||
</summary>
|
||||
</member>
|
||||
BIN
packages/Newtonsoft.Json.8.0.3/lib/net35/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/lib/net35/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
@@ -627,6 +627,12 @@
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.#ctor(System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
<param name="camelCaseText"><c>true</c> if the written enum text will be camel case; otherwise, <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Writes the JSON representation of the object.
|
||||
@@ -1190,6 +1196,12 @@
|
||||
</summary>
|
||||
<value>The method used when merging JSON arrays.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JsonMergeSettings.MergeNullValueHandling">
|
||||
<summary>
|
||||
Gets or sets how how null value properties are merged.
|
||||
</summary>
|
||||
<value>How null value properties are merged.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeArrayHandling">
|
||||
<summary>
|
||||
Specifies how JSON arrays are merged together.
|
||||
@@ -1207,6 +1219,21 @@
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeArrayHandling.Merge">
|
||||
<summary>Merge array items together, matched by index.</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeNullValueHandling">
|
||||
<summary>
|
||||
Specifies how null value properties are merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Ignore">
|
||||
<summary>
|
||||
The content's null value properties will be ignored during merging.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Merge">
|
||||
<summary>
|
||||
The content's null value properties will be merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JRaw">
|
||||
<summary>
|
||||
Represents a raw JSON string.
|
||||
@@ -3605,9 +3632,9 @@
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.CreateUndefined">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.
|
||||
</summary>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.</returns>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JValue.Type">
|
||||
<summary>
|
||||
@@ -5688,7 +5715,7 @@
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.MemberSerialization.OptIn">
|
||||
<summary>
|
||||
Only members must be marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
Only members marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
This member serialization mode can also be set by marking the class with <see cref="T:System.Runtime.Serialization.DataContractAttribute"/>.
|
||||
</summary>
|
||||
</member>
|
||||
BIN
packages/Newtonsoft.Json.8.0.3/lib/net40/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/lib/net40/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
@@ -699,6 +699,12 @@
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.#ctor(System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
<param name="camelCaseText"><c>true</c> if the written enum text will be camel case; otherwise, <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Writes the JSON representation of the object.
|
||||
@@ -1173,6 +1179,12 @@
|
||||
</summary>
|
||||
<value>The method used when merging JSON arrays.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JsonMergeSettings.MergeNullValueHandling">
|
||||
<summary>
|
||||
Gets or sets how how null value properties are merged.
|
||||
</summary>
|
||||
<value>How null value properties are merged.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeArrayHandling">
|
||||
<summary>
|
||||
Specifies how JSON arrays are merged together.
|
||||
@@ -1190,6 +1202,21 @@
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeArrayHandling.Merge">
|
||||
<summary>Merge array items together, matched by index.</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeNullValueHandling">
|
||||
<summary>
|
||||
Specifies how null value properties are merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Ignore">
|
||||
<summary>
|
||||
The content's null value properties will be ignored during merging.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Merge">
|
||||
<summary>
|
||||
The content's null value properties will be merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JRaw">
|
||||
<summary>
|
||||
Represents a raw JSON string.
|
||||
@@ -3715,9 +3742,9 @@
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.CreateUndefined">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.
|
||||
</summary>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.</returns>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JValue.Type">
|
||||
<summary>
|
||||
@@ -5896,7 +5923,7 @@
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.MemberSerialization.OptIn">
|
||||
<summary>
|
||||
Only members must be marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
Only members marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
This member serialization mode can also be set by marking the class with <see cref="T:System.Runtime.Serialization.DataContractAttribute"/>.
|
||||
</summary>
|
||||
</member>
|
||||
BIN
packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/lib/net45/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
@@ -778,6 +778,12 @@
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.#ctor(System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
<param name="camelCaseText"><c>true</c> if the written enum text will be camel case; otherwise, <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Writes the JSON representation of the object.
|
||||
@@ -5094,6 +5100,12 @@
|
||||
</summary>
|
||||
<value>The method used when merging JSON arrays.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JsonMergeSettings.MergeNullValueHandling">
|
||||
<summary>
|
||||
Gets or sets how how null value properties are merged.
|
||||
</summary>
|
||||
<value>How null value properties are merged.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JProperty">
|
||||
<summary>
|
||||
Represents a JSON property.
|
||||
@@ -6670,9 +6682,9 @@
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.CreateUndefined">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.
|
||||
</summary>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.</returns>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JValue.Type">
|
||||
<summary>
|
||||
@@ -6821,6 +6833,21 @@
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeArrayHandling.Merge">
|
||||
<summary>Merge array items together, matched by index.</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeNullValueHandling">
|
||||
<summary>
|
||||
Specifies how null value properties are merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Ignore">
|
||||
<summary>
|
||||
The content's null value properties will be ignored during merging.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Merge">
|
||||
<summary>
|
||||
The content's null value properties will be merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.MemberSerialization">
|
||||
<summary>
|
||||
Specifies the member serialization options for the <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
|
||||
@@ -6834,7 +6861,7 @@
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.MemberSerialization.OptIn">
|
||||
<summary>
|
||||
Only members must be marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
Only members marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
This member serialization mode can also be set by marking the class with <see cref="T:System.Runtime.Serialization.DataContractAttribute"/>.
|
||||
</summary>
|
||||
</member>
|
||||
BIN
packages/Newtonsoft.Json.8.0.3/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/lib/portable-net40+sl5+wp80+win8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
@@ -610,6 +610,12 @@
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.#ctor(System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
<param name="camelCaseText"><c>true</c> if the written enum text will be camel case; otherwise, <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Writes the JSON representation of the object.
|
||||
@@ -4588,6 +4594,12 @@
|
||||
</summary>
|
||||
<value>The method used when merging JSON arrays.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JsonMergeSettings.MergeNullValueHandling">
|
||||
<summary>
|
||||
Gets or sets how how null value properties are merged.
|
||||
</summary>
|
||||
<value>How null value properties are merged.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Represents an abstract JSON token.
|
||||
@@ -5961,9 +5973,9 @@
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.CreateUndefined">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.
|
||||
</summary>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.</returns>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JValue.Type">
|
||||
<summary>
|
||||
@@ -6086,6 +6098,21 @@
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeArrayHandling.Merge">
|
||||
<summary>Merge array items together, matched by index.</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeNullValueHandling">
|
||||
<summary>
|
||||
Specifies how null value properties are merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Ignore">
|
||||
<summary>
|
||||
The content's null value properties will be ignored during merging.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Merge">
|
||||
<summary>
|
||||
The content's null value properties will be merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.MemberSerialization">
|
||||
<summary>
|
||||
Specifies the member serialization options for the <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
|
||||
@@ -6099,7 +6126,7 @@
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.MemberSerialization.OptIn">
|
||||
<summary>
|
||||
Only members must be marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
Only members marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
This member serialization mode can also be set by marking the class with <see cref="T:System.Runtime.Serialization.DataContractAttribute"/>.
|
||||
</summary>
|
||||
</member>
|
||||
BIN
packages/Newtonsoft.Json.8.0.3/lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.8.0.3/lib/portable-net45+wp80+win8+wpa81+dnxcore50/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
@@ -650,6 +650,12 @@
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.#ctor(System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Converters.StringEnumConverter"/> class.
|
||||
</summary>
|
||||
<param name="camelCaseText"><c>true</c> if the written enum text will be camel case; otherwise, <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Converters.StringEnumConverter.WriteJson(Newtonsoft.Json.JsonWriter,System.Object,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Writes the JSON representation of the object.
|
||||
@@ -4858,6 +4864,12 @@
|
||||
</summary>
|
||||
<value>The method used when merging JSON arrays.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JsonMergeSettings.MergeNullValueHandling">
|
||||
<summary>
|
||||
Gets or sets how how null value properties are merged.
|
||||
</summary>
|
||||
<value>How null value properties are merged.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Represents an abstract JSON token.
|
||||
@@ -6249,9 +6261,9 @@
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.CreateUndefined">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.
|
||||
</summary>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> null value.</returns>
|
||||
<returns>A <see cref="T:Newtonsoft.Json.Linq.JValue"/> undefined value.</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Linq.JValue.Type">
|
||||
<summary>
|
||||
@@ -6383,6 +6395,21 @@
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeArrayHandling.Merge">
|
||||
<summary>Merge array items together, matched by index.</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.MergeNullValueHandling">
|
||||
<summary>
|
||||
Specifies how null value properties are merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Ignore">
|
||||
<summary>
|
||||
The content's null value properties will be ignored during merging.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.Linq.MergeNullValueHandling.Merge">
|
||||
<summary>
|
||||
The content's null value properties will be merged.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.MemberSerialization">
|
||||
<summary>
|
||||
Specifies the member serialization options for the <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
|
||||
@@ -6396,7 +6423,7 @@
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.MemberSerialization.OptIn">
|
||||
<summary>
|
||||
Only members must be marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
Only members marked with <see cref="T:Newtonsoft.Json.JsonPropertyAttribute"/> or <see cref="T:System.Runtime.Serialization.DataMemberAttribute"/> are serialized.
|
||||
This member serialization mode can also be set by marking the class with <see cref="T:System.Runtime.Serialization.DataContractAttribute"/>.
|
||||
</summary>
|
||||
</member>
|
||||
Reference in New Issue
Block a user