Пример #1
0
        public void GenerateProjectTemplatesAndCommandsHandler(ToolCommandInfo commandInfo)
        {
            if (commandInfo.Arguments == null || commandInfo.Arguments.Length < 3)
            {
                throw new Exception("Error executing command. Too few arguments.");
            }

            string sourceDirectory      = commandInfo.Arguments[0];
            string destinationDirectory = commandInfo.Arguments[1];

            List <string> cultures;

            cultures = commandInfo.Arguments[2].ToUpperInvariant() == "ALL"
                     ? new List <string> {
                "cs-CZ", "de-DE", "es-ES", "fr-FR", "it-IT", "ja-JP", "ko-KR", "pl-PL", "pt-BR", "ru-RU", "tr-TR", "zh-CN", "zh-TW"
            }
                     : new List <string>(commandInfo.Arguments[2].Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries));

            var csProjectTemplateGenerator = new CSharpProjectTemplateGenerator(sourceDirectory, destinationDirectory);

            csProjectTemplateGenerator.GenerateProjectTemplates(cultures);

            var vbProjectTemplateGenerator = new VisualBasicProjectTemplateGenerator(sourceDirectory, destinationDirectory);

            vbProjectTemplateGenerator.GenerateProjectTemplates(cultures);

            var rightClickCommandGenerator = new RightClickCommandGenerator(sourceDirectory, destinationDirectory);

            rightClickCommandGenerator.GenerateRightClickCommands(cultures);
        }
        public void GenerateProjectTemplatesAndCommandsHandler(GenerationOptions options)
        {
            if (CanOverwriteDirectory(options.DestinationDirectory))
            {
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();

                Console.WriteLine("\nGenerate C# project templates.");
                var csProjectTemplateGenerator = new CSharpProjectTemplateGenerator(options.SourceDirectory, options.DestinationDirectory);
                csProjectTemplateGenerator.GenerateProjectTemplates(cultures);

                Console.WriteLine("\nGenerate VB project templates.");
                var vbProjectTemplateGenerator = new VisualBasicProjectTemplateGenerator(options.SourceDirectory, options.DestinationDirectory);
                vbProjectTemplateGenerator.GenerateProjectTemplates(cultures);

                Console.WriteLine("\nGenerate right click commands.");
                var rightClickCommandGenerator = new RightClickCommandGenerator(options.SourceDirectory, options.DestinationDirectory);
                rightClickCommandGenerator.GenerateRightClickCommands(cultures);

                Console.WriteLine("End");
                stopwatch.Stop();
                TimeSpan ts = stopwatch.Elapsed;
                Console.WriteLine(string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10));
            }
        }
        public void GenerateProjectTemplatesAndCommandsHandler(ToolCommandInfo commandInfo)
        {
            if (commandInfo.Arguments == null || commandInfo.Arguments.Length < 3)
            {
                throw new Exception("Error executing command. Too few arguments.");
            }
            string                   sourceDirectory          = commandInfo.Arguments[0];
            string                   destinationDirectory     = commandInfo.Arguments[1];
            List <string>            cultures                 = new List <string>(commandInfo.Arguments[2].Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries));
            ProjectTemplateGenerator projectTemplateGenerator = new ProjectTemplateGenerator(sourceDirectory, destinationDirectory);

            projectTemplateGenerator.GenerateProjectTemplates(cultures);
            RightClickCommandGenerator rightClickCommandGenerator = new RightClickCommandGenerator(sourceDirectory, destinationDirectory);

            rightClickCommandGenerator.GenerateRightClickCommands(cultures);
        }