コード例 #1
0
ファイル: AboutScreen.cs プロジェクト: n017/dnSpy
 void WriteShortInfo(AvalonEditTextOutput output, string s)
 {
     if (string.IsNullOrEmpty(s))
         return;
     const int MAX_SHORT_LEN = 128;
     if (s.Length > MAX_SHORT_LEN)
         s = s.Substring(0, MAX_SHORT_LEN) + "[...]";
     output.WriteLine(string.Format("  {0}", s), TextTokenKind.Text);
 }
コード例 #2
0
ファイル: CodeMappings.cs プロジェクト: lovebanyi/dnSpy
 void AddCodeMappings(ITextEditorUIContext uiContext, AvalonEditTextOutput output)
 {
     if (output == null)
         return;
     var cm = new CodeMappings(output.DebuggerMemberMappings);
     uiContext.AddOutputData(CodeMappingsConstants.CodeMappingsKey, cm);
 }
コード例 #3
0
ファイル: AboutScreen.cs プロジェクト: n017/dnSpy
 public void OnShow(IShowContext ctx)
 {
     var uiCtx = (ITextEditorUIContext)ctx.UIContext;
     var output = new AvalonEditTextOutput();
     Write(output);
     uiCtx.SetOutput(output, null);
 }
コード例 #4
0
ファイル: AboutScreen.cs プロジェクト: n017/dnSpy
 void Write(AvalonEditTextOutput output)
 {
     output.WriteLine(string.Format("dnSpy {0}", appWindow.AssemblyInformationalVersion), TextTokenKind.Text);
     output.WriteLine();
     output.WriteLine(dnSpy_Resources.AboutScreen_LicenseInfo, TextTokenKind.Text);
     output.WriteLine();
     output.WriteLine(dnSpy_Resources.AboutScreen_LoadedFiles, TextTokenKind.Text);
     foreach (var info in GetInfos()) {
         output.WriteLine();
         WriteShortInfo(output, info.Name);
         WriteShortInfo(output, info.Copyright);
         WriteShortInfo(output, info.ShortDescription);
     }
 }
コード例 #5
0
ファイル: CodeMappings.cs プロジェクト: levisre/dnSpy
		void AddCodeMappings(ITextEditorUIContext uiContext, AvalonEditTextOutput output) {
			if (output == null)
				return;
			var cm = new CodeMappings(output.DebuggerMemberMappings, serializedDnModuleCreator);
			uiContext.AddOutputData(CodeMappingsKey, cm);
		}
コード例 #6
0
ファイル: AboutScreen.cs プロジェクト: GreenDamTan/dnSpy
		void WriteResourceFile(AvalonEditTextOutput output, string name, bool addNewLine = true) {
			if (addNewLine)
				output.WriteLine();
			using (var stream = GetType().Assembly.GetManifestResourceStream(name))
			using (var streamReader = new StreamReader(stream, Encoding.UTF8)) {
				for (;;) {
					var line = streamReader.ReadLine();
					if (line == null)
						break;
					output.WriteLine(line, TextTokenKind.Text);
				}
			}
		}
コード例 #7
0
ファイル: AboutScreen.cs プロジェクト: kulminati/dnSpy
 public object OnShow(IFileTabUIContext uiContext)
 {
     var ctx = (ITextEditorUIContext)uiContext;
     var output = new AvalonEditTextOutput();
     Write(output);
     ctx.SetOutput(output, null);
     return null;
 }
コード例 #8
0
 DecompileContext CreateDecompileContext()
 {
     var decompileContext = new DecompileContext();
     var decompilationContext = new DecompilationContext();
     decompilationContext.GetDisableAssemblyLoad = () => decompileFileTabContentFactory.FileManager.DisableAssemblyLoad();
     decompilationContext.IsBodyModified = m => decompileFileTabContentFactory.MethodAnnotations.IsBodyModified(m);
     var output = new AvalonEditTextOutput();
     var dispatcher = Dispatcher.CurrentDispatcher;
     decompileContext.DecompileNodeContext = new DecompileNodeContext(decompilationContext, language, output, dispatcher);
     return decompileContext;
 }
コード例 #9
0
        public void EndAsyncShow(IFileTabUIContext uiContext, object userData, IAsyncShowResult result)
        {
            var decompileContext = (DecompileContext)userData;
            var uiCtx = (ITextEditorUIContext)uiContext;

            IHighlightingDefinition highlighting;
            if (decompileContext.DecompileNodeContext.HighlightingDefinition != null)
                highlighting = decompileContext.DecompileNodeContext.HighlightingDefinition;
            else if (decompileContext.DecompileNodeContext.HighlightingExtension != null)
                highlighting = HighlightingManager.Instance.GetDefinitionByExtension(decompileContext.DecompileNodeContext.HighlightingExtension);
            else
                highlighting = decompileContext.DecompileNodeContext.Language.GetHighlightingDefinition();

            AvalonEditTextOutput output;
            if (result.IsCanceled) {
                output = new AvalonEditTextOutput();
                output.Write(dnSpy_Resources.DecompilationCanceled, TextTokenKind.Error);
            }
            else if (result.Exception != null) {
                output = new AvalonEditTextOutput();
                output.Write(dnSpy_Resources.DecompilationException, TextTokenKind.Error);
                output.WriteLine();
                output.Write(result.Exception.ToString(), TextTokenKind.Text);
            }
            else {
                output = decompileContext.CachedOutput;
                if (output == null) {
                    output = (AvalonEditTextOutput)decompileContext.DecompileNodeContext.Output;
                    decompileFileTabContentFactory.DecompilationCache.Cache(decompileContext.DecompileNodeContext.Language, nodes, output, highlighting);
                }
            }

            if (result.CanShowOutput)
                uiCtx.SetOutput(output, highlighting);
        }
コード例 #10
0
		DecompileContext CreateDecompileContext(IShowContext ctx) {
			var decompileContext = new DecompileContext();
			var decompilationContext = new DecompilationContext();
			decompilationContext.CalculateILRanges = true;
			decompilationContext.GetDisableAssemblyLoad = () => decompileFileTabContentFactory.FileManager.DisableAssemblyLoad();
			decompilationContext.IsBodyModified = m => decompileFileTabContentFactory.MethodAnnotations.IsBodyModified(m);
			var output = new AvalonEditTextOutput();
			var dispatcher = Dispatcher.CurrentDispatcher;
			decompileContext.DecompileNodeContext = new DecompileNodeContext(decompilationContext, language, output, dispatcher);
			if (ctx.IsRefresh) {
				decompileContext.SavedRefPos = ((ITextEditorUIContext)ctx.UIContext).SaveReferencePosition();
				if (decompileContext.SavedRefPos != null) {
					ctx.OnShown = e => {
						if (e.Success && !e.HasMovedCaret) {
							e.HasMovedCaret = ((ITextEditorUIContext)ctx.UIContext).RestoreReferencePosition(decompileContext.SavedRefPos);
							if (!e.HasMovedCaret) {
								((ITextEditorUIContext)ctx.UIContext).ScrollAndMoveCaretTo(1, 1);
								e.HasMovedCaret = true;
							}
						}
					};
				}
			}
			return decompileContext;
		}
コード例 #11
0
ファイル: AboutScreen.cs プロジェクト: lovebanyi/dnSpy
        void Write(AvalonEditTextOutput output)
        {
            output.WriteLine(string.Format("dnSpy {0}", appWindow.AssemblyInformationalVersion), TextTokenKind.Text);

            //TODO: Add more stuff...
        }