Example #1
0
        static void Main(string[] args)
        {
            if (Installation.GetFileLayoutType() == FileLayoutType.Source)
            {
                Console.WriteLine("DevTool only works from a source tree");
                Environment.Exit(1);
            }

            var tools = new IDevTool[] {
                new InterfaceCheck(),
                new DocGen.DocDevTool(),
                new WixFSGenerator()
            };

            string line = "help";
            do
            {
                switch (line)
                {
                    case "help":
                    case "h":
                        Console.WriteLine("exit: Quit");
                        Console.WriteLine("help: Print this help");
                        int i = 0;
                        foreach (var tool in tools)
                        {
                            Console.WriteLine("{0}: {1}", i++, tool.Name);
                        }
                        break;

                    case "exit":
                    case "quit":
                    case "e":
                    case "q":
                        return;

                    default:
                        try
                        {
                            IDevTool tool = tools.ElementAt(Int32.Parse(line));
                            tool.OutputStream = (TextWriter)Console.Out;
                            tool.InputStream = (TextReader)Console.In;
                            tool.Run();
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            Console.WriteLine("Tool {0} not found", Int32.Parse(line));
                        }
                        catch (FormatException)
                        {
                            Console.WriteLine("Invalid command");
                        }
                        break;
                }

                Console.WriteLine("");
                Console.Write("DevTool> ");
                line = Console.ReadLine().Trim();
            } while (line != "q" && line != "quit");
        }
Example #2
0
        private static void OperateInteractive()
        {
            // list our tools
            var tools = ListTools();

            string line = "help";

            do
            {
                switch (line)
                {
                case "help":
                case "h":
                    Console.WriteLine("exit: Quit");
                    Console.WriteLine("help: Print this help");
                    int i = 0;
                    foreach (var tool in tools)
                    {
                        Console.WriteLine("{0}: {1}", i++, tool.Name);
                    }
                    break;

                case "exit":
                case "quit":
                case "e":
                case "q":
                    return;

                default:
                    try
                    {
                        IDevTool tool = tools.ElementAt(Int32.Parse(line));
                        tool.OutputStream = (TextWriter)Console.Out;
                        if (tool is IQuestioningDevTool)
                        {
                            (tool as IQuestioningDevTool).Answers = new Dictionary <string, string>();
                            foreach (var question in (tool as IQuestioningDevTool).Questions)
                            {
                                Console.Write(question.Text);
                                (tool as IQuestioningDevTool).Answers[question.Name] = Console.ReadLine();
                            }
                        }
                        tool.Run();
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        Console.WriteLine("Tool {0} not found", Int32.Parse(line));
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("Invalid command");
                    }
                    break;
                }

                Console.WriteLine("");
                Console.Write("DevTool> ");
                line = Console.ReadLine().Trim();
            } while (line != "q" && line != "quit");
        }
Example #3
0
        static void Main(string[] args)
        {
            if (Installation.GetFileLayoutType() == FileLayoutType.Source)
            {
                Console.WriteLine("DevTool only works from a source tree");
                Environment.Exit(1);
            }

            var tools = new IDevTool[] {
                new InterfaceCheck(),
                new DocGen.DocDevTool(),
                new WixFSGenerator()
            };

            string line = "help";

            do
            {
                switch (line)
                {
                case "help":
                case "h":
                    Console.WriteLine("exit: Quit");
                    Console.WriteLine("help: Print this help");
                    int i = 0;
                    foreach (var tool in tools)
                    {
                        Console.WriteLine("{0}: {1}", i++, tool.Name);
                    }
                    break;

                case "exit":
                case "quit":
                case "e":
                case "q":
                    return;

                default:
                    try
                    {
                        IDevTool tool = tools.ElementAt(Int32.Parse(line));
                        tool.OutputStream = (TextWriter)Console.Out;
                        tool.InputStream  = (TextReader)Console.In;
                        tool.Run();
                    }
                    catch (ArgumentOutOfRangeException)
                    {
                        Console.WriteLine("Tool {0} not found", Int32.Parse(line));
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("Invalid command");
                    }
                    break;
                }

                Console.WriteLine("");
                Console.Write("DevTool> ");
                line = Console.ReadLine().Trim();
            } while (line != "q" && line != "quit");
        }
Example #4
0
        static void Main(string[] args)
        {
            // init
            if (Installation.GetFileLayoutType() != FileLayoutType.Source)
            {
                Console.WriteLine("DevTool only works from a source tree");
                Environment.Exit(1);
            }

            // command line operating modes
            if (args.Length == 3 && args[0] == "/WebMPInstallerRebuild")
            {
                var gen = new WixFSGenerator();
                gen.OutputStream = (TextWriter)Console.Out;
                gen.RunFromInput(args[1], args[2], "WWW");
                Environment.Exit(0);
            }

            // CLI
            string line = "help";
            var tools = new IDevTool[] {
                new InterfaceCheck(),
                new DocGen.DocDevTool(),
                new WixFSGenerator(),
                new MyGengoImporter(),
                new InstallLayoutExporter()
            };
            do
            {
                switch (line)
                {
                    case "help":
                    case "h":
                        Console.WriteLine("exit: Quit");
                        Console.WriteLine("help: Print this help");
                        int i = 0;
                        foreach (var tool in tools)
                        {
                            Console.WriteLine("{0}: {1}", i++, tool.Name);
                        }
                        break;

                    case "exit":
                    case "quit":
                    case "e":
                    case "q":
                        return;

                    default:
                        try
                        {
                            IDevTool tool = tools.ElementAt(Int32.Parse(line));
                            tool.OutputStream = (TextWriter)Console.Out;
                            tool.InputStream = (TextReader)Console.In;
                            tool.Run();
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                            Console.WriteLine("Tool {0} not found", Int32.Parse(line));
                        }
                        catch (FormatException)
                        {
                            Console.WriteLine("Invalid command");
                        }
                        break;
                }

                Console.WriteLine("");
                Console.Write("DevTool> ");
                line = Console.ReadLine().Trim();
            } while (line != "q" && line != "quit");
        }