예제 #1
0
파일: Saver.cs 프로젝트: jorik041/dnSpy
        static bool MarkAsSaved(SaveMultiModuleVM vm, LoadedAssembly[] asms)
        {
            bool setNewFileName = false;
            bool allSaved       = true;

            foreach (var asm in asms)
            {
                if (!vm.WasSaved(asm.ModuleDefinition))
                {
                    allSaved = false;
                }
                else
                {
                    UndoCommandManager.Instance.MarkAsSaved(asm);
                    if (string.IsNullOrEmpty(asm.FileName))
                    {
                        var filename = vm.GetSavedFileName(asm.ModuleDefinition);
                        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);
        }
예제 #2
0
파일: Saver.cs 프로젝트: BahNahNah/dnSpy
 static bool MarkAsSaved(SaveMultiModuleVM vm, LoadedAssembly[] asms)
 {
     bool setNewFileName = false;
     bool allSaved = true;
     foreach (var asm in asms) {
         if (!vm.WasSaved(asm.ModuleDefinition))
             allSaved = false;
         else {
             UndoCommandManager.Instance.MarkAsSaved(asm);
             if (string.IsNullOrEmpty(asm.FileName)) {
                 var filename = vm.GetSavedFileName(asm.ModuleDefinition);
                 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;
 }