static void Main(string[] args)
        {
            ConfigurationServiceClient.AppDomainInitializer(
                (message, isError, exception) =>
            {
                if (isError)
                {
                    Console.Error.WriteLine(message + "\n" + exception);
                }
                else
                {
                    Console.WriteLine(message);
                }
            },
                "JARVIS_CONFIG_SERVICE",
                null,
                new FileInfo("defaultParameters.config"),
                missingParametersAction: ConfigurationManagerMissingParametersAction.Blank);

            lastErrorFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "_lastError.txt");
            if (args.Length == 1)
            {
                if (args[0] == "install" || args[0] == "uninstall")
                {
                    var runAsSystem = "true".Equals(
                        ConfigurationManager.AppSettings["runs-as-system"],
                        StringComparison.OrdinalIgnoreCase);
                    var dependencies = ConfigurationManager.AppSettings["depends-on-services"] ?? "";

                    ServiceInstallHelper.StartForInstallOrUninstall(
                        runAsSystem, dependencies, ServiceDescriptiveName, ServiceName);
                }
                else if (args[0] == "restore")
                {
                    Bootstrapper bs = new Bootstrapper();
                    bs.Start(false);
                    var restoreJob = bs.GetRestoreJob();
                    restoreJob.Start();
                }
            }
            else
            {
                var exitcode = StandardStart();
                if (Environment.UserInteractive)
                {
                    if (exitcode != TopshelfExitCode.Ok && Environment.UserInteractive)
                    {
                        Console.WriteLine("Failure exit code: {0} press a key to continue", exitcode.ToString());
                        Console.ReadKey();
                    }
                }
            }
        }
Exemple #2
0
        private static void Main(string[] args)
        {
            //Preload class needed by mongo
            BsonClassMap.LookupClassMap(typeof(BlobId));
            BsonClassMap.LookupClassMap(typeof(DocumentHandle));

            BsonClassMap.RegisterClassMap <FileNameWithExtension>(m =>
            {
                m.AutoMap();
                m.MapProperty(x => x.FileName).SetElementName("name");
                m.MapProperty(x => x.Extension).SetElementName("ext");
            });

            ConfigurationServiceClient.AppDomainInitializer(
                (message, isError, exception) =>
            {
                if (isError)
                {
                    Console.Error.WriteLine(message + "\n" + exception);
                }
                else
                {
                    Console.WriteLine(message);
                }
            },
                "JARVIS_CONFIG_SERVICE",
                null,
                new FileInfo("defaultParameters.config"),
                missingParametersAction: ConfigurationManagerMissingParametersAction.Blank);

            lastErrorFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "_lastError.txt");
            if (args.Length == 1)
            {
                if (args[0] == "install" || args[0] == "uninstall")
                {
                    var runAsSystem = "true".Equals(
                        ConfigurationManager.AppSettings["runs-as-system"],
                        StringComparison.OrdinalIgnoreCase);
                    var dependencies = ConfigurationManager.AppSettings["depends-on-services"] ?? "";

                    ServiceInstallHelper.StartForInstallOrUninstall(
                        runAsSystem, dependencies, ServiceDescriptiveName, ServiceName);
                }
                else if (args[0] == "restore")
                {
                    //Bootstrapper bs = new Bootstrapper();
                    //bs.Start(false);
                    //var restoreJob = bs.GetRestoreJob();
                    //restoreJob.Start();
                }
            }
            else
            {
                var exitcode = StandardStart();
                if (Environment.UserInteractive)
                {
                    if (exitcode != TopshelfExitCode.Ok && Environment.UserInteractive)
                    {
                        Console.WriteLine("Failure exit code: {0} press a key to continue", exitcode.ToString());
                        Console.ReadKey();
                    }
                }
            }
        }