private bool Save()
{
if (stage == null) // new
{
try
{
stage = project.AddStage(nameField.Text, tilesetField.Text);
}
catch (Exception)
{
MessageBox.Show("There was an error creating the stage.\nPerhaps your tileset path is incorrect?", "CME Level Editor", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
}
else
{
stage.Name = nameField.Text;
try
{
stage.ChangeTileset(tilesetField.Text);
}
catch
{
MessageBox.Show("The tileset specified could not be loaded. Sorry.", "CME Project Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
if (introField.Text != "") stage.MusicIntro = FilePath.FromAbsolute(introField.Text, stage.Path.BasePath);
if (loopField.Text != "") stage.MusicLoop = FilePath.FromAbsolute(loopField.Text, stage.Path.BasePath);
return true;
}