Exemple #1
0
        private static void goInProcess()
        {
            var start = DateTime.Now;

            void loadCommandLine()
            {
                var  args      = Environment.GetCommandLineArgs();
                bool isVerbose = args.Contains("--verbose") || args.Contains("-v");
                bool isQuiet   = args.Contains("--quiet");
                bool isColor   = args.Contains("--color") || args.Contains("-c");

                ConsoleTraceListener.SetStartupTime(start);
                var cliTraceListener = new ConsoleTraceListener(isVerbose, isQuiet, isColor);

                Log.AddListener(cliTraceListener);
                cliTraceListener.TraceEvents(TapInitializer.InitTraceListener.Instance.AllEvents.ToArray());
                AppDomain.CurrentDomain.ProcessExit += (s, e) => cliTraceListener.Flush();
            }

            TapInitializer.Initialize(); // This will dynamically load OpenTap.dll
            // loadCommandLine has to be called after Initialize
            // to ensure that we are able to load OpenTap.dll
            loadCommandLine();
            wrapGoInProcess();
        }