Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //args = new string[] { "CompareSolutions", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Lors du Branch).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Branche WinFixFrs).sln" };
            //args = new string[] { "MergeSolutions", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Lors du Branch).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Branche WinFixFrs).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Main).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\Results.sln" };
            //args = new string[] { "CreateFilterFileFromSolution", @"C:\DevCodePlex\SLNTools\Main\SLNTools.sln" };
            //args = new string[] { "OpenFilterFile", @"C:\DevCodePlex\SLNTools\Main\Test.slnfilter" };
            //args = new string[] { "/?" };
            //args = new string[] { "CreateFilterFileFromSolution", @"E:\SLNTools\SLNTools\Main\SLNTools.sln" };
            //args = new string[] { "MergeSolutions" };

            try
            {
                string[] commandName;
                string[] commandArguments;
                if (args.Length > 1)
                {
                    commandName = new string[1];
                    Array.ConstrainedCopy(args, 0, commandName, 0, 1);
                    commandArguments = new string[args.Length - 1];
                    Array.ConstrainedCopy(args, 1, commandArguments, 0, commandArguments.Length);
                }
                else
                {
                    commandName      = args;
                    commandArguments = new string[0];
                }

                var parsedArguments = new Arguments();

                var reporter = new MessageBoxErrorReporter
                {
                    CommandUsage = Parser.ArgumentsUsage(parsedArguments.GetType())
                };

                if (Parser.ParseArguments(commandName, parsedArguments, reporter.Handler))
                {
                    Command command;
                    switch (parsedArguments.Command)
                    {
                    case CommandList.CompareSolutions:
                        command = new CompareSolutionsCommand();
                        break;

                    case CommandList.MergeSolutions:
                        command = new MergeSolutionsCommand();
                        break;

                    case CommandList.CreateFilterFileFromSolution:
                        command = new CreateFilterFileFromSolutionCommand();
                        break;

                    case CommandList.OpenFilterFile:
                        command = new OpenFilterFileCommand();
                        break;

                    case CommandList.EditFilterFile:
                        command = new EditFilterFileCommand();
                        break;

                    case CommandList.CreateSolutionFromFilterFile:
                        command = new CreateSolutionFromFilterFileCommand();
                        break;

                    default:
                        command = null;
                        reporter.Handler("Invalid command name.");
                        break;
                    }

                    if (command != null)
                    {
                        reporter.CommandName = parsedArguments.Command.ToString();
                        command.Run(commandArguments, reporter);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //args = new string[] { "CompareSolutions", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Lors du Branch).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Branche WinFixFrs).sln" };
            //args = new string[] { "MergeSolutions", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Lors du Branch).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Branche WinFixFrs).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\All Projects (Latest Main).sln", @"C:\Dev\VSSolutionMerger.root\VSSolutionMerger\SLNTools.exe\Results.sln" };
            //args = new string[] { "CreateFilterFileFromSolution", @"C:\DevCodePlex\SLNTools\Main\SLNTools.sln" };
            //args = new string[] { "OpenFilterFile", @"C:\DevCodePlex\SLNTools\Main\Test.slnfilter" };
            //args = new string[] { "/?" };
            //args = new string[] { "CreateFilterFileFromSolution", @"E:\SLNTools\SLNTools\Main\SLNTools.sln" };
            //args = new string[] { "MergeSolutions" };

            try
            {
                string[] commandName;
                string[] commandArguments;
                if (args.Length > 1)
                {
                    commandName = new string[1];
                    Array.ConstrainedCopy(args, 0, commandName, 0, 1);
                    commandArguments = new string[args.Length - 1];
                    Array.ConstrainedCopy(args, 1, commandArguments, 0, commandArguments.Length);
                }
                else
                {
                    commandName = args;
                    commandArguments = new string[0];
                }

                var parsedArguments = new Arguments();

                var reporter = new MessageBoxErrorReporter
                            {
                                CommandUsage = Parser.ArgumentsUsage(parsedArguments.GetType())
                            };

                if (Parser.ParseArguments(commandName, parsedArguments, reporter.Handler))
                {
                    Command command;
                    switch (parsedArguments.Command)
                    {
                        case CommandList.CompareSolutions:
                            command = new CompareSolutionsCommand();
                            break;

                        case CommandList.MergeSolutions:
                            command = new MergeSolutionsCommand();
                            break;

                        case CommandList.CreateFilterFileFromSolution:
                            command = new CreateFilterFileFromSolutionCommand();
                            break;

                        case CommandList.OpenFilterFile:
                            command = new OpenFilterFileCommand();
                            break;

                        case CommandList.EditFilterFile:
                            command = new EditFilterFileCommand();
                            break;

                        default:
                            command = null;
                            reporter.Handler("Invalid command name.");
                            break;
                    }

                    if (command != null)
                    {
                        reporter.CommandName = parsedArguments.Command.ToString();
                        command.Run(commandArguments, reporter);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }