Пример #1
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
                new ArgumentSpec(
                    "Log",
                    'l',
                    "-",
                    "file",
                    "Log file name ('-' for stdout)"),
                new ArgumentSpec(
                    "ConfigFile",
                    'c',
                    "Settings.xml",
                    null,
                    "Configuration file"),
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);

            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("homeservice"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Runs HomeService\n");
                Console.Error.WriteLine(args.GetUsage("homeservice"));
                System.Environment.Exit(0);
            }

            string configFile = ((string)args["ConfigFile"]);

            if (!File.Exists(configFile))
            {
                Console.Error.WriteLine("ConfigFile {0} not found", configFile);
                System.Environment.Exit(1);
            }

            return(args);
        }
Пример #2
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
               new ArgumentSpec(
                   "PlatformRootDir",
                   'd',
                   "output\\binaries\\Platform",
                   "directory name",
                   "Platform directory containing the binaries"),
             new ArgumentSpec(
                   "RepoDir",
                   'r',
                   "output\\HomeStore\\repository",
                   "directory name",
                   "Top-level directory where we should create the homestore repository")
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("PlatformPackager"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Packages platform binaries\n");
                Console.Error.WriteLine(args.GetUsage("PlatformPackager"));
                System.Environment.Exit(0);
            }

            return args;
        }
Пример #3
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
                new ArgumentSpec(
                    "Log",
                    'l',
                    "-",
                    "file",
                    "Log file name ('-' for stdout)"),
                new ArgumentSpec(
                    "ConfigFile",
                    'c',
                    "Settings.xml",
                    null,
                    "Configuration file"),
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("homeservice"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Runs HomeService\n");
                Console.Error.WriteLine(args.GetUsage("homeservice"));
                System.Environment.Exit(0);
            }

            string configFile = ((string)args["ConfigFile"]);

            if (!File.Exists(configFile))
            {
                Console.Error.WriteLine("ConfigFile {0} not found", configFile);
                System.Environment.Exit(1);
            }

            return args;
        }
Пример #4
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
                new ArgumentSpec(
                    "SmtpServer",
                    's',
                    "smtp.live.com",
                    "smtp server name",
                    "The name of the smtp server"),
                new ArgumentSpec(
                    "SmtpUser",
                    'u',
                    "*****@*****.**",
                    "smtp user name",
                    "The name of the smtp user"),
                new ArgumentSpec(
                    "SmtpPassword",
                    'p',
                    "home123$",
                    "smtp server name",
                    "password for the smtp server"),
                new ArgumentSpec(
                    "To",
                    't',
                    "*****@*****.**",
                    "whom to send email",
                    "The target of email"),
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);

            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("PlatformPackager"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Packages platform binaries\n");
                Console.Error.WriteLine(args.GetUsage("PlatformPackager"));
                System.Environment.Exit(0);
            }

            if ((string.IsNullOrEmpty((string)args["To"])))
            {
                Console.Error.WriteLine("You must supply a valid to address");
                Console.Error.WriteLine(args.GetUsage("EmailTester"));
                System.Environment.Exit(1);
            }

            return(args);
        }
Пример #5
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            //the default values are under the assumption that you run this tool from the directory where Hub.sln sits.

            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
               new ArgumentSpec(
                   "ScoutsRootDir",
                   'd',
                   "output\\binaries\\Scouts",
                   "directory name",
                   "Root directory for all Scouts"),
               new ArgumentSpec(
                   "ScoutName",
                   'n',
                   "",
                   "scout name",
                   "Name of the scout. Leave empty if you want to package all scouts"),
             new ArgumentSpec(
                   "RepoDir",
                   'r',
                   "output\\HomeStore\\repository",
                   "directory name",
                   "Top-level directory where we should create the homestore repository"),
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("ScoutPackager"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Packages platform binaries\n");
                Console.Error.WriteLine(args.GetUsage("ScoutPackager"));
                System.Environment.Exit(0);
            }

            return args;
        }
Пример #6
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            //the default values are under the assumption that you run this tool from the directory where Hub.sln sits.

            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
               new ArgumentSpec(
                   "AddInRoot",
                   'd',
                   "output\\binaries\\Pipeline",
                   "directory name",
                   "Root directory for AddIns (i.e., the parent directory of AddIns, under which modules are present)"),
               new ArgumentSpec(
                   "ModuleName",
                   'n',
                   "",
                   "module name",
                   "Name of the module. Leave empty if you want to package all modules"),
             new ArgumentSpec(
                   "RepoDir",
                   'r',
                   "output\\HomeStore\\repository",
                   "directory name",
                   "Top-level directory where we should create the homestore repository"),
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("ModulePackager"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Packages platform binaries\n");
                Console.Error.WriteLine(args.GetUsage("ModulePackager"));
                System.Environment.Exit(0);
            }

            //if (string.IsNullOrWhiteSpace((string)args["AddInRoot"]))
            //{
            //    Console.Error.WriteLine("AddInRoot not supplied\n");
            //    Console.Error.WriteLine(args.GetUsage("ModulePackager"));
            //    System.Environment.Exit(1);
            //}

            //if (string.IsNullOrWhiteSpace((string) args["ModuleName"]))
            //{
            //    Console.Error.WriteLine("Module name not supplied\n");
            //    Console.Error.WriteLine(args.GetUsage("ModulePackager"));
            //    System.Environment.Exit(1);
            //}

            //if (string.IsNullOrWhiteSpace((string)args["RepoDir"]))
            //{
            //    Console.Error.WriteLine("Repository directory name not supplied\n");
            //    Console.Error.WriteLine(args.GetUsage("ModulePackager"));
            //    System.Environment.Exit(1);
            //}

            return args;
        }
Пример #7
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
                new ArgumentSpec(
                    "LogFile",
                    'l',
                    DEFAULT_COMMAND_LINE_ARG_VAL,
                    "file name",
                    "Log file name ('-' for stdout)"),
                new ArgumentSpec(
                    "ConfigDir",
                    'c',
                    DEFAULT_COMMAND_LINE_ARG_VAL,
                    "directory",
                    "Configuration directory"),
                new ArgumentSpec(
                    "RunningMode",
                    'r',
                     DEFAULT_COMMAND_LINE_ARG_VAL,
                    "string",
                    "Running Mode"),
                new ArgumentSpec(
                    "EnforcePolicies",
                    'p',
                    DEFAULT_COMMAND_LINE_ARG_VAL,
                    "true/false",
                    "Turn policy enforcement on/off"),
                new ArgumentSpec(
                    "StayOffline",
                    'o',
                    DEFAULT_COMMAND_LINE_ARG_VAL,
                    "true/false",
                    "Whether we should stay offline")
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("homeos"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Runs HomeOS\n");
                Console.Error.WriteLine(args.GetUsage("homeos"));
                System.Environment.Exit(0);
            }

            //if the supplied config path is relative, make it absolute
            if (!DEFAULT_COMMAND_LINE_ARG_VAL.Equals((string)args["ConfigDir"]))
            {
                string configDir = (string)args["ConfigDir"];

                if (!Directory.Exists(configDir))
                {
                    Console.Error.WriteLine("Configuration directory does not exist: " + configDir);
                    System.Environment.Exit(1);
                }

                args["ConfigDir"] = Path.GetFullPath(configDir);
            }


           // if ((string)args["ConfigDir"] != "\\Config")
         //   {
             //  Settings.SetParameter("ConfigDir", Environment.CurrentDirectory + "\\" + (string)args["ConfigDir"]);
            //}

            //Settings.RunningMode = (string) args["RunningMode"];

            if (Settings.RunningMode.Equals("unittesting"))
            {
                // need to set the global switch here since doing it in Configured Start is too late as Logger
                // settings for unittesting do not get affected correctly
                //Settings.UnitTestingEnabled = true;

                // Current directory is not the output directory when platform is launched from the unit tests,
                // this is needed because we don't want to set the output directory in the unit test project to the
                // global output dir.
                // ....
                // evgeni -- per my email, this should be needed any more -- ratul
                // if true please delete all this code
                // ....
                //Constants.AddInRoot = Environment.CurrentDirectory + "\\..\\..\\..\\output\\binaries\\Pipeline"; 
                //Constants.ScoutRoot = Environment.CurrentDirectory + "\\..\\..\\..\\output\\binaries\\Scouts";
                //Settings.ConfigDir = Environment.CurrentDirectory + "\\..\\..\\..\\output\\Configs\\Config";
                
                //Constants.LocationsFileName = Environment.CurrentDirectory + "\\..\\..\\..\\output\\Configs\\Config\\" + Constants.LocationsFileName;
            }

            //Settings.EnforcePolicies = !(bool)args["NoPolicyEnforcement"];
            
            return args;
        }
Пример #8
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),
               new ArgumentSpec(
                   "SmtpServer",
                   's',
                   "smtp.live.com",
                   "smtp server name",
                   "The name of the smtp server"),
               new ArgumentSpec(
                   "SmtpUser",
                   'u',
                   "*****@*****.**",
                   "smtp user name",
                   "The name of the smtp user"),
               new ArgumentSpec(
                   "SmtpPassword",
                   'p',
                   "home123$",
                   "smtp server name",
                   "password for the smtp server"),
               new ArgumentSpec(
                   "To",
                   't',
                   "*****@*****.**",
                   "whom to send email",
                   "The target of email"),
            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("PlatformPackager"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Packages platform binaries\n");
                Console.Error.WriteLine(args.GetUsage("PlatformPackager"));
                System.Environment.Exit(0);
            }

            if ((string.IsNullOrEmpty((string) args["To"])))
            {
                Console.Error.WriteLine("You must supply a valid to address");
                Console.Error.WriteLine(args.GetUsage("EmailTester"));
                System.Environment.Exit(1);
            }

              return args;
        }
Пример #9
0
        /// <summary>
        /// Processes the command line arguments
        /// </summary>
        /// <param name="arguments"></param>
        /// <returns></returns>
        private static ArgumentsDictionary ProcessArguments(string[] arguments)
        {
            ArgumentSpec[] argSpecs = new ArgumentSpec[]
            {
                    new ArgumentSpec(
                    "Help",
                    '?',
                    false,
                    null,
                    "Display this help message."),

                    new ArgumentSpec(
                   "AccountKey",
                   'k',
                   "",
                   "Azure account key",
                   "Azure account key"),

                    new ArgumentSpec(
                   "AccountKeyFile",
                   '\0',
                   "",
                   "file containing Azure account key",
                   "file containing Azure account key"),

                   new ArgumentSpec(
                   "AccountName",
                   'n',
                   "homelab",
                   "Azure account name",
                   "Azure account name"),

                   new ArgumentSpec(
                   "Container",
                   'c',
                   "configs",
                   "Config storage container name",
                   "Config storage container name"),

                   new ArgumentSpec(
                   "OrgID",
                   'o',
                   "Default",
                   "Organization ID or OrgID",
                   "Organization ID or OrgID"),

                   new ArgumentSpec(
                   "StudyID",
                   's',
                   "Default",
                   "StudyID",
                   "StudyID"),

                   new ArgumentSpec(
                   "HomeIDs",
                   'h',
                   "*",
                   "HomeIDs",
                   "single HomeID or comma-separated multiple HomeIDs"),

                   new ArgumentSpec(
                   "ActualConfigDir",
                   'a',
                   "",
                   "Actual Configs Directory",
                   "Directory for reading or writing actual/current Hub configs"),

                   new ArgumentSpec(
                   "DesiredConfigDir",
                   'd',
                   "",
                   "Desired Configs Directory",
                   "Directory for reading desired Hub configs"),

                    new ArgumentSpec(
                   "Function",
                   'f',
                   "",
                   "function to get performed",
                   "function to get performed"),

            };

            ArgumentsDictionary args = new ArgumentsDictionary(arguments, argSpecs);
            if (args.AppSettingsParseError)
            {
                Console.Error.WriteLine("Error in .config file options: ignoring");
            }

            if (args.CommandLineParseError)
            {
                Console.Error.WriteLine("Error in command line arguments at {0}\n", args.ParseErrorArgument);
                Console.Error.WriteLine(args.GetUsage("ConfigPackager"));
                System.Environment.Exit(1);
            }

            if ((bool)args["Help"])
            {
                Console.Error.WriteLine("Downloads current Hub configs, and uploads desired configs for deployment on hubs\n");
                Console.Error.WriteLine(args.GetUsage("ConfigPackager"));
                System.Environment.Exit(0);
            }

            return args;
        }