private void OpenProject(string pathToProject) { try { GameInitializer.LoadProject(pathToProject); MessageBox.Show(this, "Project loaded", "Done"); } catch (Exception ex) { switch (ex) { case LoadException _: case PreprocessorException _: Logger.Warning(ex, "Load failed"); MessageBoxes.LoadFailedExceptionBox(ex); break; case TargetInvocationException tie when tie.InnerException is ValidationFailedException vfe: Logger.Warning(ex, "Validation failed"); MessageBoxes.LoadFailedExceptionBox(vfe); break; default: throw; } } }