コード例 #1
0
ファイル: Main.cs プロジェクト: deveck/doTSS
        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);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: deveck/doTSS
        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);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            //Console.ReadLine(); //To hook up debugger after running from command line

            CommandLineHandler handler = new CommandLineHandler();

            IDivLogger logger = GetLogger(args);

            handler.HandleRequest(args, new ConsoleLogger());
        }
コード例 #4
0
ファイル: Issue_0460.cs プロジェクト: ywscr/TabularEditor
        public void Test()
        {
            string msg = @"Deployment failed! The JSON DDL request failed with the following error: The 'Name' property cannot contain any of the following characters: . , ; ' ` : / \ * | ? "" & % $ !+ = ( )[ ] { } < >.

Technical Details:
RootActivityId: 08de469b - 3d73 - 4313 - 89ac - f014f1bd84be
Date(UTC): 5 / 2 / 2020 8:21:06 PM";

            var clHandler = new CommandLineHandler();

            clHandler.Error(msg);
            clHandler.Error(msg, new object[] { });
        }
コード例 #5
0
ファイル: Main.cs プロジェクト: deveck/doTSS
        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);
        }
コード例 #6
0
    public static void Update()
    {
        CommandLineHandler.ApplicationName = Application.productName;

        lock (CommandLineHandler.m_MainThreadCommandLines)
        {
            while (CommandLineHandler.m_MainThreadCommandLines.Count > 0)
            {
                CommandLineData commandLine = CommandLineHandler.m_MainThreadCommandLines.Dequeue();
                CommandLineHandler.CallMethod(commandLine);
            }
        }
    }
コード例 #7
0
        public static void Main(string[] args)
        {
            var provider = new CsvCameraProvider("data/cameras-defb.csv");
            CommandLineHandler handler = new CommandLineHandler(provider);

            if (handler.IsCommand(args))
            {
                handler.HandleCommand(args);
            }
            else
            {
                CreateWebHostBuilder(args).Build().Run();
            }
        }
コード例 #8
0
ファイル: TPMServer.cs プロジェクト: deveck/doTSS
        /// <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);
        }
コード例 #9
0
ファイル: TPMServer.cs プロジェクト: deveck/doTSS
        /// <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);
        }
コード例 #10
0
        /// <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);
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: deveck/Deveck.TAM
		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);
			}
		}
コード例 #12
0
ファイル: Program.cs プロジェクト: goupviet/Deveck.TAM
        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);
            }
        }
コード例 #13
0
ファイル: Main.cs プロジェクト: areiter/InMemoryFuzzing
        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);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: lvyitian/UnityDissector
        public static void Main(string[] args)
        {
            CommandLineHandler = new CommandLineHandler()
            {
                Description = "Program that extracts compressed files from .unity3d format.",
                Options     = new List <Option>(new Option[]
                {
                    new Option("-help",
                               "Prints information on how to use this thing and exits.",
                               OptionHandlers.HandleHelpOption,
                               "h"),
                    new Option("-extract",
                               "Extracts the files inside of the specified .unity3d file and exits.",
                               OptionHandlers.HandleExtractOption,
                               "ex"),
                    new Option("-list",
                               "Prints all files inside of the specified .unity3d file and exits.",
                               OptionHandlers.HandleListOption,
                               "l")
                })
            };

            CommandLineHandler.HandleArguments(args);
        }
コード例 #15
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);
            }
        }
コード例 #16
0
ファイル: Main.cs プロジェクト: areiter/InMemoryFuzzing
        private static void OutputHelp(CommandLineHandler.CommandOption cmdOption)
        {
            Console.WriteLine ("Use {--fuzz|--analyze} --xmlinput=[path to input file]");
            Console.WriteLine ();

            Environment.Exit (0);
        }
コード例 #17
0
        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);
            }
        }
コード例 #18
0
ファイル: Main.cs プロジェクト: areiter/InMemoryFuzzing
 private static void ParseXmlInput(CommandLineHandler.CommandOption cmdOption)
 {
     if (cmdOption.Arguments.Length == 0)
         OutputHelp (null);
     else
     {
         if(_programMode == null)
         {
             Console.WriteLine("Missing program mode (fuzz|analyze). Program mode always needs to be the first argument\n\n");
             OutputHelp(null);
         }
         else if(_programMode.Value == MainClass.ProgramMode.Fuzz)
         {
             Console.WriteLine ("Using XmlFuzzFactory, parsing '{0}'", cmdOption.Arguments[0]);
             XmlFuzzFactory factory = new XmlFuzzFactory (cmdOption.Arguments[0]);
             factory.Init ();
             _fuzzControllers = factory.CreateFuzzController ();
         }
         else if(_programMode.Value == MainClass.ProgramMode.Analyze)
         {
             Console.WriteLine("Using XmlAnalyzeFactory, parsing '{0}'", cmdOption.Arguments[0]);
             XmlAnalyzeFactory factory = new XmlAnalyzeFactory(cmdOption.Arguments[0]);
             factory.Init();
             _analyzeController = factory.CreateAnalyzeController();
         }
         else
             throw new NotImplementedException(string.Format("The specified program mode '{0}' it not implemented yet", _programMode.Value));
     }
 }
コード例 #19
0
ファイル: Program.cs プロジェクト: deveck/Deveck.TAM
		private static void cmdLine_Console(CommandLineHandler.CommandOption cmdOption)
		{
			_consoleMode = true;
		}
コード例 #20
0
 bool ExecuteCommand(string command)
 {
     return(CommandLineHandler.CallCommandLine(command));
 }
コード例 #21
0
 static CommandLineEditorDispatcher()
 {
     CommandLineHandler.Initialize();
     EditorApplication.update += Update;
 }
コード例 #22
0
ファイル: Main.cs プロジェクト: areiter/InMemoryFuzzing
 private static void SetFuzzingMode(CommandLineHandler.CommandOption cmdOption)
 {
     _programMode = ProgramMode.Fuzz;
 }
コード例 #23
0
ファイル: Option.cs プロジェクト: necatituran/UnityDissector
 public void Handle(CommandLineHandler handler, string file)
 {
     Handler(handler, file);
 }
コード例 #24
0
ファイル: Main.cs プロジェクト: areiter/InMemoryFuzzing
 private static void SetAnalyzationMode(CommandLineHandler.CommandOption cmdOption)
 {
     _programMode = ProgramMode.Analyze;
 }