private int HanldeGridOption(GridOptions gridOptions) { SetVerboseLevel(gridOptions.VerboseLevel); Reporter.ToLog(eLogLevel.INFO, "Starting Ginger Grid at port: " + gridOptions.Port); GingerGrid gingerGrid = new GingerGrid(gridOptions.Port); gingerGrid.Start(); if (gridOptions.Tracker) { ServiceGridTracker serviceGridTracker = new ServiceGridTracker(gingerGrid); } Console.WriteLine(); Console.WriteLine("---------------------------------------------------"); Console.WriteLine("- Press 'q' exit -"); Console.WriteLine("---------------------------------------------------"); if (!Console.IsInputRedirected && !WorkSpace.Instance.RunningFromUnitTest) // for example unit test redirect input, or we can run without input like from Jenkins { ConsoleKey consoleKey = ConsoleKey.A; while (consoleKey != ConsoleKey.Q) { ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(); consoleKey = consoleKeyInfo.Key; } } return(0); }
void NodeList() { Console.WriteLine("Ginger Grid Hub List"); serviceGridTracker = new ServiceGridTracker(WorkSpace.Instance.LocalGingerGrid); // Wait for user to press any key Console.WriteLine("List will refresh automatically when list changed, Press any key to exit"); while (!Console.KeyAvailable) { Thread.Sleep(500); } Console.Read(); }
private void HandleArg(string param, string value) { // TODO: get all classes impl ICLI and check Identifier then set switch (param) { case "--version": Console.WriteLine(string.Format("{0} Version: {1}", ApplicationInfo.ApplicationName, ApplicationInfo.ApplicationVersionWithInfo)); break; case "--help": case "-h": ShowCLIHelp(); break; case "ConfigFile": case "--configfile": mCLIHelper.CLIType = eCLIType.Config; Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with ConfigFile= '{0}'", value)); mCLIHandler = new CLIConfigFile(); PerformLoadAndExecution(ReadFile(value)); break; case "Script": case "--scriptfile": mCLIHelper.CLIType = eCLIType.Script; Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with ScriptFile= '{0}'", value)); mCLIHandler = new CLIScriptFile(); PerformLoadAndExecution(ReadFile(value)); break; case "--dynamicfile": case "Dynamic": mCLIHelper.CLIType = eCLIType.Dynamic; Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with DynamicXML= '{0}'", value)); mCLIHandler = new CLIDynamicXML(); PerformLoadAndExecution(ReadFile(value)); break; case "--args": mCLIHelper.CLIType = eCLIType.Arguments; Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with Command Args= '{0}'", value)); mCLIHandler = new CLIArgs(); PerformLoadAndExecution(value); break; case "--excel": Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with CLI Excel= '{0}'", value)); mCLIHandler = new CLIExcel(); PerformLoadAndExecution(value); break; case "--servicegrid": int port = 15555; Console.WriteLine("Starting Ginger Grid at port: " + port); GingerGrid gingerGrid = new GingerGrid(15555); // TODO: get port from CLI arg gingerGrid.Start(); ServiceGridTracker serviceGridTracker = new ServiceGridTracker(gingerGrid); Console.ReadKey(); break; } }