public static void Main(string[] args) { log4net.Appender.DebugAppender appender = new log4net.Appender.DebugAppender (); appender.Name = "DebugAppender"; appender.Layout = new log4net.Layout.PatternLayout ("[%date{dd.MM.yyyy HH:mm:ss,fff}]-%-5level-[%c]: %message%newline"); log4net.Config.BasicConfigurator.Configure (appender); CommandLineHandler cmdlHandler = new CommandLineHandler (); cmdlHandler.RegisterCallback ("help", CmdCallback_Help); cmdlHandler.RegisterCallback ("help_scripts", CmdCallback_HelpScripts); string scriptFile = null; cmdlHandler.RegisterCallback ("script", delegate(CommandLineHandler.CommandOption cmdOption) { if (cmdOption.Arguments != null && cmdOption.Arguments.Length > 0) scriptFile = cmdOption.Arguments[0]; }); cmdlHandler.Parse (args); if (scriptFile == null) new TPMConsole ().Run (); else new TPMConsole().RunScriptFile(scriptFile); }
public static void Main(string[] args) { log4net.Appender.DebugAppender appender = new log4net.Appender.DebugAppender(); appender.Name = "DebugAppender"; appender.Layout = new log4net.Layout.PatternLayout("[%date{dd.MM.yyyy HH:mm:ss,fff}]-%-5level-[%c]: %message%newline"); log4net.Config.BasicConfigurator.Configure(appender); CommandLineHandler cmdlHandler = new CommandLineHandler(); cmdlHandler.RegisterCallback("help", CmdCallback_Help); cmdlHandler.RegisterCallback("help_scripts", CmdCallback_HelpScripts); string scriptFile = null; cmdlHandler.RegisterCallback("script", delegate(CommandLineHandler.CommandOption cmdOption) { if (cmdOption.Arguments != null && cmdOption.Arguments.Length > 0) { scriptFile = cmdOption.Arguments[0]; } }); cmdlHandler.Parse(args); if (scriptFile == null) { new TPMConsole().Run(); } else { new TPMConsole().RunScriptFile(scriptFile); } }
/// <summary> /// Console entrypoint /// </summary> /// <param name="args">Command line arguments. you can override the default config file by supplying "--config=/path/to/configfile.conf"</param> public static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += HandleAppDomainCurrentDomainUnhandledException; CommandLineHandler commandLineHandler = new CommandLineHandler(); commandLineHandler.RegisterCallback("help", OutputHelp); commandLineHandler.RegisterCallback("h", OutputHelp); commandLineHandler.Parse(args); TPMServerContext ctx = new TPMServerContext(); ctx.Start(); Thread.Sleep(Timeout.Infinite); }
public static void Main(string[] args) { Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _log = LogManager.GetCurrentClassLogger(); CommandLineHandler cmdLine = new CommandLineHandler(); cmdLine.RegisterCallback("console",new Action<CommandLineHandler.CommandOption>(cmdLine_Console)); cmdLine.Parse(args); if(_consoleMode) { Initialize(); Thread.Sleep(Timeout.Infinite); } else { System.ServiceProcess.ServiceBase[] services_to_run = new ServiceBase[] { new Program() }; System.ServiceProcess.ServiceBase.Run(services_to_run); } }
public static void Main(string[] args) { Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _log = LogManager.GetCurrentClassLogger(); CommandLineHandler cmdLine = new CommandLineHandler(); cmdLine.RegisterCallback("console", new Action <CommandLineHandler.CommandOption>(cmdLine_Console)); cmdLine.Parse(args); if (_consoleMode) { Initialize(); Thread.Sleep(Timeout.Infinite); } else { System.ServiceProcess.ServiceBase[] services_to_run = new ServiceBase[] { new Program() }; System.ServiceProcess.ServiceBase.Run(services_to_run); } }
public static void Main(string[] args) { SetupLogging (); if (args == null || args.Length == 0) OutputHelp (null); else { CommandLineHandler cmdLineHandler = new CommandLineHandler (); cmdLineHandler.RegisterCallback ("fuzz", SetFuzzingMode ); cmdLineHandler.RegisterCallback ("analyze", SetAnalyzationMode ); cmdLineHandler.RegisterCallback ("xmlinput", ParseXmlInput); cmdLineHandler.RegisterCallback ("help", OutputHelp); cmdLineHandler.Parse (args); } if(_programMode == null) { OutputHelp(null); return; } if (_programMode.Value == MainClass.ProgramMode.Fuzz && _fuzzControllers != null) { foreach (FuzzController fc in _fuzzControllers) fc.Fuzz (); } else if(_programMode.Value == MainClass.ProgramMode.Analyze && _analyzeController != null) _analyzeController.Analyze(); else { Console.WriteLine("Could not find a configuration \n\n"); OutputHelp(null); } }
/// <summary> /// Parses the args with the command line handler. /// </summary> /// <param name="args"></param> public virtual void ParseArgs(string[] args) { CLH.Parse(args); this.FinishParse( ); }