Beispiel #1
0
        static void Main(string[] args)
        {
            if (args.Contains("--wait-for-attach"))
            {
                Console.WriteLine("Attach debugger and press any key to continue execution...");
                Console.ReadKey(true);
                if (!Debugger.IsAttached)
                {
                    Console.WriteLine("No debugger detected! Exiting.");
                    return;
                }
                else
                {
                    Debugger.Break();
                }
            }

            List <string> enabledLogOptions = new List <string>();

            if (args.Contains("--with-log-file"))
            {
                WithLogFile = true;
                enabledLogOptions.Add("WithLogFile");
            }

            if (args.Contains("--debug"))
            {
                WithDebugOutput = true;
                enabledLogOptions.Add("WithDebugOutput");
            }

            if (args.Contains("--without-console"))
            {
                WithoutConsole = true;
                enabledLogOptions.Add("WithoutConsole");
            }

            CO.Write(FiggleFonts.Rectangles.Render("O.L.A.F"));
            CO.WriteLine("v{0}", AssemblyVersion.ToString(3));

            Global.SetupLogger(() => SerilogLogger.CreateLogger(enabledLogOptions));

            Global.SetupMessageQueue();

            Profile = new UserBrowserActivity();
            //Profile = new UserDownloads();
            if (Profile.Init() != ApiResult.Success)
            {
                Error("Could not initialize profile {0}.", Profile.Name);
                Exit(ExitCode.InitError);
            }

            if (Profile.Start() != ApiResult.Success)
            {
                Error("Could not start profile {0}.", Profile.Name);
                Exit(ExitCode.StartError);
            }
            Info("Profile {0} started. Press any key to exit.", Profile.Name);

            ConsoleKeyInfo key = Console.ReadKey();

            var s = Profile.Shutdown();

            Exit(s == ApiResult.Success ? ExitCode.Success : ExitCode.ShutdownError);
        }