Example #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);
        }
Example #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(
                    "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;
        }
Example #3
0
        public void Init(ArgumentSpec argSpec, Argument arg, CodeList codeList)
        {
            this.arg = arg;

            // Configure dropdown options
            dropdown = GetComponent <TMP_Dropdown>();
            TextMeshProUGUI tm = GetComponentInChildren <TextMeshProUGUI>();

            float maxPreferredWidth = 0;

            if (argSpec.regOnly)
            {
                for (int regNum = 0; regNum < VirtualMachine.NUM_TOTAL_REGS; ++regNum)
                {
                    string regName = "R" + regNum;
                    dropdown.options.Add(new TMP_Dropdown.OptionData(regName));
                    maxPreferredWidth = Mathf.Max(tm.GetPreferredValues(regName).x, maxPreferredWidth);
                }
            }
            else
            {
                foreach (string presetName in argSpec.presets)
                {
                    dropdown.options.Add(new TMP_Dropdown.OptionData(presetName));
                    maxPreferredWidth = Mathf.Max(tm.GetPreferredValues(presetName).x, maxPreferredWidth);
                }
            }

            // Register value change handlers
            Argument.Type argType = argSpec.regOnly ? Argument.Type.REGISTER : Argument.Type.IMMEDIATE;
            dropdown.onValueChanged.AddListener((int val) =>
            {
                if (selfChange.Value)
                {
                    return;
                }
                arg.val          = val;
                selfChange.Value = true;
                arg.BroadcastChange();
                codeList.Program.BroadcastArgumentChange();
            });
            arg.OnChange += HandleArgChange;

            // Init value
            HandleArgChange();

            // Resize to fit the max preferred width
            RectTransform dropdownRT = dropdown.GetComponent <RectTransform>();
            RectTransform labelRT    = tm.GetComponent <RectTransform>();

            dropdownRT.sizeDelta = new Vector2(maxPreferredWidth - labelRT.sizeDelta.x, dropdownRT.sizeDelta.y);
        }
Example #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(
                   "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;
        }
Example #5
0
        public void Init(ArgumentSpec argSpec, Argument arg)
        {
            // Configure dropdown options
            TMP_Dropdown    dropdown = GetComponent <TMP_Dropdown>();
            TextMeshProUGUI tm       = GetComponentInChildren <TextMeshProUGUI>();

            float maxPreferredWidth = 0;

            if (argSpec.regOnly)
            {
                for (int regNum = 0; regNum < VirtualMachine.NUM_REGS; ++regNum)
                {
                    string regName = "R" + regNum;
                    dropdown.options.Add(new TMP_Dropdown.OptionData(regName));
                    maxPreferredWidth = Mathf.Max(tm.GetPreferredValues(regName).x, maxPreferredWidth);
                }
            }
            else
            {
                foreach (string presetName in argSpec.presets)
                {
                    dropdown.options.Add(new TMP_Dropdown.OptionData(presetName));
                    maxPreferredWidth = Mathf.Max(tm.GetPreferredValues(presetName).x, maxPreferredWidth);
                }
            }
            dropdown.value = arg.val;

            // Register value change handler
            Argument.Type argType = argSpec.regOnly ? Argument.Type.REGISTER : Argument.Type.IMMEDIATE;
            dropdown.onValueChanged.AddListener((int val) =>
            {
                arg.val = val;
            });

            // Resize to fit the max preferred width
            RectTransform dropdownRT = dropdown.GetComponent <RectTransform>();
            RectTransform labelRT    = tm.GetComponent <RectTransform>();

            dropdownRT.sizeDelta = new Vector2(maxPreferredWidth - labelRT.sizeDelta.x, dropdownRT.sizeDelta.y);
        }
Example #6
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);
        }
Example #7
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;
        }
Example #8
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;
        }
Example #9
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;
        }
Example #10
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;
        }
Example #11
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;
        }