This commit is contained in:
JustArchi 2016-04-26 22:05:58 +02:00
parent 344c2ad23d
commit 8118fe0690
8 changed files with 26 additions and 26 deletions

View file

@ -38,7 +38,7 @@ namespace ArchiSteamFarm {
internal readonly HashSet<uint> CurrentGamesFarming = new HashSet<uint>();
private readonly ManualResetEventSlim FarmResetEvent = new ManualResetEventSlim(false);
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
private readonly SemaphoreSlim FarmingSemaphore = new SemaphoreSlim(1);
private readonly Bot Bot;
private readonly Timer Timer;
@ -84,15 +84,15 @@ namespace ArchiSteamFarm {
return;
}
await Semaphore.WaitAsync().ConfigureAwait(false);
await FarmingSemaphore.WaitAsync().ConfigureAwait(false);
if (NowFarming || ManualMode) {
Semaphore.Release(); // We have nothing to do, don't forget to release semaphore
FarmingSemaphore.Release(); // We have nothing to do, don't forget to release semaphore
return;
}
if (!await IsAnythingToFarm().ConfigureAwait(false)) {
Semaphore.Release(); // We have nothing to do, don't forget to release semaphore
FarmingSemaphore.Release(); // We have nothing to do, don't forget to release semaphore
Logging.LogGenericInfo("We don't have anything to farm on this account!", Bot.BotName);
await Bot.OnFarmingFinished().ConfigureAwait(false);
return;
@ -100,7 +100,7 @@ namespace ArchiSteamFarm {
Logging.LogGenericInfo("We have a total of " + GamesToFarm.Count + " games to farm on this account...", Bot.BotName);
NowFarming = true;
Semaphore.Release(); // From this point we allow other calls to shut us down
FarmingSemaphore.Release(); // From this point we allow other calls to shut us down
do {
// Now the algorithm used for farming depends on whether account is restricted or not
@ -153,10 +153,10 @@ namespace ArchiSteamFarm {
return;
}
await Semaphore.WaitAsync().ConfigureAwait(false);
await FarmingSemaphore.WaitAsync().ConfigureAwait(false);
if (!NowFarming) {
Semaphore.Release();
FarmingSemaphore.Release();
return;
}
@ -174,7 +174,7 @@ namespace ArchiSteamFarm {
FarmResetEvent.Reset();
Logging.LogGenericInfo("Farming stopped!", Bot.BotName);
Semaphore.Release();
FarmingSemaphore.Release();
}
internal async Task RestartFarming() {

View file

@ -27,15 +27,15 @@ using System.Collections.Generic;
namespace ArchiSteamFarm {
internal static class GitHub {
internal sealed class Asset {
[JsonProperty(PropertyName = "name", Required = Required.Always)]
internal string Name { get; private set; }
[JsonProperty(PropertyName = "browser_download_url", Required = Required.Always)]
internal string DownloadURL { get; private set; }
}
internal sealed class ReleaseResponse {
internal sealed class Asset {
[JsonProperty(PropertyName = "name", Required = Required.Always)]
internal string Name { get; private set; }
[JsonProperty(PropertyName = "browser_download_url", Required = Required.Always)]
internal string DownloadURL { get; private set; }
}
[JsonProperty(PropertyName = "tag_name", Required = Required.Always)]
internal string Tag { get; private set; }

View file

@ -48,7 +48,7 @@ namespace ArchiSteamFarm {
WCFHostname
}
internal enum EMode : byte {
private enum EMode : byte {
Unknown,
Normal, // Standard most common usage
Client, // WCF client only
@ -183,7 +183,7 @@ namespace ArchiSteamFarm {
return;
}
GitHub.Asset binaryAsset = null;
GitHub.ReleaseResponse.Asset binaryAsset = null;
foreach (var asset in releaseResponse.Assets) {
if (string.IsNullOrEmpty(asset.Name) || !asset.Name.Equals(ExecutableName, StringComparison.OrdinalIgnoreCase)) {
continue;

View file

@ -28,7 +28,7 @@ using System.Collections.Generic;
using System.IO;
namespace ConfigGenerator {
internal class ASFConfig {
internal abstract class ASFConfig {
internal static readonly HashSet<ASFConfig> ASFConfigs = new HashSet<ASFConfig>();
internal string FilePath { get; set; }

View file

@ -39,8 +39,8 @@ namespace ConfigGenerator {
[JsonProperty]
public string SteamLogin { get; set; } = null;
[PasswordPropertyText(true)]
[JsonProperty]
[PasswordPropertyText(true)]
public string SteamPassword { get; set; } = null;
[JsonProperty]

View file

@ -26,7 +26,7 @@ using System.IO;
using System.Windows.Forms;
namespace ConfigGenerator {
internal class ConfigPage : TabPage {
internal sealed class ConfigPage : TabPage {
internal readonly ASFConfig ASFConfig;
internal ConfigPage(ASFConfig config) {

View file

@ -27,8 +27,8 @@ using System.Drawing;
using System.Windows.Forms;
namespace ConfigGenerator {
class DialogBox {
public static DialogResult InputBox(string title, string promptText, out string value) {
internal sealed class DialogBox {
internal static DialogResult InputBox(string title, string promptText, out string value) {
if (string.IsNullOrEmpty(title) || string.IsNullOrEmpty(promptText)) {
value = null;
return DialogResult.Abort;
@ -75,7 +75,7 @@ namespace ConfigGenerator {
return dialogResult;
}
public static DialogResult YesNoBox(string title, string promptText) {
internal static DialogResult YesNoBox(string title, string promptText) {
if (string.IsNullOrEmpty(title) || string.IsNullOrEmpty(promptText)) {
return DialogResult.Abort;
}

View file

@ -30,7 +30,7 @@ using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace ConfigGenerator {
public partial class MainForm : Form {
internal sealed partial class MainForm : Form {
private const byte ReservedTabs = 3;
private readonly TabPage NewTab = new TabPage { Text = "+" };
@ -40,7 +40,7 @@ namespace ConfigGenerator {
private ConfigPage ASFTab;
private TabPage OldTab;
public MainForm() {
internal MainForm() {
InitializeComponent();
}