Пример #1
0
        public static async Task Main(string[] args)
        {
https:      //github.com/TRKS-Team/WFBot
            var skipPressKey = false;
            var setCurrentFolder = false;

            foreach (var s in args)
            {
                switch (s)
                {
                case "--skip-press-any-key":
                    skipPressKey = true;
                    break;

                case "--set-current-folder-to-executable":
                    setCurrentFolder = true;
                    break;

                case "--no-logs":
                    NoLog = true;
                    break;
                }
            }

            if (setCurrentFolder)
            {
                Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
            }

            var wfbot = new WFBotCore();

            WFBotCore.Instance = wfbot;
            var sw = Stopwatch.StartNew();

            try
            {
                await wfbot.Init();
            }
            catch (Exception e)
            {
                Console.WriteLine("WFBot 在初始化中遇到了问题.");
                Trace.WriteLine(e);
                if (!skipPressKey)
                {
                    Console.WriteLine("按任意键继续.");
                    Console.ReadKey();
                }
                return;
            }

            Messenger.SendDebugInfo($"WFBot 加载完成. 用时 {sw.Elapsed.TotalSeconds:F1}s.");

            await wfbot.Run();
        }
Пример #2
0
        public static async Task Main(string[] args)
        {
https:      //github.com/TRKS-Team/WFBot
            var skipPressKey = false;
            var setCurrentFolder = false;

            foreach (var s in args)
            {
                switch (s)
                {
                case "--skip-press-any-key":
                    skipPressKey = true;
                    break;

                case "--set-current-folder-to-executable":
                    setCurrentFolder = true;
                    break;

                case "--no-logs":
                    NoLog = true;
                    break;

                case "--dont-throw-if-resource-unable-to-load":
                    DontThrowIfResourceUnableToLoad = true;
                    break;
                }
            }

            if (setCurrentFolder)
            {
                Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
            }

            var wfbot = new WFBotCore();

            try
            {
                await wfbot.Init();
            }
            catch (Exception e)
            {
                Console.WriteLine("WFBot 在初始化中遇到了问题.");
                Trace.WriteLine(e);
                if (!skipPressKey)
                {
                    Console.WriteLine("按任意键继续.");
                    Console.ReadKey();
                }
                return;
            }

            await wfbot.Run();
        }