// Saves the current map to a current name
private void Save()
{
if (curSaved == SavedSelection.SAVE)
{
MapEngine.Serialize(FileURL);
UpdateWindowTitle(Path.GetFileName(FileURL));
curSaved = SavedSelection.SAVED;
}
else
SaveAs();
}
// Saves the current map to a new name
private void SaveAs()
{
SaveFileDialog sfDialog = new SaveFileDialog();
if (!Directory.Exists(@".\Maps"))
Directory.CreateDirectory(@".\Maps");
sfDialog.InitialDirectory = @".\Maps";
sfDialog.Title = "Save As";
sfDialog.Filter = ".dat Files (*.dat)|*.dat|All Files (*.*)|*.*";
sfDialog.RestoreDirectory = true;
if (sfDialog.ShowDialog() == DialogResult.OK)
{
MapEngine.Serialize(sfDialog.FileName);
FileURL = sfDialog.FileName;
UpdateWindowTitle(Path.GetFileName(sfDialog.FileName));
curSaved = SavedSelection.SAVED;
}
}