Bounce.LevelEditor.Editor.mi_Save_As_Click C# (CSharp) Метод

mi_Save_As_Click() приватный Метод

private mi_Save_As_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void mi_Save_As_Click(object sender, EventArgs e)
        {
            if (currentState != State.NO_EDITS)
            {
                verifyInvariants(false);

                //Allow the user to choose a name and a location
                SaveFileDialog dialog = new SaveFileDialog();

                if (currentState == State.EDITING_WORLD)
                {
                    dialog.Filter = "World Files | *.world";
                }
                else
                {
                    dialog.Filter = "Room Files | *.room";
                }

                dialog.InitialDirectory = ".";
                dialog.Title = "Choose the file to save.";

                DialogResult result = dialog.ShowDialog();

                //If the result was ok, load the resultant file, otherwise, just return.
                if (result == DialogResult.OK)
                {
                    if (currentState == State.EDITING_WORLD)
                    {
                        Serializer.Serialize(world, dialog.FileName);
                    }
                    else
                    {
                        Serializer.SerializeRoom(currentlySelectedRoom, dialog.FileName);
                    }

                    currentFileName = dialog.FileName;
                }
            }
        }