ArchiSteamFarm.ASF.InitBots C# (CSharp) Метод

InitBots() статический приватный Метод

static private InitBots ( ) : void
Результат void
		internal static void InitBots() {
			if (Bot.Bots.Count != 0) {
				return;
			}

			// Before attempting to connect, initialize our list of CMs
			Bot.InitializeCMs(Program.GlobalDatabase.CellID, Program.GlobalDatabase.ServerListProvider);

			foreach (string botName in Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*.json").Select(Path.GetFileNameWithoutExtension)) {
				switch (botName) {
					case SharedInfo.ASF:
					case "example":
					case "minimal":
						continue;
				}

				new Bot(botName).Forget();
			}

			if (Bot.Bots.Count == 0) {
				ArchiLogger.LogGenericWarning("No bots are defined, did you forget to configure your ASF?");
			}
		}

Usage Example

Пример #1
0
        private static async Task InitASF(string[] args)
        {
            ASF.ArchiLogger.LogGenericInfo("ASF V" + SharedInfo.Version);

            await InitGlobalConfigAndLanguage().ConfigureAwait(false);

            if (!Runtime.IsRuntimeSupported)
            {
                ASF.ArchiLogger.LogGenericError(Strings.WarningRuntimeUnsupported);
                await Task.Delay(60 * 1000).ConfigureAwait(false);
            }

            await InitGlobalDatabaseAndServices().ConfigureAwait(false);

            // If debugging is on, we prepare debug directory prior to running
            if (GlobalConfig.Debug)
            {
                Logging.EnableTraceLogging();

                if (Directory.Exists(SharedInfo.DebugDirectory))
                {
                    try {
                        Directory.Delete(SharedInfo.DebugDirectory, true);
                        await Task.Delay(1000).ConfigureAwait(false);                         // Dirty workaround giving Windows some time to sync
                    } catch (IOException e) {
                        ASF.ArchiLogger.LogGenericException(e);
                    }
                }

                Directory.CreateDirectory(SharedInfo.DebugDirectory);

                DebugLog.AddListener(new Debugging.DebugListener());
                DebugLog.Enabled = true;
            }

            // Parse post-init args
            if (args != null)
            {
                await ParsePostInitArgs(args).ConfigureAwait(false);
            }

            // If we ran ASF as a client, we're done by now
            if (Mode.HasFlag(EMode.Client) && !Mode.HasFlag(EMode.Server))
            {
                await Exit().ConfigureAwait(false);
            }

            await ASF.CheckForUpdate().ConfigureAwait(false);

            await ASF.InitBots().ConfigureAwait(false);

            ASF.InitEvents();
        }
All Usage Examples Of ArchiSteamFarm.ASF::InitBots