/// <summary>Generates a C# file from a T4 file.</summary>
        /// <param name="modificationInfo">The modifications that occurred in the T4 file.</param>
        public override ISecondaryDocumentGenerationResult Generate(PrimaryFileModificationInfo modificationInfo)
        {
            if (!(modificationInfo.NewPsiFile is IT4File t4File))
            {
                return(null);
            }

            var generator           = new T4CSharpCodeGenerator(t4File, _directiveInfoManager);
            GenerationResult result = generator.Generate();

            LanguageService csharpLanguageService = CSharpLanguage.Instance.LanguageService();

            if (csharpLanguageService == null)
            {
                return(null);
            }

            var includedFiles = new OneToSetMap <FileSystemPath, FileSystemPath>();

            includedFiles.AddRange(modificationInfo.SourceFile.GetLocation(), t4File.GetNonEmptyIncludePaths());

            ISolution solution = modificationInfo.SourceFile.GetSolution();
            var       t4FileDependencyManager = solution.GetComponent <T4FileDependencyManager>();

            return(new T4SecondaryDocumentGenerationResult(
                       modificationInfo.SourceFile,
                       result.Builder.ToString(),
                       csharpLanguageService.LanguageType,
                       new RangeTranslatorWithGeneratedRangeMap(result.GeneratedRangeMap),
                       csharpLanguageService.GetPrimaryLexerFactory(),
                       t4FileDependencyManager,
                       t4File.GetNonEmptyIncludePaths()
                       ));
        }
		/// <summary>
		/// Generates a C# file from a T4 file.
		/// </summary>
		/// <param name="modificationInfo">The modifications that occurred in the T4 file.</param>
		public override ISecondaryDocumentGenerationResult Generate(PrimaryFileModificationInfo modificationInfo) {
			var t4File = modificationInfo.NewPsiFile as IT4File;
			if (t4File == null)
				return null;
			 
			var generator = new T4CSharpCodeGenerator(t4File, _directiveInfoManager);
			GenerationResult result = generator.Generate();

			LanguageService csharpLanguageService = CSharpLanguage.Instance.LanguageService();
			if (csharpLanguageService == null)
				return null;

			var includedFiles = new OneToSetMap<FileSystemPath, FileSystemPath>();
			includedFiles.AddRange(modificationInfo.SourceFile.GetLocation(), t4File.GetNonEmptyIncludePaths());

			ISolution solution = modificationInfo.SourceFile.GetSolution();
			var t4FileDependencyManager = solution.GetComponent<T4FileDependencyManager>();

			return new T4SecondaryDocumentGenerationResult(
				modificationInfo.SourceFile,
				result.Builder.ToString(),
				csharpLanguageService.LanguageType,
				new RangeTranslatorWithGeneratedRangeMap(result.GeneratedRangeMap),
				csharpLanguageService.GetPrimaryLexerFactory(),
				t4FileDependencyManager,
				t4File.GetNonEmptyIncludePaths());
		}