Пример #1
0
        /// <summary>
        /// Parse entered arguments.
        /// </summary>
        /// <param name="args"></param>
        private static void ParseArgs(IEnumerable <string> args)
        {
            BaseCommand currentCommand = null;

            foreach (var arg in args)
            {
                if (!string.IsNullOrEmpty(arg))
                {
                    if (CommandConstants.CommandPrefixes.Contains(arg[0]))
                    {
                        if (currentCommand != null)
                        {
                            var isContinue = currentCommand.Execute();
                            currentCommand = null;
                            if (!isContinue)
                            {
                                break;
                            }
                        }

                        var commandKey = arg.TrimStart(CommandConstants.CommandPrefixes);

                        currentCommand = Commands.FirstOrDefault(
                            c => string.Equals(c.Key, commandKey, StringComparison.OrdinalIgnoreCase));

                        if (currentCommand == null)
                        {
                            PrintInvalidCommand(commandKey);
                            break;
                        }
                    }
                    else
                    {
                        if (currentCommand != null)
                        {
                            currentCommand.Args.Add(arg);
                        }
                        else
                        {
                            PrintInvalidCommand(arg);
                            break;
                        }
                    }
                }
            }

            if (currentCommand != null)
            {
                currentCommand.Execute();
            }
        }
Пример #2
0
 void Update()
 {
     if (_currentBasecommand != null)
     {
         _currentBasecommand.Execute(currentTran);
     }
 }
Пример #3
0
        void OnNodeCommandClick(object sender, EventArgs e)
        {
            ToolStripItem item = sender as ToolStripItem;
            BaseCommand   act  = item.Tag as BaseCommand;

            act.Execute();
        }
 public void PublishCommand(BaseCommand Command)
 {
     foreach (IActor actor in actors)
     {
         Command.Execute(actor);
     }
 }
Пример #5
0
 private void InternalCreate()
 {
     _createCommand = new StartCommand(_context, _log);
     _createCommand
     .SetNext(new ValidationCommand())
     .SetNext(new IdentifyProjectNameCommand())
     .SetNext(new IdentifyBuildCommand())
     .SetNext(new IdentifyBuildPropertiesCommand())
     .SetNext(new DownloadBuildCommand())
     .SetNext(new UnzipBuildCommand())
     .SetNext(new RestoreDatabaseCommand())
     .SetNext(new CheckoutCoreCommand())
     .SetNext(new UpdateDatabaseConnectionStringCommand())
     .SetNext(new UpdateRedisConnectionStringCommand())
     .SetNext(new EnableFileDesignModeCommand())
     .SetNext(new PrepareDevDatabaseCommand())
     .SetNext(new ClearCulturesFromDatabaseCommand())
     .SetNext(new UnlockDevPackagesInDatabaseCommand())
     .SetNext(new CreateWorkspaceConsoleShortcutCommand())
     .SetNext(new UpdateWCDatabaseConnectionStringCommand())
     .SetNext(new EnableFileDesignModeWorkspaceConsoleCommand())
     .SetNext(new SetWorkspaceConsolePrefer32BitCommand())
     .SetNext(new CheckoutPackagesCommand())
     .SetNext(new CheckoutUnitTestsCommand())
     .SetNext(new UpdateIntegrationConnectionStringCommand())
     .SetNext(new BuildCommand())
     .SetNext(new UpdateWorkspace())
     .SetNext(new BuildWorkspace())
     .SetNext(new RunTsLib());
     _createCommand.Execute();
 }
        public static async Task ExecuteAPI(HttpContext context, System.Net.WebSockets.WebSocket webSocket)
        {
            var buffer = new byte[1024 * 20];
            WebSocketReceiveResult result = await webSocket.ReceiveAsync(new ArraySegment <byte>(buffer), CancellationToken.None);

            while (!result.CloseStatus.HasValue)
            {
                string strRequest = Encoding.UTF8.GetString(buffer);
                string str        = strRequest.Replace("\0", string.Empty);
                string jsonStr    = string.Empty;

                try
                {
                    //Method
                    APIModel    apiModel = JsonSerializer.Deserialize <APIModel>(str);
                    string      apiName  = apiModel.Method;
                    BaseCommand command  = Activator.CreateInstance(CommandsDict[apiName]) as BaseCommand;
                    command.WebSocket = webSocket;
                    jsonStr           = command.Execute(str);
                    buffer            = Encoding.UTF8.GetBytes(jsonStr);
                    BaseRequestModel requestModel = JsonSerializer.Deserialize <BaseRequestModel>(str);
                    if (!string.IsNullOrEmpty(requestModel.Token))
                    {
                        if (command is UserLogoutCommand)
                        {
                            //do nothing
                        }
                        else
                        {
                            UserInfo userInfo = UserInfoDict[requestModel.Token];
                            userInfo.ActionTime = DateTime.Now;
                        }
                    }
                    else if (command is UserLoginCommand)
                    {
                        //do nothing
                    }
                }
                catch (Exception ex)
                {
                    ErrorResponseModel responseModel = new ErrorResponseModel();
                    responseModel.StatusCode = 0;
                    responseModel.ErrorCode  = "500";
                    responseModel.Message    = ex.Message;
                    jsonStr = JsonSerializer.Serialize(responseModel);
                    buffer  = Encoding.UTF8.GetBytes(jsonStr);
                }

                await webSocket.SendAsync(new ArraySegment <byte>(buffer, 0, jsonStr.Length), result.MessageType, result.EndOfMessage, CancellationToken.None);

                buffer = new byte[1024 * 20];
                result = await webSocket.ReceiveAsync(new ArraySegment <byte>(buffer), CancellationToken.None);
            }
            await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
        }
Пример #7
0
        public void QueueCommand <T>(BaseCommand <T> command) where T : class
        {
            command.MarkAsModified = MarkAsModified;
            command.MarkAsAdded    = MarkAsAdded;
            command.MarkAsDeleted  = MarkAsDeleted;

            command.Execute(Context.Set <T>());

            command.MarkAsModified = x => { };
            command.MarkAsAdded    = x => { };
            command.MarkAsDeleted  = x => { };
        }
Пример #8
0
 void ExecuteCommands()
 {
     if (commandQueue.Count != 0)
     {
         //Do I have a command?
         BaseCommand currentCommand = commandQueue.Peek();
         if (currentCommand.Execute(this))
         {
             commandQueue.Dequeue();
         }
     }
 }
 public override RxObservables Execute()
 {
     try
     {
         //retry using Polly or Custom
         return(_baseCommand.Execute());
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #10
0
        public bool Redo()
        {
            if (CurrentCommand == ListOfCommands.Count)
            {
                return(false);
            }

            BaseCommand command = ListOfCommands[CurrentCommand++];

            command.Execute();

            return(true);
        }
 void ExecuteCommands()
 {
     if (commandQueue.Count != 0)
     {
         BaseCommand currentCommand = commandQueue.Peek();
         // If we have a current command
         if (currentCommand != null)
         {
             // If the current command has finished executing
             if (currentCommand.Execute(this))
             {
                 commandQueue.Dequeue();
             }
         }
     }
 }
Пример #12
0
    public void RunCommands()
    {
        if (_currentCommand != null && _currentCommand.isRunning)
        {
            return;
        }

        if (CommandList.Count == 0)
        {
            IsCommandsRunning = false;
            return;
        }

        _currentCommand = CommandList.Dequeue();
        _currentCommand.Execute();
    }
        protected AjaxResult ProcessRequest <TRequest, TResult>(TRequest request) where TRequest : Request
        {
            AjaxResult ajaxResult;
            var        commandLocator = Kernel.ServiceLocator.GetService <ICommandLocator>();
            var        logger         = Kernel.ServiceLocator.GetService <ILogger>();
            BaseCommand <TRequest, TResult> command = null;

            try
            {
                command = commandLocator.FindCommand <TRequest, TResult>();
                var result = command.Execute(request);

                switch (result.ResultType)
                {
                case ResponseTypes.Success:
                    logger.Info("Successfully Processed Request", new { request, result });
                    ajaxResult = new AjaxSuccessfulResult(result);
                    break;

                case ResponseTypes.Error:
                    logger.Error("Error Processing Request", new { request, result });
                    ajaxResult = new AjaxErrorResult("HEY REDO THIS", result);
                    break;

                case ResponseTypes.InvalidRequest:
                    logger.Error("Invalid Request", new { request, result });
                    ajaxResult = new AjaxErrorResult("HEY REDO THIS", result);
                    break;

                case ResponseTypes.Unauthorized:
                    logger.Error("Unauthorized Request", new { request, result });
                    ajaxResult = new AjaxErrorResult("HEY REDO THIS", result);
                    break;

                default:
                    ajaxResult = new AjaxErrorResult("Unknown response type", result);
                    break;
                }
            }
            catch (Exception exception)
            {
                logger.Error("Could not process request", new { request, exception, command });
                ajaxResult = new AjaxErrorResult("Could not process request", new { request, exception });
            }

            return(ajaxResult);
        }
        public SvgReplacePageModel()
        {
            ReplaceCommand = new BaseCommand((arg) =>
            {
                var r = _random.Next(256);
                var g = _random.Next(256);
                var b = _random.Next(256);

                ReplaceMap = new Dictionary <string, string>()
                {
                    { "#TEXT", Guid.NewGuid().ToString() },
                    { "#FILLCOLOR", $"#{r:X2}{g:X2}{b:X2}" }
                };
            });

            ReplaceCommand.Execute(null);
        }
Пример #15
0
        public ProductsGridPageModel()
        {
            ItemTappedCommand = new BaseCommand((param) =>
            {
                var item = LastTappedItem as ComplexItem;
                if (item != null)
                {
                    //Is the button add
                    if (item.IsDirty)
                    {
                        AddCommand = new BaseCommand((arg) =>
                        {
                            insertId++;
                            Items.Insert(Items.Count - 1, new ComplexItem()
                            {
                                Title = string.Format("New {0}", insertId)
                            });
                        });
                        AddCommand.Execute(param);
                    }
                    else
                    {
                        var options = new NotificationOptions()
                        {
                            Title       = "Title",
                            Description = "Description"
                        };

                        notificator.Notify(new NotificationOptions()
                        {
                            Title       = item.Title,
                            Description = item.CreatedAt.ToString()
                        });
                        System.Diagnostics.Debug.WriteLine("Tapped {0}", item.Title);
                    }
                }
            });



            RemoveCommand = new BaseCommand((arg) =>
            {
                Items.RemoveAt(Items.Count - 1);
            });
        }
Пример #16
0
        public SvgReplacePageModel()
        {
            ReplaceCommand = new BaseCommand((arg) =>
            {
                var r = _random.Next(256);
                var g = _random.Next(256);
                var b = _random.Next(256);

                ReplaceMap = new Dictionary <string, string>()
                {
                    { "#TEXT", Guid.NewGuid().ToString() },
                    { "#FILLCOLOR", $"#{r:X2}{g:X2}{b:X2}" }
                };

                ImageSource = SvgImageSource.FromResource("FFImageLoading.Forms.Sample.Resources.replace.svg",
                                                          replaceStringMap: ReplaceMap);
            });

            ReplaceCommand.Execute(null);
        }
Пример #17
0
        static void Main(string[] args)
        {
            var cubeCrypto            = new CubeCrypto(new Cube(4));
            var cubeToStringConverter = new CubeToStringConverter();
            var keyStringConverter    = new KeyStringConverter();
            var keyGenerator          = new KeyGenerator();

            commands.ForEach(cmd =>
            {
                cmd.CubeCrypto            = cubeCrypto;
                cmd.CubeToStringConverter = cubeToStringConverter;
                cmd.KeyGenerator          = keyGenerator;
                cmd.KeyStringConverter    = keyStringConverter;
            });

            Console.WriteLine("###################################");
            Console.WriteLine("## DoublePermutation by DenKodec ##");
            Console.WriteLine("###################################");
            Console.WriteLine();

            while (true)
            {
                Console.Write("=> ");
                string      strCommand = Console.ReadLine();
                BaseCommand command    = commands.Find(cmd => cmd.Name == strCommand);
                if (command != null)
                {
                    command.Execute();
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("This command not found");
                    Console.WriteLine("Enter <help> to get information about commands");
                }
            }
        }
Пример #18
0
        static void Main(string[] args)
        {
            var factory = GetType <CommandFactory>();

            while (true)
            {
                Console.Write("enter command: ");
                string readStr = Console.ReadLine();

                var inputArgs = readStr.Split(' ');

                if (inputArgs.Length == 0)
                {
                    continue;
                }

                BaseCommand command = factory.GetCommand(inputArgs[0]);

                try
                {
                    command.Execute(inputArgs);
                }
                catch (QuitException ex)
                {
                    break;
                }
                catch (ExcelNotCreatedException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(command.GetDescription());
                }
            }
        }
Пример #19
0
        static void Main(string[] args)
        {
            var assembly = Assembly.GetExecutingAssembly();
            var attr     = assembly.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
            var fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

            _version = fvi.ProductVersion;
            if (attr.Length > 0)
            {
                var aca = (AssemblyConfigurationAttribute)attr[0];
                _sha         = aca.Configuration;
                _fullVersion = $"{_version} ({_sha})";
            }
            else
            {
                _fullVersion = fvi.ProductVersion;
                _sha         = "";
            }

            CultureUtil.NormalizeUICulture();
            _commandLineArgs = args;

            // setup logger
            var assemblyPath  = Path.GetDirectoryName(new Uri(assembly.CodeBase).LocalPath);
            var logConfigPath = Path.Combine(assemblyPath, "dmdext.log.config");

            if (File.Exists(logConfigPath))
            {
                LogManager.Configuration = new XmlLoggingConfiguration(logConfigPath, true);
#if !DEBUG
                LogManager.Configuration.AddTarget("memory", MemLogger);
                LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, MemLogger));
                LogManager.ReconfigExistingLoggers();
#endif
            }
#if !DEBUG
            else
            {
                SimpleConfigurator.ConfigureForTargetLogging(MemLogger, LogLevel.Debug);
            }
#endif
            AssertDotNetVersion();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // enable exit handler
            _handler += ExitHandler;
            SetConsoleCtrlHandler(_handler, true);

            var    invokedVerb         = "";
            object invokedVerbInstance = null;
            var    options             = new Options();
            if (!CommandLine.Parser.Default.ParseArgumentsStrict(args, options, (verb, subOptions) => {
                // if parsing succeeds the verb name and correct instance
                // will be passed to onVerbCommand delegate (string,object)
                invokedVerb = verb;
                invokedVerbInstance = subOptions;
            }))
            {
                Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
            }

            try {
                Logger.Info("Launching console tool v{0}", _fullVersion);
                options.Validate();
                var cmdLineOptions = (BaseOptions)invokedVerbInstance;
                var config         = cmdLineOptions.DmdDeviceIni == null
                                        ? (IConfiguration)cmdLineOptions
                                        : new Configuration(cmdLineOptions.DmdDeviceIni);

                //BaseOptions baseOptions;
                switch (invokedVerb)
                {
                case "mirror":
                    _command = new MirrorCommand(config, (MirrorOptions)cmdLineOptions);
                    break;

                case "play":
                    _command = new PlayCommand(config, (PlayOptions)cmdLineOptions);
                    break;

                case "test":
                    _command = new TestCommand(config, (TestOptions)cmdLineOptions);
                    break;

                case "server":
                    _command = new ServerCommand(config, (ServerOptions)cmdLineOptions);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                var renderGraphs = _command.GetRenderGraphs();

                if (config.Bitmap.Enabled)
                {
                    renderGraphs.AddDestination(new BitmapOutput(config.Bitmap.Path));
                }

                if (config.PinUp.Enabled)
                {
                    try {
                        renderGraphs.AddDestination(new PinUpOutput(config.PinUp.GameName));
                    } catch (Exception e) {
                        Logger.Warn("Error opening PinUP output: {0}", e.Message);
                    }
                }

                _command.Execute(() => {
                    if (config != null && config.Global.QuitWhenDone)
                    {
                        Logger.Info("Exiting.");
                        _command?.Dispose();
                        Environment.Exit(0);
                    }
                }, ex => {
                    Logger.Error("Error: {0}", ex.Message);
                    _command?.Dispose();
                    Environment.Exit(0);
                });

                if (config.Global.QuitAfter > -1)
                {
                    Logger.Info("Quitting in {0}ms...", config.Global.QuitAfter);
                    Observable
                    .Return(Unit.Default)
                    .Delay(TimeSpan.FromMilliseconds(config.Global.QuitAfter))
                    .Subscribe(_ => WinApp.Dispatcher.Invoke(() => WinApp.Shutdown()));
                }
                else
                {
                    Logger.Info("Press CTRL+C to close.");
                }

                WinApp.Run();
            } catch (DeviceNotAvailableException e) {
                Logger.Error("Device {0} is not available.", e.Message);
            } catch (NoRenderersAvailableException) {
                Logger.Error("No output devices available.");
            } catch (InvalidOptionException e) {
                Logger.Error("Invalid option: {0}", e.Message);
            } catch (FileNotFoundException e) {
                Logger.Error(e.Message);
                Logger.Info("Try installing the Visual C++ Redistributable for Visual Studio 2015 if you haven't so already:");
                Logger.Info("    https://www.microsoft.com/en-us/download/details.aspx?id=48145");
            } catch (UnknownFormatException e) {
                Logger.Error(e.Message);
            } catch (WrongFormatException e) {
                Logger.Error(e.Message);
            } catch (UnsupportedResolutionException e) {
                Logger.Error(e.Message);
            } catch (InvalidFolderException e) {
                Logger.Error(e.Message);
            } catch (RenderException e) {
                Logger.Error(e.Message);
            } catch (NoRawDestinationException e) {
                Logger.Error(e.Message);
            } catch (MultipleRawSourcesException e) {
                Logger.Error(e.Message);
            } catch (ProPinballSlaveException e) {
                Logger.Error(e.Message);
            } catch (IncompatibleRenderer e) {
                Logger.Error(e.Message);
            } catch (IncompatibleSourceException e) {
                Logger.Error(e.Message);
            } catch (IniNotFoundException e) {
                Logger.Error(e.Message);
            } catch (CropRectangleOutOfRangeException e) {
                Logger.Error(e.Message);
                Logger.Error("Are you running PinballFX2 in cabinet mode with the DMD at 1040x272?");
            } finally {
                Process.GetCurrentProcess().Kill();
            }
        }
Пример #20
0
        static void Main(string[] args)
        {
            AssertDotNetVersion();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // enable exit handler
            _handler += ExitHandler;
            SetConsoleCtrlHandler(_handler, true);

            var    invokedVerb         = "";
            object invokedVerbInstance = null;
            var    options             = new Options();

            if (!CommandLine.Parser.Default.ParseArgumentsStrict(args, options, (verb, subOptions) => {
                // if parsing succeeds the verb name and correct instance
                // will be passed to onVerbCommand delegate (string,object)
                invokedVerb = verb;
                invokedVerbInstance = subOptions;
            }))
            {
                Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
            }

            BaseOptions baseOptions;

            switch (invokedVerb)
            {
            case "mirror":
                baseOptions = (BaseOptions)invokedVerbInstance;
                _command    = new MirrorCommand((MirrorOptions)baseOptions);
                break;

            case "test":
                baseOptions = (BaseOptions)invokedVerbInstance;
                _command    = new TestCommand((TestOptions)baseOptions);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            try {
                _command.Execute(() => {
                    if (baseOptions != null && baseOptions.QuitWhenDone)
                    {
                        Logger.Info("Exiting.");
                        _command?.Dispose();
                        Environment.Exit(0);
                    }
                }, ex => {
                    Logger.Error("Error: {0}", ex.Message);
                    _command?.Dispose();
                    Environment.Exit(0);
                });
                Logger.Info("Press CTRL+C to close.");
                WinApp.Run();
            } catch (DeviceNotAvailableException e) {
                Logger.Error("Device {0} is not available.", e.Message);
            } catch (NoRenderersAvailableException) {
                Logger.Error("No output devices available.");
            } catch (InvalidOptionException e) {
                Logger.Error("Invalid option: {0}", e.Message);
            } finally {
                Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
            }
        }
 public RxObservables ExecuteTask()
 {
     return(_baseCommand.Execute());
 }
Пример #22
0
 public static void Execute(BaseCommand command, string[] parms)
 {
     command.Execute(parms);
 }
Пример #23
0
        static void Main(string[] args)
        {
            _commandLineArgs = args;

            // setup logger
            var assemblyPath  = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            var logConfigPath = Path.Combine(assemblyPath, "dmdext.log.config");

            if (File.Exists(logConfigPath))
            {
                LogManager.Configuration = new XmlLoggingConfiguration(logConfigPath, true);
#if !DEBUG
                LogManager.Configuration.AddTarget("memory", MemLogger);
                LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, MemLogger));
                LogManager.ReconfigExistingLoggers();
#endif
            }
#if !DEBUG
            else
            {
                SimpleConfigurator.ConfigureForTargetLogging(MemLogger, LogLevel.Debug);
            }
#endif
            AssertDotNetVersion();
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // enable exit handler
            _handler += ExitHandler;
            SetConsoleCtrlHandler(_handler, true);

            var    invokedVerb         = "";
            object invokedVerbInstance = null;
            var    options             = new Options();
            if (!CommandLine.Parser.Default.ParseArgumentsStrict(args, options, (verb, subOptions) => {
                // if parsing succeeds the verb name and correct instance
                // will be passed to onVerbCommand delegate (string,object)
                invokedVerb = verb;
                invokedVerbInstance = subOptions;
            }))
            {
                Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
            }

            Logger.Info("Launching console tool.");
            BaseOptions baseOptions;
            switch (invokedVerb)
            {
            case "mirror":
                baseOptions = (BaseOptions)invokedVerbInstance;
                _command    = new MirrorCommand((MirrorOptions)baseOptions);
                break;

            case "play":
                baseOptions = (PlayOptions)invokedVerbInstance;
                _command    = new PlayCommand((PlayOptions)baseOptions);
                break;

            case "test":
                baseOptions = (BaseOptions)invokedVerbInstance;
                _command    = new TestCommand((TestOptions)baseOptions);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            try {
                var renderer = _command.GetRenderGraph();

                if (baseOptions.SaveToFile != null)
                {
                    (renderer as RenderGraph)?.Destinations.Add(new BitmapOutput(baseOptions.SaveToFile));
                }

                _command.Execute(() => {
                    if (baseOptions != null && baseOptions.QuitWhenDone)
                    {
                        Logger.Info("Exiting.");
                        _command?.Dispose();
                        Environment.Exit(0);
                    }
                }, ex => {
                    Logger.Error("Error: {0}", ex.Message);
                    _command?.Dispose();
                    Environment.Exit(0);
                });

                if (baseOptions.QuitAfter > -1)
                {
                    Logger.Info("Quitting in {0}ms...", baseOptions.QuitAfter);
                    Observable
                    .Return(Unit.Default)
                    .Delay(TimeSpan.FromMilliseconds(baseOptions.QuitAfter))
                    .Subscribe(_ => WinApp.Dispatcher.Invoke(() => WinApp.Shutdown()));
                }
                else
                {
                    Logger.Info("Press CTRL+C to close.");
                }

                WinApp.Run();
            } catch (DeviceNotAvailableException e) {
                Logger.Error("Device {0} is not available.", e.Message);
            } catch (NoRenderersAvailableException) {
                Logger.Error("No output devices available.");
            } catch (InvalidOptionException e) {
                Logger.Error("Invalid option: {0}", e.Message);
            } catch (FileNotFoundException e) {
                Logger.Error(e.Message);
                Logger.Info("Try installing the Visual C++ Redistributable for Visual Studio 2015 if you haven't so already:");
                Logger.Info("    https://www.microsoft.com/en-us/download/details.aspx?id=48145");
            } catch (UnknownFormatException e) {
                Logger.Error(e.Message);
            } catch (WrongFormatException e) {
                Logger.Error(e.Message);
            } catch (UnsupportedResolutionException e) {
                Logger.Error(e.Message);
            } catch (InvalidFolderException e) {
                Logger.Error(e.Message);
            } catch (RenderException e) {
                Logger.Error(e.Message);
            } catch (NoRawDestinationException e) {
                Logger.Error(e.Message);
            } catch (MultipleRawSourcesException e) {
                Logger.Error(e.Message);
            } catch (ProPinballSlaveException e) {
                Logger.Error(e.Message);
            } catch (IncompatibleRenderer e) {
                Logger.Error(e.Message);
            } catch (IncompatibleSourceException e) {
                Logger.Error(e.Message);
            } catch (CropRectangleOutOfRangeException e) {
                Logger.Error(e.Message);
                Logger.Error("Are you running PinballFX2 in cabinet mode with the DMD at 1040x272?");
            } finally {
                Process.GetCurrentProcess().Kill();
            }
        }