mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-21 00:38:37 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd7b65868a | ||
|
|
7575704a01 | ||
|
|
b6ce8f435c | ||
|
|
565acca9fb | ||
|
|
610954ba73 | ||
|
|
74a748b03f | ||
|
|
585a075ec9 | ||
|
|
891d40afe1 | ||
|
|
387f0dd1c7 | ||
|
|
8b4d3c219c | ||
|
|
365877ec89 | ||
|
|
f03a43d573 | ||
|
|
d15a9cbfca | ||
|
|
acfad624fb |
@@ -774,12 +774,16 @@ namespace ArchiSteamFarm {
|
|||||||
while (!string.IsNullOrEmpty(key) && currentBot != null) {
|
while (!string.IsNullOrEmpty(key) && currentBot != null) {
|
||||||
if (validate && !IsValidCdKey(key)) {
|
if (validate && !IsValidCdKey(key)) {
|
||||||
key = reader.ReadLine(); // Next key
|
key = reader.ReadLine(); // Next key
|
||||||
continue; // Without changing the bot
|
continue; // Keep current bot
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentBot.SteamClient.IsConnected) {
|
if (!currentBot.SteamClient.IsConnected) {
|
||||||
|
currentBot = null; // Either bot will be changed, or loop aborted
|
||||||
|
} else {
|
||||||
ArchiHandler.PurchaseResponseCallback result = await currentBot.ArchiHandler.RedeemKey(key).ConfigureAwait(false);
|
ArchiHandler.PurchaseResponseCallback result = await currentBot.ArchiHandler.RedeemKey(key).ConfigureAwait(false);
|
||||||
if (result != null) {
|
if (result == null) {
|
||||||
|
currentBot = null; // Either bot will be changed, or loop aborted
|
||||||
|
} else {
|
||||||
switch (result.PurchaseResult) {
|
switch (result.PurchaseResult) {
|
||||||
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.DuplicatedKey:
|
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.DuplicatedKey:
|
||||||
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.InvalidKey:
|
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.InvalidKey:
|
||||||
@@ -787,7 +791,12 @@ namespace ArchiSteamFarm {
|
|||||||
response.Append(Environment.NewLine + "<" + currentBot.BotName + "> Key: " + key + " | Status: " + result.PurchaseResult + " | Items: " + string.Join("", result.Items));
|
response.Append(Environment.NewLine + "<" + currentBot.BotName + "> Key: " + key + " | Status: " + result.PurchaseResult + " | Items: " + string.Join("", result.Items));
|
||||||
|
|
||||||
key = reader.ReadLine(); // Next key
|
key = reader.ReadLine(); // Next key
|
||||||
break; // Next bot (if needed)
|
|
||||||
|
if (result.PurchaseResult == ArchiHandler.PurchaseResponseCallback.EPurchaseResult.OK) {
|
||||||
|
break; // Next bot (if needed)
|
||||||
|
} else {
|
||||||
|
continue; // Keep current bot
|
||||||
|
}
|
||||||
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.AlreadyOwned:
|
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.AlreadyOwned:
|
||||||
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.BaseGameRequired:
|
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.BaseGameRequired:
|
||||||
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.OnCooldown:
|
case ArchiHandler.PurchaseResponseCallback.EPurchaseResult.OnCooldown:
|
||||||
@@ -1226,14 +1235,27 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
string sms = Program.GetUserInput(Program.EUserInputType.SMS, BotName);
|
string sms = Program.GetUserInput(Program.EUserInputType.SMS, BotName);
|
||||||
if (string.IsNullOrEmpty(sms)) {
|
if (string.IsNullOrEmpty(sms)) {
|
||||||
|
Logging.LogGenericWarning("Aborted!", BotName);
|
||||||
|
DelinkMobileAuthenticator();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthenticatorLinker.FinalizeResult finalizeResult = authenticatorLinker.FinalizeAddAuthenticator(sms);
|
AuthenticatorLinker.FinalizeResult finalizeResult;
|
||||||
if (finalizeResult != AuthenticatorLinker.FinalizeResult.Success) {
|
while ((finalizeResult = authenticatorLinker.FinalizeAddAuthenticator(sms)) != AuthenticatorLinker.FinalizeResult.Success) {
|
||||||
Logging.LogGenericError("Unhandled situation: " + finalizeResult, BotName);
|
switch (finalizeResult) {
|
||||||
DelinkMobileAuthenticator();
|
case AuthenticatorLinker.FinalizeResult.BadSMSCode:
|
||||||
return;
|
sms = Program.GetUserInput(Program.EUserInputType.SMS, BotName);
|
||||||
|
if (string.IsNullOrEmpty(sms)) {
|
||||||
|
Logging.LogGenericWarning("Aborted!", BotName);
|
||||||
|
DelinkMobileAuthenticator();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Logging.LogGenericError("Unhandled situation: " + finalizeResult, BotName);
|
||||||
|
DelinkMobileAuthenticator();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that we also save changes made by finalization step (if any)
|
// Ensure that we also save changes made by finalization step (if any)
|
||||||
@@ -1248,13 +1270,13 @@ namespace ArchiSteamFarm {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = BotDatabase.SteamGuardAccount.DeactivateAuthenticator();
|
// Try to deactivate authenticator, and assume we're safe to remove if it wasn't fully enrolled yet (even if request fails)
|
||||||
|
if (BotDatabase.SteamGuardAccount.DeactivateAuthenticator() || !BotDatabase.SteamGuardAccount.FullyEnrolled) {
|
||||||
if (result) {
|
|
||||||
BotDatabase.SteamGuardAccount = null;
|
BotDatabase.SteamGuardAccount = null;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void JoinMasterChat() {
|
private void JoinMasterChat() {
|
||||||
@@ -1364,10 +1386,6 @@ namespace ArchiSteamFarm {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!KeepRunning) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InvalidPassword) {
|
if (InvalidPassword) {
|
||||||
InvalidPassword = false;
|
InvalidPassword = false;
|
||||||
if (!string.IsNullOrEmpty(BotDatabase.LoginKey)) { // InvalidPassword means usually that login key has expired, if we used it
|
if (!string.IsNullOrEmpty(BotDatabase.LoginKey)) { // InvalidPassword means usually that login key has expired, if we used it
|
||||||
@@ -1389,6 +1407,10 @@ namespace ArchiSteamFarm {
|
|||||||
await Utilities.SleepAsync(Program.GlobalConfig.AccountPlayingDelay * 60 * 1000).ConfigureAwait(false);
|
await Utilities.SleepAsync(Program.GlobalConfig.AccountPlayingDelay * 60 * 1000).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!KeepRunning || SteamClient.IsConnected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Logging.LogGenericInfo("Reconnecting...", BotName);
|
Logging.LogGenericInfo("Reconnecting...", BotName);
|
||||||
|
|
||||||
// 2FA tokens are expiring soon, use limiter only when we don't have any pending
|
// 2FA tokens are expiring soon, use limiter only when we don't have any pending
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace ArchiSteamFarm {
|
|||||||
internal readonly ConcurrentDictionary<uint, float> GamesToFarm = new ConcurrentDictionary<uint, float>();
|
internal readonly ConcurrentDictionary<uint, float> GamesToFarm = new ConcurrentDictionary<uint, float>();
|
||||||
internal readonly HashSet<uint> CurrentGamesFarming = new HashSet<uint>();
|
internal readonly HashSet<uint> CurrentGamesFarming = new HashSet<uint>();
|
||||||
|
|
||||||
private readonly ManualResetEvent FarmResetEvent = new ManualResetEvent(false);
|
private readonly ManualResetEventSlim FarmResetEvent = new ManualResetEventSlim(false);
|
||||||
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
|
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
|
||||||
private readonly Bot Bot;
|
private readonly Bot Bot;
|
||||||
private readonly Timer Timer;
|
private readonly Timer Timer;
|
||||||
@@ -421,7 +421,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
bool? keepFarming = await ShouldFarm(appID).ConfigureAwait(false);
|
bool? keepFarming = await ShouldFarm(appID).ConfigureAwait(false);
|
||||||
for (ushort farmingTime = 0; farmingTime <= 60 * Program.GlobalConfig.MaxFarmingTime && keepFarming.GetValueOrDefault(true); farmingTime += Program.GlobalConfig.FarmingDelay) {
|
for (ushort farmingTime = 0; farmingTime <= 60 * Program.GlobalConfig.MaxFarmingTime && keepFarming.GetValueOrDefault(true); farmingTime += Program.GlobalConfig.FarmingDelay) {
|
||||||
if (FarmResetEvent.WaitOne(60 * 1000 * Program.GlobalConfig.FarmingDelay)) {
|
if (FarmResetEvent.Wait(60 * 1000 * Program.GlobalConfig.FarmingDelay)) {
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -452,7 +452,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
while (maxHour < 2) {
|
while (maxHour < 2) {
|
||||||
if (FarmResetEvent.WaitOne(60 * 1000 * Program.GlobalConfig.FarmingDelay)) {
|
if (FarmResetEvent.Wait(60 * 1000 * Program.GlobalConfig.FarmingDelay)) {
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ namespace ArchiSteamFarm {
|
|||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal bool AutoUpdates { get; private set; } = true;
|
internal bool AutoUpdates { get; private set; } = true;
|
||||||
|
|
||||||
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
|
internal bool AutoRestart { get; private set; } = true;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal EUpdateChannel UpdateChannel { get; private set; } = EUpdateChannel.Stable;
|
internal EUpdateChannel UpdateChannel { get; private set; } = EUpdateChannel.Stable;
|
||||||
|
|
||||||
|
|||||||
@@ -65,13 +65,12 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
private const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only
|
private const string GithubReleaseURL = "https://api.github.com/repos/" + GithubRepo + "/releases"; // GitHub API is HTTPS only
|
||||||
|
|
||||||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
internal static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
|
||||||
internal static readonly Version Version = Assembly.GetName().Version;
|
|
||||||
|
|
||||||
private static readonly object ConsoleLock = new object();
|
private static readonly object ConsoleLock = new object();
|
||||||
private static readonly SemaphoreSlim SteamSemaphore = new SemaphoreSlim(1);
|
private static readonly SemaphoreSlim SteamSemaphore = new SemaphoreSlim(1);
|
||||||
private static readonly ManualResetEvent ShutdownResetEvent = new ManualResetEvent(false);
|
private static readonly ManualResetEventSlim ShutdownResetEvent = new ManualResetEventSlim(false);
|
||||||
private static readonly string ExecutableFile = Assembly.Location;
|
private static readonly string ExecutableFile = Assembly.GetEntryAssembly().Location;
|
||||||
private static readonly string ExecutableName = Path.GetFileName(ExecutableFile);
|
private static readonly string ExecutableName = Path.GetFileName(ExecutableFile);
|
||||||
private static readonly string ExecutableDirectory = Path.GetDirectoryName(ExecutableFile);
|
private static readonly string ExecutableDirectory = Path.GetDirectoryName(ExecutableFile);
|
||||||
private static readonly WCF WCF = new WCF();
|
private static readonly WCF WCF = new WCF();
|
||||||
@@ -187,7 +186,7 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
GitHub.Asset binaryAsset = null;
|
GitHub.Asset binaryAsset = null;
|
||||||
foreach (var asset in releaseResponse.Assets) {
|
foreach (var asset in releaseResponse.Assets) {
|
||||||
if (string.IsNullOrEmpty(asset.Name) || !asset.Name.Equals(ExecutableName)) {
|
if (string.IsNullOrEmpty(asset.Name) || !asset.Name.Equals(ExecutableName, StringComparison.OrdinalIgnoreCase)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,10 +250,17 @@ namespace ArchiSteamFarm {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.LogGenericInfo("Update process is finished! ASF will now restart itself...");
|
Logging.LogGenericInfo("Update process finished!");
|
||||||
await Utilities.SleepAsync(5000);
|
|
||||||
|
|
||||||
Restart();
|
if (GlobalConfig.AutoRestart) {
|
||||||
|
Logging.LogGenericInfo("Restarting...");
|
||||||
|
await Utilities.SleepAsync(5000).ConfigureAwait(false);
|
||||||
|
Restart();
|
||||||
|
} else {
|
||||||
|
Logging.LogGenericInfo("Exiting...");
|
||||||
|
await Utilities.SleepAsync(5000).ConfigureAwait(false);
|
||||||
|
Exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void Exit(int exitCode = 0) {
|
internal static void Exit(int exitCode = 0) {
|
||||||
@@ -516,7 +522,7 @@ namespace ArchiSteamFarm {
|
|||||||
Init(args);
|
Init(args);
|
||||||
|
|
||||||
// Wait for signal to shutdown
|
// Wait for signal to shutdown
|
||||||
ShutdownResetEvent.WaitOne();
|
ShutdownResetEvent.Wait();
|
||||||
|
|
||||||
// We got a signal to shutdown
|
// We got a signal to shutdown
|
||||||
Exit();
|
Exit();
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.0.3.1")]
|
[assembly: AssemblyVersion("2.0.3.4")]
|
||||||
[assembly: AssemblyFileVersion("2.0.3.1")]
|
[assembly: AssemblyFileVersion("2.0.3.4")]
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"Debug": false,
|
"Debug": false,
|
||||||
"Headless": false,
|
"Headless": false,
|
||||||
"AutoUpdates": true,
|
"AutoUpdates": true,
|
||||||
|
"AutoRestart": true,
|
||||||
"UpdateChannel": 1,
|
"UpdateChannel": 1,
|
||||||
"SteamProtocol": 6,
|
"SteamProtocol": 6,
|
||||||
"SteamOwnerID": 0,
|
"SteamOwnerID": 0,
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ namespace ConfigGenerator {
|
|||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
public bool AutoUpdates { get; set; } = true;
|
public bool AutoUpdates { get; set; } = true;
|
||||||
|
|
||||||
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
|
public bool AutoRestart { get; set; } = true;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
public EUpdateChannel UpdateChannel { get; set; } = EUpdateChannel.Stable;
|
public EUpdateChannel UpdateChannel { get; set; } = EUpdateChannel.Stable;
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace ConfigGenerator {
|
|||||||
|
|
||||||
private const string ASFDirectory = "ArchiSteamFarm";
|
private const string ASFDirectory = "ArchiSteamFarm";
|
||||||
|
|
||||||
private static readonly string ExecutableDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
private static readonly string ExecutableDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
|
|||||||
@@ -135,6 +135,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<!--
|
||||||
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||||
"$(SolutionDir)tools\ILRepack\ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out\ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
"$(SolutionDir)tools\ILRepack\ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out\ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||||
del "$(SolutionDir)out\ASF-GUI.exe.config"
|
del "$(SolutionDir)out\ASF-GUI.exe.config"
|
||||||
@@ -143,6 +144,7 @@
|
|||||||
mono -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
mono -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||||
rm "$(SolutionDir)out/ASF-GUI.exe.config"
|
rm "$(SolutionDir)out/ASF-GUI.exe.config"
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
Reference in New Issue
Block a user