public DocumentViewerContent CreateContent(IDocumentViewer documentViewer, IContentType contentType)
        {
            if (documentViewerOutput is null)
            {
                throw new InvalidOperationException();
            }
            if (documentViewer is null)
            {
                throw new ArgumentNullException(nameof(documentViewer));
            }
            if (contentType is null)
            {
                throw new ArgumentNullException(nameof(contentType));
            }

            documentViewerOutput.SetStatePostProcessing();
            using (var context = new DocumentViewerPostProcessorContext(documentViewerOutput, documentViewer, documentViewerOutput.GetCachedText(), contentType)) {
                foreach (var lz in documentViewerPostProcessors)
                {
                    lz.Value.PostProcess(context);
                }
            }

            documentViewerOutput.SetStateCustomDataProviders();
            using (var context = new DocumentViewerCustomDataContext(documentViewer, documentViewerOutput.GetCachedText(), contentType, documentViewerOutput.GetCustomDataDictionary())) {
                foreach (var lz in documentViewerCustomDataProviders)
                {
                    lz.Value.OnCustomData(context);
                }
                var output = documentViewerOutput;
                documentViewerOutput = null;
                return(output.CreateContent(context.GetResultDictionary() !));
            }
        }
Пример #2
0
 DocumentViewerContent CreateContent(IDocumentViewer documentViewer, DocumentViewerOutput docViewerOutput)
 {
     using (var context = new DocumentViewerCustomDataContext(documentViewer, docViewerOutput.GetCachedText(), docViewerOutput.GetCustomDataDictionary())) {
         foreach (var lazy in decompileFileTabContentFactory.DocumentViewerCustomDataProviders)
         {
             lazy.Value.OnCustomData(context);
         }
         return(docViewerOutput.CreateResult(context.GetResultDictionary()));
     }
 }
        public DocumentViewerContent CreateContent(IDocumentViewer documentViewer)
        {
            if (documentViewerOutput == null)
            {
                throw new InvalidOperationException();
            }
            if (documentViewer == null)
            {
                throw new ArgumentNullException(nameof(documentViewer));
            }

            using (var context = new DocumentViewerCustomDataContext(documentViewer, documentViewerOutput.GetCachedText(), documentViewerOutput.GetCustomDataDictionary())) {
                foreach (var lazy in documentViewerCustomDataProviders)
                {
                    lazy.Value.OnCustomData(context);
                }
                var output = documentViewerOutput;
                documentViewerOutput = null;
                return(output.CreateContent(context.GetResultDictionary()));
            }
        }