Add StartOnLaunch property

This commit is contained in:
JustArchi
2016-02-03 05:43:50 +01:00
parent ed0fd3df78
commit 8934e004fb
3 changed files with 15 additions and 2 deletions

View File

@@ -77,6 +77,7 @@ namespace ArchiSteamFarm {
internal string SteamParentalPIN { get; private set; } = "0";
internal ulong SteamMasterID { get; private set; } = 0;
internal ulong SteamMasterClanID { get; private set; } = 0;
internal bool StartOnLaunch { get; private set; } = true;
internal bool CardDropsRestricted { get; private set; } = false;
internal bool FarmOffline { get; private set; } = false;
internal bool HandleOfflineMessages { get; private set; } = false;
@@ -135,7 +136,7 @@ namespace ArchiSteamFarm {
}
}
internal Bot(string botName) {
internal Bot(string botName, bool initialLaunch = false) {
if (Bots.ContainsKey(botName)) {
return;
}
@@ -155,6 +156,10 @@ namespace ArchiSteamFarm {
return;
}
if (initialLaunch && !StartOnLaunch) {
return;
}
Bots.AddOrUpdate(BotName, this, (key, value) => this);
// Initialize
@@ -348,6 +353,9 @@ namespace ArchiSteamFarm {
case "SteamMasterClanID":
SteamMasterClanID = ulong.Parse(value);
break;
case "StartOnLaunch":
StartOnLaunch = bool.Parse(value);
break;
case "UseAsfAsMobileAuthenticator":
UseAsfAsMobileAuthenticator = bool.Parse(value);
break;

View File

@@ -261,7 +261,7 @@ namespace ArchiSteamFarm {
foreach (var configFile in Directory.EnumerateFiles(ConfigDirectory, "*.xml")) {
string botName = Path.GetFileNameWithoutExtension(configFile);
Bot bot = new Bot(botName);
Bot bot = new Bot(botName, true);
if (!bot.Enabled) {
Logging.LogGenericInfo("Not starting this instance because it's disabled in config file", botName);
}

View File

@@ -58,6 +58,11 @@
<!-- If you don't have your own farming group, most likely you don't want to change it, 0 means there is no master group defined -->
<SteamMasterClanID type="ulong" value="0"/>
<!-- This switch defines if bot should automatically start when ASF process is launched -->
<!-- Some people might want to avoid that, as they may prefer to issue "!start" command themselves -->
<!-- Most likely you want to keep this switch enabled, unless you have a reason -->
<StartOnLaunch type="bool" value="true"/>
<!-- This switch defines if you want to use built-in ASF two-factor-authentication (ASF 2FA) for this account -->
<!-- The one and only purpose for this function is automating steam logins and steam trades, so you won't need to enter 2FA codes all the time -->
<!-- This however defeats the whole purpose of two-factor-auth, and should be used on alt accounts ONLY -->