Пример #1
0
        bool MarkAsSaved(SaveMultiModuleVM vm, object[] docs)
        {
            bool allSaved = true;

            foreach (var doc in docs)
            {
                if (!vm.WasSaved(doc))
                {
                    allSaved = false;
                }
                else
                {
                    undoCommandService.Value.MarkAsSaved(undoCommandService.Value.GetUndoObject(doc) !);
                    if (doc is IDsDocument document && string.IsNullOrEmpty(document.Filename))
                    {
                        var filename = vm.GetSavedFileName(doc);
                        if (!string.IsNullOrWhiteSpace(filename) && !(document.ModuleDef is null))
                        {
                            document.ModuleDef.Location = filename;
                            document.Filename           = filename;
                            var modNode = documentTabService.DocumentTreeView.FindNode(document.ModuleDef) as ModuleDocumentNode;
                            Debug.Assert(!(modNode is null));
                            if (!(modNode is null))
                            {
                                modNode.TreeNode.RefreshUI();
                                documentTabService.RefreshModifiedDocument(modNode.Document);
                            }
                        }
                    }
                }
            }
            return(allSaved);
        }
Пример #2
0
        bool MarkAsSaved(SaveMultiModuleVM vm, object[] docs)
        {
            bool allSaved = true;

            foreach (var doc in docs)
            {
                if (!vm.WasSaved(doc))
                {
                    allSaved = false;
                }
                else
                {
                    undoCommandManager.Value.MarkAsSaved(undoCommandManager.Value.GetUndoObject(doc));
                    var file = doc as IDnSpyFile;
                    if (file != null && string.IsNullOrEmpty(file.Filename))
                    {
                        var filename = vm.GetSavedFileName(doc);
                        if (!string.IsNullOrWhiteSpace(filename) && file.ModuleDef != null)
                        {
                            file.ModuleDef.Location = filename;
                            file.Filename           = filename;
                            var modNode = fileTabManager.FileTreeView.FindNode(file.ModuleDef) as IModuleFileNode;
                            Debug.Assert(modNode != null);
                            if (modNode != null)
                            {
                                modNode.TreeNode.RefreshUI();
                                fileTabManager.RefreshModifiedFile(modNode.DnSpyFile);
                            }
                        }
                    }
                }
            }
            return(allSaved);
        }
Пример #3
0
        static bool MarkAsSaved(SaveMultiModuleVM vm, IUndoObject[] objs)
        {
            bool setNewFileName = false;
            bool allSaved       = true;

            foreach (var obj in objs)
            {
                if (!vm.WasSaved(obj))
                {
                    allSaved = false;
                }
                else
                {
                    UndoCommandManager.Instance.MarkAsSaved(obj);
                    var file = UndoCommandManager.Instance.TryGetDnSpyFile(obj);
                    if (file != null && string.IsNullOrEmpty(file.Filename))
                    {
                        var filename = vm.GetSavedFileName(obj);
                        if (!string.IsNullOrWhiteSpace(filename) && file.ModuleDef != null)
                        {
                            file.ModuleDef.Location = filename;
                            file.Filename           = filename;
                            setNewFileName          = true;
                            var asmNode = MainWindow.Instance.FindTreeNode(file.ModuleDef) as AssemblyTreeNode;
                            Debug.Assert(asmNode != null);
                            if (asmNode != null)
                            {
                                asmNode.OnFileNameChanged();
                                Utils.NotifyModifiedAssembly(file);
                            }
                        }
                    }
                }
            }
            if (setNewFileName)
            {
                MainWindow.Instance.DnSpyFileListManager.RefreshSave(MainWindow.Instance.DnSpyFileList);
            }
            return(allSaved);
        }
Пример #4
0
        static bool MarkAsSaved(SaveMultiModuleVM vm, IUndoObject[] objs)
        {
            bool setNewFileName = false;
            bool allSaved       = true;

            foreach (var obj in objs)
            {
                if (!vm.WasSaved(obj))
                {
                    allSaved = false;
                }
                else
                {
                    UndoCommandManager.Instance.MarkAsSaved(obj);
                    var asm = obj as LoadedAssembly;
                    if (asm != null && string.IsNullOrEmpty(asm.FileName))
                    {
                        var filename = vm.GetSavedFileName(asm);
                        if (!string.IsNullOrWhiteSpace(filename) && asm.ModuleDefinition != null)
                        {
                            asm.ModuleDefinition.Location = filename;
                            asm.FileName   = filename;
                            setNewFileName = true;
                            var asmNode = MainWindow.Instance.FindTreeNode(asm.ModuleDefinition) as AssemblyTreeNode;
                            Debug.Assert(asmNode != null);
                            if (asmNode != null)
                            {
                                asmNode.OnFileNameChanged();
                                Utils.NotifyModifiedAssembly(asm);
                            }
                        }
                    }
                }
            }
            if (setNewFileName)
            {
                MainWindow.Instance.CurrentAssemblyList.RefreshSave();
            }
            return(allSaved);
        }
Пример #5
0
 static bool MarkAsSaved(SaveMultiModuleVM vm, IUndoObject[] objs)
 {
     bool setNewFileName = false;
     bool allSaved = true;
     foreach (var obj in objs) {
         if (!vm.WasSaved(obj))
             allSaved = false;
         else {
             UndoCommandManager.Instance.MarkAsSaved(obj);
             var asm = obj as LoadedAssembly;
             if (asm != null && string.IsNullOrEmpty(asm.FileName)) {
                 var filename = vm.GetSavedFileName(asm);
                 if (!string.IsNullOrWhiteSpace(filename)) {
                     asm.ModuleDefinition.Location = filename;
                     asm.FileName = filename;
                     setNewFileName = true;
                     var asmNode = MainWindow.Instance.FindTreeNode(asm.ModuleDefinition) as AssemblyTreeNode;
                     Debug.Assert(asmNode != null);
                     if (asmNode != null) {
                         asmNode.OnFileNameChanged();
                         Utils.NotifyModifiedAssembly(asm);
                     }
                 }
             }
         }
     }
     if (setNewFileName)
         MainWindow.Instance.CurrentAssemblyList.RefreshSave();
     return allSaved;
 }
Пример #6
0
		bool MarkAsSaved(SaveMultiModuleVM vm, object[] docs) {
			bool allSaved = true;
			foreach (var doc in docs) {
				if (!vm.WasSaved(doc))
					allSaved = false;
				else {
					undoCommandService.Value.MarkAsSaved(undoCommandService.Value.GetUndoObject(doc));
					var document = doc as IDsDocument;
					if (document != null && string.IsNullOrEmpty(document.Filename)) {
						var filename = vm.GetSavedFileName(doc);
						if (!string.IsNullOrWhiteSpace(filename) && document.ModuleDef != null) {
							document.ModuleDef.Location = filename;
							document.Filename = filename;
							var modNode = documentTabService.DocumentTreeView.FindNode(document.ModuleDef) as ModuleDocumentNode;
							Debug.Assert(modNode != null);
							if (modNode != null) {
								modNode.TreeNode.RefreshUI();
								documentTabService.RefreshModifiedDocument(modNode.Document);
							}
						}
					}
				}
			}
			return allSaved;
		}
Пример #7
0
		static bool MarkAsSaved(SaveMultiModuleVM vm, IUndoObject[] objs) {
			bool setNewFileName = false;
			bool allSaved = true;
			foreach (var obj in objs) {
				if (!vm.WasSaved(obj))
					allSaved = false;
				else {
					UndoCommandManager.Instance.MarkAsSaved(obj);
					var file = UndoCommandManager.Instance.TryGetDnSpyFile(obj);
					if (file != null && string.IsNullOrEmpty(file.Filename)) {
						var filename = vm.GetSavedFileName(obj);
						if (!string.IsNullOrWhiteSpace(filename) && file.ModuleDef != null) {
							file.ModuleDef.Location = filename;
							file.Filename = filename;
							setNewFileName = true;
							var asmNode = MainWindow.Instance.FindTreeNode(file.ModuleDef) as AssemblyTreeNode;
							Debug.Assert(asmNode != null);
							if (asmNode != null) {
								asmNode.OnFileNameChanged();
								Utils.NotifyModifiedAssembly(file);
							}
						}
					}
				}
			}
			if (setNewFileName)
				MainWindow.Instance.DnSpyFileListManager.RefreshSave(MainWindow.Instance.DnSpyFileList);
			return allSaved;
		}
Пример #8
0
		bool MarkAsSaved(SaveMultiModuleVM vm, object[] docs) {
			bool allSaved = true;
			foreach (var doc in docs) {
				if (!vm.WasSaved(doc))
					allSaved = false;
				else {
					undoCommandManager.Value.MarkAsSaved(undoCommandManager.Value.GetUndoObject(doc));
					var file = doc as IDnSpyFile;
					if (file != null && string.IsNullOrEmpty(file.Filename)) {
						var filename = vm.GetSavedFileName(doc);
						if (!string.IsNullOrWhiteSpace(filename) && file.ModuleDef != null) {
							file.ModuleDef.Location = filename;
							file.Filename = filename;
							var modNode = fileTabManager.FileTreeView.FindNode(file.ModuleDef) as IModuleFileNode;
							Debug.Assert(modNode != null);
							if (modNode != null) {
								modNode.TreeNode.RefreshUI();
								fileTabManager.RefreshModifiedFile(modNode.DnSpyFile);
							}
						}
					}
				}
			}
			return allSaved;
		}