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)); }
public DecompiledCodeResult(IDecompiledDocument[] documents, CompilerMetadataReference[] assemblyReferences, IAssemblyReferenceResolver assemblyReferenceResolver, TargetPlatform platform) { Documents = documents; AssemblyReferences = assemblyReferences; AssemblyReferenceResolver = assemblyReferenceResolver; Platform = platform; }
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); }