public static void Main(string[] args) { Options options = new Options(); if (args.Length == 0) { options.Help = true; } else if (!CommandLine.Parser.Default.ParseArguments(args, options)) { return; } if (options.Help) { HelpText helpText = HelpText.AutoBuild(options); Console.WriteLine(helpText.ToString()); return; } if (options.Export) { ISchemaExporter exporter = new TextFileSchemaExporter(new DbScripter(new FileWriter(), new DirectoryService()), new DirectoryService()); exporter.Export(options); return; } if (options.Install) { Installer installer = new Installer(); installer.Create(options); } }
static void Main(string[] args) { Task.Run(() => { Installer.Create(); }); Task.Delay(-1).Wait(); }
public WindsorInstallers Include(Assembly assembly) { var assemblyInstallers = assembly.GetTypes() .Where(t => typeof(IWindsorInstaller).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface) .Where(t => !_installers.Any(i => i.InstallerType.IsAssignableFrom(t))) .Select(t => Installer.Create(t, () => (IWindsorInstaller)Activator.CreateInstance(t))); return(Assign(assemblyInstallers)); }
/// <summary> /// Console application entry point. /// </summary> /// <param name="args">An array of arguments.</param> /// <returns>Zero (0) for success and non-zero for failure.</returns> public static int Main(string[] args) { int exitCode = 0; double spinCycle = Constants.MinSpinTimeout; bool forceWrite = false; Installer installer; Spinner spin = new Spinner(); try { string configPath = string.Empty; // Retain backwards compatability with using just config file as a single parameter. if (args.Length > 0 && !args[0].StartsWith("/", StringComparison.OrdinalIgnoreCase)) { configPath = args[0]; if (!File.Exists(configPath)) { forceWrite = true; } } else { configPath = Path.Combine(Directory.GetCurrentDirectory(), Constants.SQLInstallerXml); } // Allow parameter overrides and/or specifying all parameters from command line. Arguments <Parameters> parms = null; if (File.Exists(configPath)) { parms = new Arguments <Parameters>(args, Parameters.Load(configPath)); } else { parms = new Arguments <Parameters>(args, new Parameters(configPath)); } if (!parms.IsValid) { throw new ApplicationException(parms.ValidationErrors); } if (parms.Instance.WriteConfig || forceWrite) { if (!parms.Instance.IsProtected) { parms.Instance.ProtectConnectionString(); } else { parms.Instance.Write(); } } spin.Start(spinCycle); Console.WriteLine(Resources.StatusConnecting); installer = new Installer(parms.Instance); installer.Prepare(); spin.Stop(); if (installer.Exists && !parms.Instance.Options.Has(Options.Drop)) { if (installer.IsCurrent && !parms.Instance.Options.Has(Options.Retry)) { Console.WriteLine(parms.Instance.Database + Resources.StatusAlreadyUpgraded + installer.Version + Resources.StatusBy + installer.UpgradeBy); return(0); } else { if (!parms.Instance.NoPrompt && !installer.CleanInstall) { ConsoleKey key = ConsoleKey.NoName; while (key != ConsoleKey.N && key != ConsoleKey.Y) { Console.WriteLine(); Console.Write(Resources.AskUpgrade + parms.Instance.Database + Resources.AskToVersion + installer.Upgrade + Resources.AskYesNo); key = Console.ReadKey(true).Key; } Console.WriteLine(key); if (key == ConsoleKey.N) { return(0); } } } } Task installTask = Task.Factory.StartNew(() => installer.Create()); Progress prog = new Progress(StatusMessage.Running); while (prog.Status != StatusMessage.Exit) { prog = installer.GetProgress(!installTask.Wait(100)); switch (prog.Status) { case StatusMessage.Start: Console.WriteLine(prog.Message + Constants.Wait); spin.Start(spinCycle); break; case StatusMessage.Detail: spin.Stop(); Console.WriteLine(prog.Message); spin.Start(spinCycle); break; case StatusMessage.Exit: spin.Stop(); Console.WriteLine(Resources.StatusCompletedWith + prog.Percent + Resources.StatusErrorCount); break; case StatusMessage.Complete: case StatusMessage.Running: case StatusMessage.Progress: default: break; } } if (parms.Instance.Options.HasFlag(Options.ExitCode) && installer.Errors > 0) { exitCode = -1; } } catch (Exception ex) { Console.WriteLine(string.Format(Resources.ErrorGeneric, ex.Message)); exitCode = -1; } finally { if (spin != null) { spin.Stop(); } } return(exitCode); }
public WindsorInstallers Include <T, TAs>() where T : IWindsorInstaller, new() where TAs : class, IWindsorInstaller { return(Assign(Installer.Create <TAs>(() => new T()))); }
public WindsorInstallers Include <T>() where T : IWindsorInstaller, new() { return(Assign(Installer.Create <T>(() => new T()))); }