Пример #1
0
        static void Main(string[] args)
        {
            var resetEvent = new ManualResetEvent(false);
            Action<ManualResetEvent, string> exitMethod = (rest, msg) =>
                                                                    {
                                                                        Console.WriteLine();
                                                                        Console.WriteLine(msg);
                                                                        rest.Set();
                                                                    };
            var runner = new CommandRunner();
            runner.MessagePump.Subscribe(HandleRunnerMessage,
                ex => exitMethod(resetEvent, ex.Message),
                () => exitMethod(resetEvent, ""));

            Initialize(args, runner);
            runner.Run();

            resetEvent.WaitOne(10000);
        }
Пример #2
0
        private static void Initialize(IEnumerable<string> args, CommandRunner runner)
        {
            bool showHelp = false;

            var clArgs = new OptionSet
                            {
                                {
                                    "s|sln=",
                                    "path to target Solution file (.sln) to be analyzed",
                                    v => { runner.slnPath = Path.GetFullPath(v); }
                                },
                                {
                                    "p|proccessIfx:",
                                    "name of the interface used to mark a Process",
                                    x => { runner.processIName = x; }
                                },
                                {
                                    "x|externalNs:",
                                    "namespace for eXternal-facing component (used to aid discovery of command/event initiators and sequences"
                                    ,
                                    x => { runner.externalNs = x; }
                                },
                                {
                                     "?|h|help",
                                     "this message",
                                     v => showHelp = (v != null)
                                },
                                {
                                    "t|processType:",
                                    "name of a concrete class implementing a process",
                                    x => runner.processTypeName = x
                                },
                                {
                                    "v|verbose",
                                    "Output more detail during execution",
                                    v => runner.Verbose = (v != null)
                                },
                                {
                                    "<>",
                                    "List of assembly names to exclude from discovery and analysis.",
                                    v => runner.ExcludedAssemblies.AddRange(v.Split(' '))
                                },

            };

            try
            {
                var otherArgs = clArgs.Parse(args);
                runner.ValidateData();
            }
            catch (Exception ex)
            {
                Console.WriteLine("MilGenerator ");
                Console.WriteLine(ex.Message);
                PrintHelp(clArgs);
                Exit();
            }

            if (showHelp)
            {
                PrintHelp(clArgs);
                Exit();
            }
        }
Пример #3
0
        private static void Initialize(IEnumerable <string> args, CommandRunner runner)
        {
            bool showHelp = false;

            var clArgs = new OptionSet
            {
                {
                    "s|sln=",
                    "path to target Solution file (.sln) to be analyzed",
                    v => { runner.slnPath = Path.GetFullPath(v); }
                },
                {
                    "p|proccessIfx:",
                    "name of the interface used to mark a Process",
                    x => { runner.processIName = x; }
                },
                {
                    "x|externalNs:",
                    "namespace for eXternal-facing component (used to aid discovery of command/event initiators and sequences"
                    ,
                    x => { runner.externalNs = x; }
                },
                {
                    "?|h|help",
                    "this message",
                    v => showHelp = (v != null)
                },
                {
                    "t|processType:",
                    "name of a concrete class implementing a process",
                    x => runner.processTypeName = x
                },
                {
                    "v|verbose",
                    "Output more detail during execution",
                    v => runner.Verbose = (v != null)
                },
                {
                    "<>",
                    "List of assembly names to exclude from discovery and analysis.",
                    v => runner.ExcludedAssemblies.AddRange(v.Split(' '))
                },
            };

            try
            {
                var otherArgs = clArgs.Parse(args);
                runner.ValidateData();
            }
            catch (Exception ex)
            {
                Console.WriteLine("MilGenerator ");
                Console.WriteLine(ex.Message);
                PrintHelp(clArgs);
                Exit();
            }

            if (showHelp)
            {
                PrintHelp(clArgs);
                Exit();
            }
        }