private void Window_Loaded(object sender, RoutedEventArgs e) { ilOutput = TextColorWriterToDecompilerOutput.Create(new RichTextBoxTextColorOutput(ILView, ManualMode.Theme)); exprOutput = new RichTextBoxTextColorOutput(ExprView, ManualMode.Theme); ILView.Document.PageWidth = 1000; method = DotNetUtils.Clone(((IMethodNode)(((object[])this.DataContext)[0])).MethodDef); Blocks blocks = new Blocks(method); CancellationToken token = default(CancellationToken); cflowDeobfuscator = new CflowDeobfuscator(); cflowDeobfuscator.Initialize(blocks, token); cflowDeobfuscator.CheckBlocks(); for (int i = 0; i < cflowDeobfuscator.UnsolvedBlocks.Count(); i++) { BlocksListView.Items.Add("Block " + i.ToString()); } if (BlocksListView.Items.Count > 0) { BlocksListView.SelectedIndex = 0; } else { Consts.IsEnabled = false; Value.IsEnabled = false; SetButton.IsEnabled = false; SolveButton.IsEnabled = false; MsgBox.Instance.Show("There is no unpredictable control transfers in this method"); } }
public override void WriteToolTip(ITextColorWriter output, IMemberRef member, IHasCustomAttribute typeAttributes) { if (!(member is ITypeDefOrRef) && ILDecompilerUtils.Write(TextColorWriterToDecompilerOutput.Create(output), member)) { return; } base.WriteToolTip(output, member, typeAttributes); }
static void ExecuteInternal(MDTableContext context) { var output = new StringBuilderTextColorOutput(); var output2 = TextColorWriterToDecompilerOutput.Create(output); context.Node.WriteHeader(output2); foreach (var rec in context.Records) { context.Node.Write(output2, rec); } var s = output.ToString(); if (s.Length > 0) { try { Clipboard.SetText(s); } catch (ExternalException) { } } }
public static void WriteObject(ITextColorWriter output, object obj, WriteObjectFlags flags = WriteObjectFlags.None) { if (IsNull(obj)) { output.Write(BoxedTextColor.Keyword, "null"); return; } var mr = obj as IMemberRef; if (mr != null) { if (simpleILPrinter.Write(TextColorWriterToDecompilerOutput.Create(output), mr)) { return; } } var local = obj as LocalVM; if (local != null) { output.Write(BoxedTextColor.Local, IdentifierEscaper.Escape(GetLocalName(local.Name, local.Index))); output.WriteSpace(); output.WriteLocalParameterIndex(local.Index); return; } var parameter = obj as Parameter; if (parameter != null) { if (parameter.IsHiddenThisParameter) { output.Write(BoxedTextColor.Keyword, "this"); } else { output.Write(BoxedTextColor.Parameter, IdentifierEscaper.Escape(GetParameterName(parameter.Name, parameter.Index))); output.WriteSpace(); output.WriteLocalParameterIndex(parameter.Index); } return; } var instr = obj as InstructionVM; if (instr != null) { if ((flags & WriteObjectFlags.ShortInstruction) != 0) { output.WriteShort(instr); } else { output.WriteLong(instr); } return; } var instrs = obj as IList <InstructionVM>; if (instrs != null) { output.Write(instrs); return; } var methodSig = obj as MethodSig; if (methodSig != null) { simpleILPrinter.Write(TextColorWriterToDecompilerOutput.Create(output), methodSig); return; } if (obj is TypeSig) { simpleILPrinter.Write(TextColorWriterToDecompilerOutput.Create(output), obj as TypeSig); return; } if (obj is Code) { output.Write(BoxedTextColor.OpCode, ((Code)obj).ToOpCode().Name); return; } // This code gets called by the combobox and it sometimes passes in the empty string. // It's never shown in the UI. Debug.Assert(string.Empty.Equals(obj), "Shouldn't be here"); output.Write(BoxedTextColor.Text, obj.ToString()); }
public void WriteName(ITextColorWriter output, PropertyDef property, bool?isIndexer) => FormatPropertyName(TextColorWriterToDecompilerOutput.Create(output), property, isIndexer);
public void WriteType(ITextColorWriter output, ITypeDefOrRef type, bool includeNamespace, ParamDef pd = null) => TypeToString(TextColorWriterToDecompilerOutput.Create(output), type, includeNamespace, pd);
public void WriteName(ITextColorWriter output, TypeDef type) => FormatTypeName(TextColorWriterToDecompilerOutput.Create(output), type);