Пример #1
0
        public void Run(ParsedCommandWithProperties parsedModelCommand)
        {
            List<FilePreview> filePreviews = new List<FilePreview>();

            ICsFileInfoBuilder modelInterfaceCsFileInfoBuilder = new ModelInterfaceCsFileInfoBuilder(parsedModelCommand, visualStudioIde);
            CsFileInfo modelInterfaceCsFileInfo = CreateCsFileInfo(modelInterfaceCsFileInfoBuilder);
            var modelInterfaceCodeFilePreview = CreateFilePreview(modelInterfaceCsFileInfo, new ModelInterfaceTemplate(modelInterfaceCsFileInfo));

            ICsFileInfoBuilder modelCsFileInfoBuilder = new ModelCsFileInfoBuilder(parsedModelCommand, visualStudioIde, modelInterfaceCsFileInfo);
            CsFileInfo modelCsFileInfo = CreateCsFileInfo(modelCsFileInfoBuilder);
            var modelCodeFilePreview = CreateFilePreview(modelCsFileInfo, new ModelTemplate(modelCsFileInfo));

            ICsFileInfoBuilder modelFactoryInterfaceCsFileInfoBuilder = new ModelFactoryInterfaceCsFileInfoBuilder(parsedModelCommand, visualStudioIde, modelInterfaceCsFileInfo);
            CsFileInfo modelFactoryInterfaceCsFileInfo = CreateCsFileInfo(modelFactoryInterfaceCsFileInfoBuilder);
            var modelFactoryInterfaceCodeFilePreview = CreateFilePreview(modelFactoryInterfaceCsFileInfo, new ModelFactoryInterfaceTemplate(modelFactoryInterfaceCsFileInfo));

            ICsFileInfoBuilder modelFactoryCsFileInfoBuilder = new ModelFactoryCsFileInfoBuilder(parsedModelCommand, visualStudioIde, modelInterfaceCsFileInfo, modelFactoryInterfaceCsFileInfo);
            CsFileInfo modelFactoryCsFileInfo = CreateCsFileInfo(modelFactoryCsFileInfoBuilder);
            var modelFactoryCodeFilePreview = CreateFilePreview(modelFactoryCsFileInfo, new ModelFactoryTemplate(modelFactoryCsFileInfo));

            filePreviews.Add(modelInterfaceCodeFilePreview);
            filePreviews.Add(modelCodeFilePreview);
            filePreviews.Add(modelFactoryInterfaceCodeFilePreview);
            filePreviews.Add(modelFactoryCodeFilePreview);

            foreach (var filePreview in filePreviews)
            {
                visualStudioIde.AddCodeToProject(filePreview.ProjectName, filePreview.FilePath, filePreview.Content);
            }
        }
        public ParsedCommandWithProperties Parse(string command)
        {
            String[] parsedCommand = command.Split(' ');
            ParsedCommandWithProperties parsedModelCommand = new ParsedCommandWithProperties();
            parsedModelCommand.Command = parsedCommand[0];
            parsedModelCommand.ObjectName = parsedCommand[1];

            List<PropertyDetails> propertyDetails = propertyDetailsParser.
                ParsePropertyDetails(parsedCommand.Skip(2).ToArray());
            parsedModelCommand.Properties = propertyDetails;

            return parsedModelCommand;
        }