//save current map public void SaveMap(string filePath, bool currentMap) { if (MapSaveAble()) { if (currentMap) { MapSystemWorld.WorldSave(filePath + " //cursave.world", true); } else { string saveName = string.Format("{0}Maps//{1}.world", filePath, Path.GetFileNameWithoutExtension(Map.Instance.SourceMapVirtualFileName)); MapSystemWorld.MapSave(saveName, true); } } }
public bool Save(string virtualPathByReal) { bool result; using (new CursorKeeper(Cursors.WaitCursor)) { if (string.IsNullOrEmpty(virtualPathByReal)) { string p = ChooseSavePath(); if (p == null) { return(false); } virtualPathByReal = VirtualFileSystem.GetVirtualPathByReal(p); if (string.IsNullOrEmpty(virtualPathByReal)) { Log.Warning(ToolsLocalization.Translate("Various", "Unable to save file. You cannot save map outside \"Data\" directory.")); result = false; return(result); } } EntityWorld.Instance.ResetBeforeMapSave(); UndoSystem.Instance.Clear(); Map.Instance.GetDataForEditor().ClearDeletedEntities(); bool flag; try { MainForm.Instance.WatchFileSystem = false; flag = MapSystemWorld.MapSave(virtualPathByReal, true); } finally { MainForm.Instance.WatchFileSystem = true; } if (!flag) { result = false; } else { Modified = false; result = true; } MainForm.Instance.NotifyUpdate(false); // Save } return(result); }