private void saveToolStripMenuItem_Click(object sender, EventArgs e) { if (_map == null) { return; } byte[] mapState = _map.GetState(); MapSaver.Save("Map.txt", mapState); }
public bool SaveMap(Map map, bool saveAs = false) { Debug.Assert(map != null); if (CurrentMapFile == null || saveAs) { var saveFileDialog = new SaveFileDialog { DefaultExt = ".xml", Filter = Resources.MapFileFilter, InitialDirectory = Path.GetDirectoryName(CurrentMapFile) ?? "" }; if (saveFileDialog.ShowDialog() == DialogResult.Cancel) { return(false); } CurrentMapFile = saveFileDialog.FileName; } MapSaver.Save(CurrentMapFile, map); StatusBarMessage("Map saved."); return(true); }
/// <summary> /// The function that save the map after the rename panel /// </summary> /// <param name="mapName"></param> public void SaveMap(string mapName) { MapSaver mapSaver = new MapSaver(ConvertGridToMap()); mapSaver.Save(mapName, true); }