예제 #1
0
        string GenerateHtmlFragmentCore(HexBufferLineFormatter bufferLines, NormalizedHexBufferSpanCollection spans, HexView?hexView, string delimiter, CancellationToken cancellationToken)
        {
            HexClassifier?classifier = null;

            try {
                VSTC.IClassificationFormatMap classificationFormatMap;
                if (!(hexView is null))
                {
                    classifier = viewClassifierAggregatorService.GetClassifier(hexView);
                    classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(hexView);
                }
                else
                {
                    classifier = spans.Count == 0 ? null : classifierAggregatorService.GetClassifier(spans[0].Buffer);
                    classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.HexEditor);
                }

                const int tabSize = 4;
                var       builder = new HexHtmlBuilder(classificationFormatMap, delimiter, tabSize);
                if (spans.Count != 0)
                {
                    Debug2.Assert(!(classifier is null));
                    builder.Add(bufferLines, classifier, spans, cancellationToken);
                }
                return(builder.Create());
            }
		string GenerateHtmlFragmentCore(HexBufferLineProvider bufferLines, NormalizedHexBufferSpanCollection spans, HexView hexView, string delimiter, CancellationToken cancellationToken) {
			HexClassifier classifier = null;
			try {
				VSTC.IClassificationFormatMap classificationFormatMap;
				if (hexView != null) {
					classifier = viewClassifierAggregatorService.GetClassifier(hexView);
					classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(hexView);
				}
				else {
					classifier = spans.Count == 0 ? null : classifierAggregatorService.GetClassifier(spans[0].Buffer);
					classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.HexEditor);
				}

				const int tabSize = 4;
				var builder = new HexHtmlBuilder(classificationFormatMap, delimiter, tabSize);
				if (spans.Count != 0)
					builder.Add(bufferLines, classifier, spans, cancellationToken);
				return builder.Create();
			}
			finally {
				classifier.Dispose();
			}
		}