private static void CmdCallback_HelpScripts(CommandLineHandler.CommandOption cmdOption) { DateTime buildDate = new DateTime(2000, 1, 1); buildDate = buildDate.AddDays(Assembly.GetEntryAssembly().GetName().Version.Build); buildDate = buildDate.AddSeconds(Assembly.GetEntryAssembly().GetName().Version.Revision * 2); Console.WriteLine("TPM_csharp framework tester v.{0} Built on: {1}\n", Assembly.GetCallingAssembly().GetName().Version, buildDate.ToShortDateString()); Console.WriteLine(@" Commands in script files are interpreted line by line (as they are entered on the command line) Lines starting with '#' are interpreted as comments. Commands starting with '@' are special commands and are only available in script execution environment. The following is a list of available special commands and their effects: @exit_on_error [0|1] (Default: 0) Instructs the command interpreter to exit command execution if an error occurs. Keep in mind, if the execution of a special command fails the script execution is always stopped. @exit_on_finish [0|1] (Default: 1) Instructs the command interpreter to exit if all commands in the script file have been processed Set to 0 if you want the script to just initialize an environment @include [filename] Includes the specified file (another script file). Relative paths should start with './' or '.\'. If the specified path is a relative path the base path is the path where the including script file is located. "); Environment.Exit(0); }
private static void CmdCallback_Help(CommandLineHandler.CommandOption cmdOption) { DateTime buildDate = new DateTime(2000, 1, 1); buildDate = buildDate.AddDays(Assembly.GetEntryAssembly().GetName().Version.Build); buildDate = buildDate.AddSeconds(Assembly.GetEntryAssembly().GetName().Version.Revision * 2); Console.WriteLine("TPM_csharp framework tester v.{0} Built on: {1}\n", Assembly.GetCallingAssembly().GetName().Version, buildDate.ToShortDateString()); Console.WriteLine("Start with no arguments and type 'help' for a list of supported commands\n\n"); Console.WriteLine("--script=/path/to/script\tExecutes the commands defined in the scripts as they where entered on the commandline"); Console.WriteLine("Start with --help_scripts for more information on scripting"); Environment.Exit(0); }
public NamedPipeConnection(CommandLineHandler.CommandLineOptions commandLine) { CommandLineHandler.CommandOption pipeNameOption = commandLine.FindCommandOptionByName("PipeName"); if (pipeNameOption == null || pipeNameOption.OptionType != CommandLineHandler.CommandOption.CommandOptionType.Value) { _logger.WarnFormat("No pipe name has been specified, using default '{0}'", _pipeName); } else { _pipeName = pipeNameOption.Arguments[0]; _logger.DebugFormat("Using pipe name '{0}'", _pipeName); } }
public UnixSocketConnection(CommandLineHandler.CommandLineOptions commandLine) { CommandLineHandler.CommandOption socketFileOption = commandLine.FindCommandOptionByName("SocketFile"); if (socketFileOption == null || socketFileOption.OptionType != CommandLineHandler.CommandOption.CommandOptionType.Value) { throw new ArgumentException("No socket file specified!"); } else { _socketFile = socketFileOption.Arguments[0]; _logger.DebugFormat("Using socket file '{0}'", _socketFile); } }
/// <summary> /// Shows the commandline help /// </summary> /// <param name="command"></param> public static void OutputHelp(CommandLineHandler.CommandOption command) { //Strange default .net versioning really makes sense ;-) DateTime buildDate = new DateTime(2000, 1, 1); buildDate = buildDate.AddDays(Assembly.GetEntryAssembly().GetName().Version.Build); buildDate = buildDate.AddSeconds(Assembly.GetEntryAssembly().GetName().Version.Revision * 2); Console.WriteLine("\n\n"); Console.WriteLine("TPM Server v. {0}", Assembly.GetEntryAssembly().GetName().Version); Console.WriteLine("\tBuild on: {0} {1}", buildDate.ToShortDateString(), buildDate.ToLongTimeString()); Console.WriteLine("\n\nSupported command line parameters:"); Console.WriteLine("-help | -h Show this fancy help"); Console.WriteLine("-install-service | -i Invoke Windows/Mono service installer"); Console.WriteLine("-uninstall-service | -u Invoke Windows/Mono service uninstaller"); Environment.Exit(0); }
private static void cmdLine_Console(CommandLineHandler.CommandOption cmdOption) { _consoleMode = true; }