Пример #1
0
        RoslynCodeDocument CreateDocument(ProjectId projectId, IDecompiledDocument doc)
        {
            var options = new CodeEditorOptions();

            options.ContentTypeString = ContentType;
            options.Roles.Add(PredefinedDsTextViewRoles.RoslynCodeEditor);
            options.Roles.Add(TextViewRole);
            var codeEditor = codeEditorProvider.Create(options);

            codeEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategory);
            codeEditor.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true);

            var textBuffer = codeEditor.TextView.TextBuffer;

            textBuffer.Replace(new Span(0, textBuffer.CurrentSnapshot.Length), doc.Code);

            var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectId), doc.NameNoExtension + FileExtension, null, SourceCodeKind.Regular, TextLoader.From(codeEditor.TextBuffer.AsTextContainer(), VersionStamp.Create()));

            return(new RoslynCodeDocument(codeEditor, documentInfo, doc.NameNoExtension));
        }
Пример #2
0
		public DecompiledCodeResult(IDecompiledDocument[] documents, CompilerMetadataReference[] assemblyReferences, IAssemblyReferenceResolver assemblyReferenceResolver, TargetPlatform platform) {
			Documents = documents;
			AssemblyReferences = assemblyReferences;
			AssemblyReferenceResolver = assemblyReferenceResolver;
			Platform = platform;
		}
Пример #3
0
		RoslynCodeDocument CreateDocument(ProjectId projectId, IDecompiledDocument doc) {
			var options = new CodeEditorOptions();
			options.ContentTypeString = ContentType;
			options.Roles.Add(PredefinedDsTextViewRoles.RoslynCodeEditor);
			options.Roles.Add(TextViewRole);
			var codeEditor = codeEditorProvider.Create(options);
			codeEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategory);
			codeEditor.TextView.Options.SetOptionValue(DefaultTextViewHostOptions.GlyphMarginId, true);

			var textBuffer = codeEditor.TextView.TextBuffer;
			textBuffer.Replace(new Span(0, textBuffer.CurrentSnapshot.Length), doc.Code);

			var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(projectId), doc.NameNoExtension + FileExtension, null, SourceCodeKind.Regular, TextLoader.From(codeEditor.TextBuffer.AsTextContainer(), VersionStamp.Create()));
			return new RoslynCodeDocument(codeEditor, documentInfo, doc.NameNoExtension);
		}