protected override void OnDataContextChangedInternal(object dataContext) { this.cilBodyVM = ((MethodBodyVM)dataContext).CilBodyVM; this.coll = ((MethodBodyVM)dataContext).CilBodyVM.LocalsListVM; this.coll.CollectionChanged += coll_CollectionChanged; InitializeLocals(this.coll); AddStandardMenuHandlers("AddLocal"); }
public MethodBodyVM(MethodBodyOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType, MethodDef ownerMethod) { this.origOptions = options; this.nativeMethodBodyVM = new MethodBody.NativeMethodBodyVM(options.NativeMethodBodyOptions, false); NativeMethodBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); this.cilBodyVM = new MethodBody.CilBodyVM(options.CilBodyOptions, ownerModule, language, ownerType, ownerMethod, false); CilBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); this.methodBodyTypeVM = new EnumListVM(methodBodyTypeList, (a, b) => OnMethodBodyTypeChanged()); Reinitialize(); }
public MethodBodyVM(MethodBodyOptions options, ModuleDef ownerModule, IDecompilerService decompilerService, TypeDef ownerType, MethodDef ownerMethod) { origOptions = options; NativeMethodBodyVM = new MethodBody.NativeMethodBodyVM(options.NativeMethodBodyOptions, false); NativeMethodBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); CilBodyVM = new MethodBody.CilBodyVM(options.CilBodyOptions, ownerModule, decompilerService, ownerType, ownerMethod, false); CilBodyVM.PropertyChanged += (s, e) => HasErrorUpdated(); MethodBodyTypeVM = new EnumListVM(methodBodyTypeList, (a, b) => OnMethodBodyTypeChanged()); Reinitialize(); }
protected override void OnDataContextChangedInternal(object dataContext) { cilBodyVM = ((MethodBodyVM)dataContext).CilBodyVM; cilBodyVM.SelectItems = this; coll = cilBodyVM.InstructionsListVM; coll.CollectionChanged += coll_CollectionChanged; InitializeInstructions(coll); Add(new ContextMenuHandler { Header = "res:NopInstrCommand", HeaderPlural = "res:NopInstrsCommand", Command = cilBodyVM.ReplaceInstructionWithNopCommand, Icon = null, InputGestureText = "res:ShortCutKeyN", Modifiers = ModifierKeys.None, Key = Key.N, }); Add(new ContextMenuHandler { Header = "res:ReplaceNopsInstrCommand", HeaderPlural = "res:ReplaceNopsInstrsCommand", Command = cilBodyVM.ReplaceInstructionWithMultipleNopsCommand, Icon = null, InputGestureText = "res:ShortCutKeyR", Modifiers = ModifierKeys.None, Key = Key.R, }); Add(new ContextMenuHandler { Header = "res:InvertBranchCommand", HeaderPlural = "res:InvertBranchesCommand", Command = cilBodyVM.InvertBranchCommand, Icon = DsImages.Branch, InputGestureText = "res:ShortCutKeyI", Modifiers = ModifierKeys.None, Key = Key.I, }); Add(new ContextMenuHandler { Header = "res:ConvertUncondBranchCommand", HeaderPlural = "res:ConvertUncondBranchesCommand", Command = cilBodyVM.ConvertBranchToUnconditionalBranchCommand, Icon = null, InputGestureText = "res:ShortCutKeyB", Modifiers = ModifierKeys.None, Key = Key.B, }); Add(new ContextMenuHandler { Header = "res:RemoveAndAddPopsCommand", Command = cilBodyVM.RemoveInstructionAndAddPopsCommand, InputGestureText = "res:ShortCutKeyP", Modifiers = ModifierKeys.None, Key = Key.P, }); AddSeparator(); Add(new ContextMenuHandler { Header = "res:SimplifyAllInstructionsCommand", Command = cilBodyVM.SimplifyAllInstructionsCommand, InputGestureText = "res:ShortCutKeyS", Modifiers = ModifierKeys.None, Key = Key.S, }); Add(new ContextMenuHandler { Header = "res:OptimizeAllInstructionsCommand", Command = cilBodyVM.OptimizeAllInstructionsCommand, InputGestureText = "res:ShortCutKeyO", Modifiers = ModifierKeys.None, Key = Key.O, }); AddSeparator(); AddStandardMenuHandlers(); Add(new ContextMenuHandler { Header = "res:CopyMetaDataToken", HeaderPlural = "res:CopyMetaDataTokens", Command = new RelayCommand(a => CopyOperandMDTokens((InstructionVM[])a), a => CopyOperandMDTokensCanExecute((InstructionVM[])a)), InputGestureText = "res:ShortCutKeyCtrlM", Modifiers = ModifierKeys.Control, Key = Key.M, }); Add(new ContextMenuHandler { Header = "res:CopyRVACommand", HeaderPlural = "res:CopyRVAsCommand", Command = new RelayCommand(a => CopyInstructionRVA((InstructionVM[])a), a => CopyInstructionRVACanExecute((InstructionVM[])a)), InputGestureText = "res:ShortCutKeyCtrlR", Modifiers = ModifierKeys.Control, Key = Key.R, }); Add(new ContextMenuHandler { Header = "res:CopyFileOffsetCommand", HeaderPlural = "res:CopyFileOffsetsCommand", Command = new RelayCommand(a => CopyInstructionFileOffset((InstructionVM[])a), a => CopyInstructionFileOffsetCanExecute((InstructionVM[])a)), InputGestureText = "res:ShortCutKeyCtrlF", Modifiers = ModifierKeys.Control, Key = Key.F, }); }
public InstructionsListHelper(ListView listView, Window ownerWindow) : base(listView) { cilBodyVM = null !; }
public LocalsIndexObservableCollection(CilBodyVM owner, Func <LocalVM> createNewItem) : base(createNewItem) { this.owner = owner; }
protected override void OnDataContextChangedInternal(object dataContext) { this.cilBodyVM = ((MethodBodyVM)dataContext).CilBodyVM; this.cilBodyVM.SelectItems = this; this.coll = cilBodyVM.InstructionsListVM; this.coll.CollectionChanged += coll_CollectionChanged; InitializeInstructions(this.coll); Add(new ContextMenuHandler { Header = "_NOP Instruction", HeaderPlural = "_NOP Instructions", Command = cilBodyVM.ReplaceInstructionWithNopCommand, Icon = "NOP", InputGestureText = "N", Modifiers = ModifierKeys.None, Key = Key.N, }); Add(new ContextMenuHandler { Header = "_Invert Branch", HeaderPlural = "_Invert Branches", Command = cilBodyVM.InvertBranchCommand, Icon = "Branch", InputGestureText = "I", Modifiers = ModifierKeys.None, Key = Key.I, }); Add(new ContextMenuHandler { Header = "Convert to Unconditional _Branch", HeaderPlural = "Convert to Unconditional _Branches", Command = cilBodyVM.ConvertBranchToUnconditionalBranchCommand, Icon = "ToUncondBranch", InputGestureText = "B", Modifiers = ModifierKeys.None, Key = Key.B, }); Add(new ContextMenuHandler { Header = "R_emove and Add Pops", Command = cilBodyVM.RemoveInstructionAndAddPopsCommand, InputGestureText = "P", Modifiers = ModifierKeys.None, Key = Key.P, }); AddSeparator(); Add(new ContextMenuHandler { Header = "_Simplify All Instructions", Command = cilBodyVM.SimplifyAllInstructionsCommand, InputGestureText = "S", Modifiers = ModifierKeys.None, Key = Key.S, }); Add(new ContextMenuHandler { Header = "Optimi_ze All Instructions", Command = cilBodyVM.OptimizeAllInstructionsCommand, InputGestureText = "O", Modifiers = ModifierKeys.None, Key = Key.O, }); AddSeparator(); AddStandardMenuHandlers(); Add(new ContextMenuHandler { Header = "Copy _MD Token", HeaderPlural = "Copy _MD Tokens", Command = new RelayCommand(a => CopyOperandMDTokens((InstructionVM[])a), a => CopyOperandMDTokensCanExecute((InstructionVM[])a)), InputGestureText = "Ctrl+M", Modifiers = ModifierKeys.Control, Key = Key.M, }); Add(new ContextMenuHandler { Header = "C_opy RVA", HeaderPlural = "C_opy RVAs", Command = new RelayCommand(a => CopyInstructionRVA((InstructionVM[])a), a => CopyInstructionRVACanExecute((InstructionVM[])a)), InputGestureText = "Ctrl+R", Modifiers = ModifierKeys.Control, Key = Key.R, }); Add(new ContextMenuHandler { Header = "Copy File Offset", HeaderPlural = "Copy File Offsets", Command = new RelayCommand(a => CopyInstructionFileOffset((InstructionVM[])a), a => CopyInstructionFileOffsetCanExecute((InstructionVM[])a)), InputGestureText = "Ctrl+F", Modifiers = ModifierKeys.Control, Key = Key.F, }); }