Exemplo n.º 1
0
        CreateAssemblyCommand(IUndoCommandService undoCommandService, IDocumentTreeView documentTreeView, ModuleDef newModule, AssemblyOptions options)
        {
            this.undoCommandService = undoCommandService;
            var module = Module.ModuleUtils.CreateModule(options.Name, Guid.NewGuid(), options.ClrVersion, ModuleKind.Dll, newModule);

            options.CreateAssemblyDef(module).Modules.Add(module);
            var file = DsDotNetDocument.CreateAssembly(DsDocumentInfo.CreateDocument(string.Empty), module, true);

            fileNodeCreator = RootDocumentNodeCreator.CreateAssembly(documentTreeView, file);
        }
Exemplo n.º 2
0
 protected AddNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode, bool modNodeWasCreated)
 {
     this.undoCommandService = undoCommandService;
     if (!(asmNode is AssemblyDocumentNode))
     {
         asmNode = (AssemblyDocumentNode)asmNode.TreeNode.Parent.Data;
     }
     this.asmNode           = (AssemblyDocumentNode)asmNode;
     this.modNode           = modNode;
     this.modNodeWasCreated = modNodeWasCreated;
 }
Exemplo n.º 3
0
 public static void AddAndExecute(IUndoCommandService undoCommandService, HexDocument doc, ulong offset, byte[] data, string descr = null)
 {
     if (doc == null)
     {
         throw new ArgumentNullException(nameof(doc));
     }
     if (data == null || data.Length == 0)
     {
         return;
     }
     undoCommandService.Add(new WriteHexUndoCommand(doc, offset, data, descr));
 }
Exemplo n.º 4
0
        static IEnumerable <UndoRedoInfo> GetUndoRedoInfo(IUndoCommandService undoCommandService, IEnumerable <DsDocumentNode> nodes)
        {
            var modifiedUndoAsms = new HashSet <IUndoObject>(undoCommandService.UndoObjects);
            var modifiedRedoAsms = new HashSet <IUndoObject>(undoCommandService.RedoObjects);

            foreach (var node in nodes)
            {
                var  uo       = undoCommandService.GetUndoObject(node.Document);
                bool isInUndo = modifiedUndoAsms.Contains(uo);
                bool isInRedo = modifiedRedoAsms.Contains(uo);
                yield return(new UndoRedoInfo(node, isInUndo, isInRedo));
            }
        }
Exemplo n.º 5
0
        public static void AddAndExecute(IUndoCommandService undoCommandService, IHexDocumentService hexDocumentService, string filename, ulong offset, byte[] data, string descr = null)
        {
            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentException();
            }
            var doc = hexDocumentService.GetOrCreate(filename);

            if (doc == null)
            {
                return;
            }
            AddAndExecute(undoCommandService, doc, offset, data, descr);
        }
Exemplo n.º 6
0
 AddExistingNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode)
     : base(undoCommandService, asmNode, modNode, false)
 {
 }
Exemplo n.º 7
0
 AddNewNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode)
     : base(undoCommandService, asmNode, modNode, true)
 {
 }
Exemplo n.º 8
0
 HexBufferService(IUndoCommandService undoCommandService, HexBufferFactoryService hexBufferFactoryService, [ImportMany] IEnumerable <Lazy <IHexBufferServiceListener> > hexBufferServiceListeners)
 {
     this.hexBufferFactoryService   = hexBufferFactoryService;
     this.hexBufferServiceListeners = hexBufferServiceListeners.ToArray();
     undoCommandService.OnEvent    += UndoCommandService_OnEvent;
 }
Exemplo n.º 9
0
 HexBufferUndoRedo(IUndoCommandService undoCommandService) => this.undoCommandService = undoCommandService;
Exemplo n.º 10
0
 HexDocumentService(IUndoCommandService undoCommandService)
 {
     this.undoCommandService     = undoCommandService;
     undoCommandService.OnEvent += UndoCommandService_OnEvent;
 }
Exemplo n.º 11
0
		AddNewNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode)
			: base(undoCommandService, asmNode, modNode, true) {
		}
Exemplo n.º 12
0
		static IEnumerable<UndoRedoInfo> GetUndoRedoInfo(IUndoCommandService undoCommandService, IEnumerable<DsDocumentNode> nodes) {
			var modifiedUndoAsms = new HashSet<IUndoObject>(undoCommandService.UndoObjects);
			var modifiedRedoAsms = new HashSet<IUndoObject>(undoCommandService.RedoObjects);
			foreach (var node in nodes) {
				var uo = undoCommandService.GetUndoObject(node.Document);
				bool isInUndo = modifiedUndoAsms.Contains(uo);
				bool isInRedo = modifiedRedoAsms.Contains(uo);
				yield return new UndoRedoInfo(node, isInUndo, isInRedo);
			}
		}
Exemplo n.º 13
0
 public AsmEdHexDocument(IUndoCommandService undoCommandService, byte[] data, string filename)
     : base(data, filename)
 {
     this.undoCommandService = undoCommandService;
     this.undoObject         = new UndoObject(this);
 }
Exemplo n.º 14
0
 HexBoxUndoService(IUndoCommandService undoCommandService)
 {
     this.undoCommandService     = undoCommandService;
     undoCommandService.OnEvent += UndoCommandService_OnEvent;
 }
Exemplo n.º 15
0
		HexBufferService(IUndoCommandService undoCommandService, HexBufferFactoryService hexBufferFactoryService, [ImportMany] IEnumerable<Lazy<IHexBufferServiceListener>> hexBufferServiceListeners) {
			this.hexBufferFactoryService = hexBufferFactoryService;
			this.hexBufferServiceListeners = hexBufferServiceListeners.ToArray();
			undoCommandService.OnEvent += UndoCommandService_OnEvent;
		}
Exemplo n.º 16
0
		AddExistingNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode)
			: base(undoCommandService, asmNode, modNode, false) {
		}
Exemplo n.º 17
0
		CreateAssemblyCommand(IUndoCommandService undoCommandService, IDocumentTreeView documentTreeView, ModuleDef newModule, AssemblyOptions options) {
			this.undoCommandService = undoCommandService;
			var module = Module.ModuleUtils.CreateModule(options.Name, Guid.NewGuid(), options.ClrVersion, ModuleKind.Dll, newModule);
			options.CreateAssemblyDef(module).Modules.Add(module);
			var file = DsDotNetDocument.CreateAssembly(DsDocumentInfo.CreateDocument(string.Empty), module, true);
			fileNodeCreator = RootDocumentNodeCreator.CreateAssembly(documentTreeView, file);
		}
Exemplo n.º 18
0
		protected AddNetModuleToAssemblyCommand(IUndoCommandService undoCommandService, DsDocumentNode asmNode, ModuleDocumentNode modNode, bool modNodeWasCreated) {
			this.undoCommandService = undoCommandService;
			if (!(asmNode is AssemblyDocumentNode))
				asmNode = (AssemblyDocumentNode)asmNode.TreeNode.Parent.Data;
			this.asmNode = (AssemblyDocumentNode)asmNode;
			this.modNode = modNode;
			this.modNodeWasCreated = modNodeWasCreated;
		}