コード例 #1
0
        /// <summary>
        /// Adds the text templates.
        /// </summary>
        /// <param name="statusBarMessage">The status bar message.</param>
        /// <param name="textTemplates">The text templates.</param>
        public IEnumerable <string> AddTextTemplates(
            string statusBarMessage,
            IEnumerable <TextTemplateInfo> textTemplates)
        {
            TraceService.WriteLine("TextTemplatingService::AddTextTemplates");

            this.Messages = new List <string>();

            this.visualStudioService.WriteStatusBarMessage(statusBarMessage);

            foreach (TextTemplateInfo textTemplateInfo in textTemplates)
            {
                TraceService.WriteLine("TextTemplatingService::AddTextTemplates textTemplate=" + textTemplateInfo.FileName);

                IProjectService projectService = this.visualStudioService.GetProjectServiceBySuffix(textTemplateInfo.ProjectSuffix);

                if (projectService != null)
                {
                    this.visualStudioService.WriteStatusBarMessage(statusBarMessage + "for " + projectService.Name);

                    ITextTransformationService textTransformationService = this.visualStudioService.GetTextTransformationService();

                    TextTransformationRequest textTransformationRequest = new TextTransformationRequest
                    {
                        SourceFile        = textTemplateInfo.TemplateName,
                        Parameters        = textTemplateInfo.Tokens,
                        RemoveFileHeaders = this.SettingsService.RemoveDefaultFileHeaders,
                        RemoveXmlComments = this.SettingsService.RemoveDefaultComments,
                        RemoveThisPointer = this.SettingsService.RemoveThisPointer
                    };

                    textTemplateInfo.TextOutput = textTransformationService.Transform(textTransformationRequest).Output;

                    string message = projectService.AddTextTemplate(textTemplateInfo, this.SettingsService.OutputTextTemplateContentToTraceFile);

                    this.Messages.Add(message);
                }
            }

            return(this.Messages);
        }
コード例 #2
0
 /// <summary>
 ///     Gets the text transformation service.
 /// </summary>
 /// <returns>The Text Transformation Service.</returns>
 protected ITextTransformationService GetTextTransformationService()
 {
     return this.textTransformationService ?? (this.textTransformationService = new TextTransformationService());
 }
コード例 #3
0
 /// <summary>
 ///     Gets the text transformation service.
 /// </summary>
 /// <returns>The Text Transformation Service.</returns>
 protected ITextTransformationService GetTextTransformationService()
 {
     return(this.textTransformationService ?? (this.textTransformationService = new TextTransformationService()));
 }