private void Application_Startup(object sender, StartupEventArgs e)
 {
     AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AutoExtractor.AssemblyResolve);
     System.Windows.Forms.Application.EnableVisualStyles();
     LoadPlugins();
     LoadAssembliesGeneric();
     var args = e.Args;
     if (args.Length > 0)
     {
         if (File.Exists(args[0]))
             new Run(File.ReadAllText(args[0])).Show();
         else if (args.Length > 1 && (args[0] == "-o" ||args[0] == "-open") && File.Exists(args[1]))
         {
             var dsn = new Designer();
             dsn.PreLoadFile(args[1]);
             dsn.Show();
         }
         else
         {
             switch (args[0])
             {
                 case "-extract":
                     Utils.InstallUtils.ExtractAll();
                     this.Shutdown();
                     break;
                 case "-install":
                     Utils.InstallUtils.NGen().WaitForExit();
                     this.Shutdown();
                     break;
                 case "-extract-install":
                     Utils.InstallUtils.Install(false);
                     this.Shutdown();
                     break;
                 case "-build":
                     if (args.Length == 3 && File.Exists(args[1]))
                     {
                         ZomBBuilder.BuildZomBString(File.ReadAllText(args[1]), Path.GetFullPath(args[2]));
                         this.Shutdown();
                         break;
                     }
                     else
                     {
                         System.Windows.Forms.MessageBox.Show("Invalid CLI arguments. Valid arguments:\r\n -extract  Extract all embedded dll's\r\n -build infile outfile   Build the infile into an exe at outfile\r\n [fileName]  Run this Zaml file");
                         break;
                     }
                 case "-buildfull":
                     if (args.Length == 3 && File.Exists(args[1]))
                     {
                         ZomBBuilder.CopyDLLs(Path.GetDirectoryName(Path.GetFullPath(args[2])));
                         ZomBBuilder.BuildZomBString(File.ReadAllText(args[1]), Path.GetFullPath(args[2]), true);
                         this.Shutdown();
                         break;
                     }
                     else
                     {
                         System.Windows.Forms.MessageBox.Show("Invalid CLI arguments. Valid arguments:\r\n -extract  Extract all embedded dll's\r\n -build infile outfile   Build the infile into an exe at outfile\r\n [fileName]  Run this Zaml file");
                         break;
                     }
                 case "help":
                 case "--help":
                 case "-help":
                 case "/help":
                 case "/?":
                 case "-h":
                     this.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown;
                     new ZomBWalkthrough.Form().ShowDialog();
                     this.Shutdown();
                     break;
                 default:
                     System.Windows.Forms.MessageBox.Show("Invalid CLI arguments. Valid arguments:\r\n -extract  Extract all embedded dll's\r\n -build infile outfile   Build the infile into an exe at outfile\r\n [fileName]  Run this Zaml file");
                     new Designer().Show();
                     break;
             }
         }
     }
     else
     #if !DEBUG
         try
         {
     #endif
             new Designer().Show();
     #if !DEBUG
         }
         catch (Exception ex)
         {
             string full = ErrorDialog.getFullException(ex);
             System.Windows.Forms.MessageBox.Show(full);
         }
     #endif
 }