コード例 #1
0
        private void LanMakerButtonSave_Click(object sender, EventArgs e)
        {
            using var dialog = new SaveFileDialog()
                  {
                      AddExtension                 = true,
                      AutoUpgradeEnabled           = true,
                      CheckPathExists              = true,
                      DefaultExt                   = ".end",
                      Filter                       = "Endscript Files|*.end",
                      OverwritePrompt              = true,
                      SupportMultiDottedExtensions = true,
                      Title = "Select directory and filename of the endscript to be saved",
                  };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var directory = this.LanMakerTextBoxDir.Text;
                var game      = this.LanMakerGame.Text;
                var usage     = this.LanMakerUsage.Text;
                var launch    = Utils.GenerateSample(directory, game, usage);
                Launch.Serialize(dialog.FileName, launch);
                MessageBox.Show($"File {dialog.FileName} has been saved.", "Success",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.WasCreated = true;
                this.NewLanPath = dialog.FileName;
            }
        }