internal static void SortTable(MetaDataTableVM mdTblVM, uint rid, uint count, string descr) { var doc = mdTblVM.Document; int len = (int)count * mdTblVM.TableInfo.RowSize; var data = new byte[len]; ulong startOffset = mdTblVM.StartOffset + (rid - 1) * (ulong)mdTblVM.TableInfo.RowSize; doc.Read(startOffset, data, 0, data.Length); TableSorter.Sort(mdTblVM.TableInfo, data); WriteHexUndoCommand.AddAndExecute(doc, startOffset, data, descr); }
public override void Execute(MDTableContext context) { var data = GetPasteData(context); if (data == null) { return; } var doc = context.MetaDataTableVM.Document; int recs = data.Length / context.MetaDataTableVM.TableInfo.RowSize; WriteHexUndoCommand.AddAndExecute(doc, context.Records[0].StartOffset, data, string.Format(recs == 1 ? "Paste {0} {1} record @ {2:X8}, RID {3}" : "Paste {0} {1} records @ {2:X8}, RID {3}", recs, context.MetaDataTableVM.Table, context.Records[0].StartOffset, context.Records[0].Token.Rid)); }
static void ExecuteInternal(Lazy <IUndoCommandService> undoCommandService, MDTableContext context) { var data = GetPasteData(context); if (data == null) { return; } var doc = context.MetaDataTableVM.Document; int recs = data.Length / context.MetaDataTableVM.TableInfo.RowSize; WriteHexUndoCommand.AddAndExecute(undoCommandService.Value, doc, context.Records[0].StartOffset, data, string.Format(recs == 1 ? dnSpy_AsmEditor_Resources.Hex_Undo_Message_Paste_Record : dnSpy_AsmEditor_Resources.Hex_Undo_Message_Paste_Records, recs, context.MetaDataTableVM.Table, context.Records[0].StartOffset, context.Records[0].Token.Rid)); }
public override void Execute(ContextMenuEntryContext context) { var data = GetData(context); if (data == null) { return; } var info = GetMethodLengthAndOffset(context); if (info == null || info.Value.Size < (ulong)data.Length) { return; } WriteHexUndoCommand.AddAndExecute(info.Value.Filename, info.Value.Offset, data, GetDescription(data)); }
void IUndoHexDocument.WriteUndo(ulong startOffset, byte[] newData, string descr) { WriteHexUndoCommand.AddAndExecute(undoCommandManager, this, startOffset, newData, descr); }