Improvements mentioned in #478

@il-marc
This commit is contained in:
JustArchi
2017-02-25 18:11:03 +01:00
parent f772cfc0d6
commit 2f81206a10
3 changed files with 116 additions and 51 deletions

View File

@@ -48,12 +48,11 @@ namespace ArchiSteamFarm {
private static readonly object ConsoleLock = new object();
private static readonly ManualResetEventSlim ShutdownResetEvent = new ManualResetEventSlim(false);
private static readonly Dictionary<KeyValuePair<string, ASF.EUserInputType>, string> UserInputs = new Dictionary<KeyValuePair<string, ASF.EUserInputType>, string>();
private static readonly WCF WCF = new WCF();
private static bool ShutdownSequenceInitialized;
private static readonly Dictionary<KeyValuePair<string, ASF.EUserInputType>, string> UserInputs = new Dictionary<KeyValuePair<string, ASF.EUserInputType>, string>();
internal static async Task Exit(byte exitCode = 0) {
if (exitCode != 0) {
ASF.ArchiLogger.LogGenericError(Strings.ErrorExitingWithNonZeroErrorCode);
@@ -139,20 +138,6 @@ namespace ArchiSteamFarm {
Environment.Exit(0);
}
internal static void SetUserInput(ASF.EUserInputType userInputType, string botName, string userInputValue) {
if (string.IsNullOrEmpty(botName) || string.IsNullOrEmpty(userInputValue) || (userInputType == ASF.EUserInputType.Unknown)) {
ASF.ArchiLogger.LogGenericWarning(Strings.ErrorObjectIsNull);
return;
}
KeyValuePair<string, ASF.EUserInputType> userInputKey = new KeyValuePair<string, ASF.EUserInputType>(botName, userInputType);
if (UserInputs.ContainsKey(userInputKey)) {
UserInputs[userInputKey] = userInputValue;
} else {
UserInputs.Add(userInputKey, userInputValue);
}
}
private static async Task Init(string[] args) {
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
TaskScheduler.UnobservedTaskException += UnobservedTaskExceptionHandler;