public override void Decompile(ICSharpCode.ILSpy.Language language, ITextOutput output, ICSharpCode.ILSpy.DecompilationOptions options) { //Switches on the token switch (_tokenProvider.MetadataToken.TokenType) { case TokenType.Module: language.DecompileModule((ModuleDefinition)_tokenProvider, output, options); break; case TokenType.Assembly: language.WriteCommentLine(output, ((AssemblyNameReference)_tokenProvider).FullName); break; case TokenType.TypeDef: language.DecompileType((TypeDefinition)_tokenProvider, output, options); break; case TokenType.Field: language.DecompileField((FieldDefinition)_tokenProvider, output, options); break; case TokenType.Method: language.DecompileMethod((MethodDefinition)_tokenProvider, output, options); break; case TokenType.Event: language.DecompileEvent((EventDefinition)_tokenProvider, output, options); break; case TokenType.Property: language.DecompileProperty((PropertyDefinition)_tokenProvider, output, options); break; case TokenType.MemberRef: var memberRef = (MemberReference)_tokenProvider; if (memberRef.DeclaringType != null && memberRef.DeclaringType is GenericInstanceType) { var giType = (GenericInstanceType)memberRef.DeclaringType; var type = giType.ElementType.Resolve(); var memberDef = type.Fields.Cast <IMemberDefinition>() .Concat(type.Methods) .Concat(type.Properties) .Concat(type.Events) .FirstOrDefault(m => m.Name == memberRef.Name); if (memberDef != null) { new ILEditTreeNode(memberDef, true).Decompile(language, output, options); } } break; default: language.WriteCommentLine(output, (string)this.Text); break; } }
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) { App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(EnsureChildrenFiltered)); language.WriteCommentLine(output, "PE"); language.WriteCommentLine(output, "All tree nodes below use the hex editor to modify the PE file"); foreach (HexTreeNode node in Children) { language.WriteCommentLine(output, string.Empty); node.Decompile(language, output, options); } }
protected override void DecompileFields(Language language, ITextOutput output) { var cols = tablesStreamVM.TableInfo.Columns; language.WriteCommentLine(output, string.Empty); language.WriteComment(output, string.Empty); output.Write("RID\tToken\tOffset", TextTokenType.Comment); for (int i = 0; i < cols.Count; i++) { output.Write('\t', TextTokenType.Comment); output.Write(tablesStreamVM.GetColumnName(i), TextTokenType.Comment); } if (tablesStreamVM.HasInfo) { output.Write('\t', TextTokenType.Comment); output.Write(tablesStreamVM.InfoName, TextTokenType.Comment); } output.WriteLine(); for (int i = 0; i < (int)tablesStreamVM.Rows; i++) { var obj = tablesStreamVM.Get(i); language.WriteComment(output, string.Empty); output.Write(obj.RidString, TextTokenType.Comment); output.Write('\t', TextTokenType.Comment); output.Write(obj.TokenString, TextTokenType.Comment); output.Write('\t', TextTokenType.Comment); output.Write(obj.OffsetString, TextTokenType.Comment); for (int j = 0; j < cols.Count; j++) { output.Write('\t', TextTokenType.Comment); output.Write(obj.GetField(j).DataFieldVM.StringValue, TextTokenType.Comment); } if (tablesStreamVM.HasInfo) { output.Write('\t', TextTokenType.Comment); output.Write(obj.Info, TextTokenType.Comment); } output.WriteLine(); } }
protected virtual void DecompileFields(Language language, ITextOutput output) { foreach (var vm in HexVMs) { language.WriteCommentLine(output, string.Empty); language.WriteCommentLine(output, string.Format("{0}:", vm.Name)); foreach (var field in vm.HexFields) language.WriteCommentLine(output, string.Format("{0:X8} - {1:X8} {2} = {3}", field.StartOffset, field.EndOffset, field.FormattedValue, field.Name)); } }
public sealed override void Decompile(Language language, ITextOutput output, DecompilationOptions options) { language.WriteCommentLine(output, string.Format("{0:X8} - {1:X8} {2}", StartOffset, EndOffset, this.ToString())); DecompileFields(language, output); var smartOutput = output as ISmartTextOutput; if (smartOutput != null) smartOutput.MarkAsNonCached(); }
public override sealed void Decompile(Language language, ITextOutput output, DecompilationOptions options) { language.WriteCommentLine(output, string.Format("{0:X8} - {1:X8} {2}", StartOffset, EndOffset, this.ToString())); foreach (var vm in HexVMs) { language.WriteCommentLine(output, string.Empty); language.WriteCommentLine(output, string.Format("{0}:", vm.Name)); foreach (var field in vm.HexFields) language.WriteCommentLine(output, string.Format("{0:X8} - {1:X8} {2} = {3}", field.StartOffset, field.EndOffset, field.FormattedValue, field.Name)); } var smartOutput = output as ISmartTextOutput; if (smartOutput != null) smartOutput.MarkAsNonCached(); }
protected override void DecompileFields(Language language, ITextOutput output) { language.WriteCommentLine(output, string.Empty); language.WriteComment(output, string.Empty); WriteHeader(output); for (int i = 0; i < (int)tablesStreamVM.Rows; i++) { var obj = tablesStreamVM.Get(i); language.WriteComment(output, string.Empty); Write(output, obj); } }