small improvements to MultiDiskBundler
This commit is contained in:
parent
995993357f
commit
3fd7e11f60
src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler
|
@ -28,173 +28,187 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.MultiDiskMenuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.SaveRunButton = new System.Windows.Forms.Button();
|
||||
this.CancelBtn = new System.Windows.Forms.Button();
|
||||
this.grpName = new System.Windows.Forms.GroupBox();
|
||||
this.BrowseBtn = new System.Windows.Forms.Button();
|
||||
this.NameBox = new System.Windows.Forms.TextBox();
|
||||
this.FileSelectorPanel = new System.Windows.Forms.Panel();
|
||||
this.AddButton = new System.Windows.Forms.Button();
|
||||
this.SystemDropDown = new System.Windows.Forms.ComboBox();
|
||||
this.SystemLabel = new BizHawk.WinForms.Controls.LocLabelEx();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.grpName.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MultiDiskMenuStrip
|
||||
//
|
||||
this.MultiDiskMenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.MultiDiskMenuStrip.Name = "MultiDiskMenuStrip";
|
||||
this.MultiDiskMenuStrip.Size = new System.Drawing.Size(506, 24);
|
||||
this.MultiDiskMenuStrip.TabIndex = 0;
|
||||
this.MultiDiskMenuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// SaveRunButton
|
||||
//
|
||||
this.SaveRunButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SaveRunButton.Enabled = false;
|
||||
this.SaveRunButton.Location = new System.Drawing.Point(343, 329);
|
||||
this.SaveRunButton.Name = "SaveRunButton";
|
||||
this.SaveRunButton.Size = new System.Drawing.Size(85, 23);
|
||||
this.SaveRunButton.TabIndex = 9;
|
||||
this.SaveRunButton.Text = "&Save and Run";
|
||||
this.SaveRunButton.UseVisualStyleBackColor = true;
|
||||
this.SaveRunButton.Click += new System.EventHandler(this.SaveRunButton_Click);
|
||||
//
|
||||
// CancelBtn
|
||||
//
|
||||
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CancelBtn.Location = new System.Drawing.Point(434, 329);
|
||||
this.CancelBtn.Name = "CancelBtn";
|
||||
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
|
||||
this.CancelBtn.TabIndex = 10;
|
||||
this.CancelBtn.Text = "&Cancel";
|
||||
this.CancelBtn.UseVisualStyleBackColor = true;
|
||||
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
|
||||
//
|
||||
// grpName
|
||||
//
|
||||
this.grpName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.MultiDiskMenuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.SaveRunButton = new System.Windows.Forms.Button();
|
||||
this.CancelBtn = new System.Windows.Forms.Button();
|
||||
this.grpName = new System.Windows.Forms.GroupBox();
|
||||
this.BrowseBtn = new System.Windows.Forms.Button();
|
||||
this.NameBox = new System.Windows.Forms.TextBox();
|
||||
this.FileSelectorPanel = new System.Windows.Forms.Panel();
|
||||
this.AddButton = new System.Windows.Forms.Button();
|
||||
this.SystemDropDown = new System.Windows.Forms.ComboBox();
|
||||
this.SystemLabel = new BizHawk.WinForms.Controls.LocLabelEx();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.SaveButton = new System.Windows.Forms.Button();
|
||||
this.grpName.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// MultiDiskMenuStrip
|
||||
//
|
||||
this.MultiDiskMenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.MultiDiskMenuStrip.Name = "MultiDiskMenuStrip";
|
||||
this.MultiDiskMenuStrip.Size = new System.Drawing.Size(506, 24);
|
||||
this.MultiDiskMenuStrip.TabIndex = 0;
|
||||
this.MultiDiskMenuStrip.Text = "menuStrip1";
|
||||
//
|
||||
// SaveRunButton
|
||||
//
|
||||
this.SaveRunButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SaveRunButton.Enabled = false;
|
||||
this.SaveRunButton.Location = new System.Drawing.Point(318, 329);
|
||||
this.SaveRunButton.Name = "SaveRunButton";
|
||||
this.SaveRunButton.Size = new System.Drawing.Size(85, 23);
|
||||
this.SaveRunButton.TabIndex = 9;
|
||||
this.SaveRunButton.Text = "Save and &Run";
|
||||
this.SaveRunButton.UseVisualStyleBackColor = true;
|
||||
this.SaveRunButton.Click += new System.EventHandler(this.SaveRunButton_Click);
|
||||
//
|
||||
// CancelBtn
|
||||
//
|
||||
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CancelBtn.Location = new System.Drawing.Point(409, 329);
|
||||
this.CancelBtn.Name = "CancelBtn";
|
||||
this.CancelBtn.Size = new System.Drawing.Size(85, 23);
|
||||
this.CancelBtn.TabIndex = 10;
|
||||
this.CancelBtn.Text = "&Close";
|
||||
this.CancelBtn.UseVisualStyleBackColor = true;
|
||||
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
|
||||
//
|
||||
// grpName
|
||||
//
|
||||
this.grpName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.grpName.Controls.Add(this.BrowseBtn);
|
||||
this.grpName.Controls.Add(this.NameBox);
|
||||
this.grpName.Location = new System.Drawing.Point(8, 28);
|
||||
this.grpName.Name = "grpName";
|
||||
this.grpName.Size = new System.Drawing.Size(486, 45);
|
||||
this.grpName.TabIndex = 11;
|
||||
this.grpName.TabStop = false;
|
||||
this.grpName.Text = "Name";
|
||||
//
|
||||
// BrowseBtn
|
||||
//
|
||||
this.BrowseBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BrowseBtn.Location = new System.Drawing.Point(417, 18);
|
||||
this.BrowseBtn.Name = "BrowseBtn";
|
||||
this.BrowseBtn.Size = new System.Drawing.Size(63, 23);
|
||||
this.BrowseBtn.TabIndex = 14;
|
||||
this.BrowseBtn.Text = "Browse...";
|
||||
this.BrowseBtn.UseVisualStyleBackColor = true;
|
||||
this.BrowseBtn.Click += new System.EventHandler(this.BrowseBtn_Click);
|
||||
//
|
||||
// NameBox
|
||||
//
|
||||
this.NameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.grpName.Controls.Add(this.BrowseBtn);
|
||||
this.grpName.Controls.Add(this.NameBox);
|
||||
this.grpName.Location = new System.Drawing.Point(8, 28);
|
||||
this.grpName.Name = "grpName";
|
||||
this.grpName.Size = new System.Drawing.Size(486, 45);
|
||||
this.grpName.TabIndex = 11;
|
||||
this.grpName.TabStop = false;
|
||||
this.grpName.Text = "Name";
|
||||
//
|
||||
// BrowseBtn
|
||||
//
|
||||
this.BrowseBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.BrowseBtn.Location = new System.Drawing.Point(417, 18);
|
||||
this.BrowseBtn.Name = "BrowseBtn";
|
||||
this.BrowseBtn.Size = new System.Drawing.Size(63, 23);
|
||||
this.BrowseBtn.TabIndex = 14;
|
||||
this.BrowseBtn.Text = "Browse...";
|
||||
this.BrowseBtn.UseVisualStyleBackColor = true;
|
||||
this.BrowseBtn.Click += new System.EventHandler(this.BrowseBtn_Click);
|
||||
//
|
||||
// NameBox
|
||||
//
|
||||
this.NameBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.NameBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.NameBox.Name = "NameBox";
|
||||
this.NameBox.Size = new System.Drawing.Size(405, 20);
|
||||
this.NameBox.TabIndex = 0;
|
||||
this.NameBox.TextChanged += new System.EventHandler(this.NameBox_TextChanged);
|
||||
//
|
||||
// FileSelectorPanel
|
||||
//
|
||||
this.FileSelectorPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
this.NameBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.NameBox.Name = "NameBox";
|
||||
this.NameBox.Size = new System.Drawing.Size(405, 20);
|
||||
this.NameBox.TabIndex = 0;
|
||||
this.NameBox.TextChanged += new System.EventHandler(this.NameBox_TextChanged);
|
||||
//
|
||||
// FileSelectorPanel
|
||||
//
|
||||
this.FileSelectorPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.FileSelectorPanel.AutoScroll = true;
|
||||
this.FileSelectorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.FileSelectorPanel.Location = new System.Drawing.Point(8, 101);
|
||||
this.FileSelectorPanel.Name = "FileSelectorPanel";
|
||||
this.FileSelectorPanel.Size = new System.Drawing.Size(486, 222);
|
||||
this.FileSelectorPanel.TabIndex = 12;
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.AddButton.Location = new System.Drawing.Point(8, 329);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(60, 23);
|
||||
this.AddButton.TabIndex = 13;
|
||||
this.AddButton.Text = "Add";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
// SystemDropDown
|
||||
//
|
||||
this.SystemDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SystemDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.SystemDropDown.FormattingEnabled = true;
|
||||
this.SystemDropDown.Items.AddRange(new object[] {
|
||||
this.FileSelectorPanel.AutoScroll = true;
|
||||
this.FileSelectorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.FileSelectorPanel.Location = new System.Drawing.Point(8, 101);
|
||||
this.FileSelectorPanel.Name = "FileSelectorPanel";
|
||||
this.FileSelectorPanel.Size = new System.Drawing.Size(486, 214);
|
||||
this.FileSelectorPanel.TabIndex = 12;
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.AddButton.Location = new System.Drawing.Point(8, 329);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(60, 23);
|
||||
this.AddButton.TabIndex = 13;
|
||||
this.AddButton.Text = "Add";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
// SystemDropDown
|
||||
//
|
||||
this.SystemDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SystemDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.SystemDropDown.FormattingEnabled = true;
|
||||
this.SystemDropDown.Items.AddRange(new object[] {
|
||||
"AppleII",
|
||||
"C64",
|
||||
"DGB",
|
||||
"GB3x",
|
||||
"GB4x",
|
||||
"GEN",
|
||||
"PCFX",
|
||||
"GB3x",
|
||||
"GB4x",
|
||||
"GEN",
|
||||
"PCFX",
|
||||
"PSX",
|
||||
"SAT",
|
||||
"ZXSpectrum",
|
||||
"AmstradCPC",
|
||||
"Game Gear"});
|
||||
this.SystemDropDown.Location = new System.Drawing.Point(405, 75);
|
||||
this.SystemDropDown.Name = "SystemDropDown";
|
||||
this.SystemDropDown.Size = new System.Drawing.Size(89, 21);
|
||||
this.SystemDropDown.TabIndex = 14;
|
||||
this.SystemDropDown.SelectedIndexChanged += new System.EventHandler(this.SystemDropDown_SelectedIndexChanged);
|
||||
//
|
||||
// SystemLabel
|
||||
//
|
||||
this.SystemLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SystemLabel.Location = new System.Drawing.Point(355, 78);
|
||||
this.SystemLabel.Name = "SystemLabel";
|
||||
this.SystemLabel.Text = "System:";
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnRemove.Location = new System.Drawing.Point(74, 329);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(60, 23);
|
||||
this.btnRemove.TabIndex = 16;
|
||||
this.btnRemove.Text = "Remove";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
|
||||
//
|
||||
// MultiDiskBundler
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(506, 364);
|
||||
this.Controls.Add(this.btnRemove);
|
||||
this.Controls.Add(this.SystemLabel);
|
||||
this.Controls.Add(this.SystemDropDown);
|
||||
this.Controls.Add(this.AddButton);
|
||||
this.Controls.Add(this.FileSelectorPanel);
|
||||
this.Controls.Add(this.grpName);
|
||||
this.Controls.Add(this.CancelBtn);
|
||||
this.Controls.Add(this.SaveRunButton);
|
||||
this.Controls.Add(this.MultiDiskMenuStrip);
|
||||
this.MainMenuStrip = this.MultiDiskMenuStrip;
|
||||
this.Name = "MultiDiskBundler";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Load += new System.EventHandler(this.MultiGameCreator_Load);
|
||||
this.grpName.ResumeLayout(false);
|
||||
this.grpName.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.SystemDropDown.Location = new System.Drawing.Point(405, 75);
|
||||
this.SystemDropDown.Name = "SystemDropDown";
|
||||
this.SystemDropDown.Size = new System.Drawing.Size(89, 21);
|
||||
this.SystemDropDown.TabIndex = 14;
|
||||
this.SystemDropDown.SelectedIndexChanged += new System.EventHandler(this.SystemDropDown_SelectedIndexChanged);
|
||||
//
|
||||
// SystemLabel
|
||||
//
|
||||
this.SystemLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SystemLabel.Location = new System.Drawing.Point(355, 78);
|
||||
this.SystemLabel.Name = "SystemLabel";
|
||||
this.SystemLabel.Text = "System:";
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.btnRemove.Location = new System.Drawing.Point(74, 329);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(60, 23);
|
||||
this.btnRemove.TabIndex = 16;
|
||||
this.btnRemove.Text = "Remove";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
|
||||
//
|
||||
// SaveButton
|
||||
//
|
||||
this.SaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.SaveButton.Enabled = false;
|
||||
this.SaveButton.Location = new System.Drawing.Point(227, 329);
|
||||
this.SaveButton.Name = "SaveButton";
|
||||
this.SaveButton.Size = new System.Drawing.Size(85, 23);
|
||||
this.SaveButton.TabIndex = 18;
|
||||
this.SaveButton.Text = "&Save";
|
||||
this.SaveButton.UseVisualStyleBackColor = true;
|
||||
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
|
||||
//
|
||||
// MultiDiskBundler
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(506, 364);
|
||||
this.Controls.Add(this.SaveButton);
|
||||
this.Controls.Add(this.btnRemove);
|
||||
this.Controls.Add(this.SystemLabel);
|
||||
this.Controls.Add(this.SystemDropDown);
|
||||
this.Controls.Add(this.AddButton);
|
||||
this.Controls.Add(this.FileSelectorPanel);
|
||||
this.Controls.Add(this.grpName);
|
||||
this.Controls.Add(this.CancelBtn);
|
||||
this.Controls.Add(this.SaveRunButton);
|
||||
this.Controls.Add(this.MultiDiskMenuStrip);
|
||||
this.MainMenuStrip = this.MultiDiskMenuStrip;
|
||||
this.Name = "MultiDiskBundler";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Load += new System.EventHandler(this.MultiGameCreator_Load);
|
||||
this.grpName.ResumeLayout(false);
|
||||
this.grpName.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -211,5 +225,6 @@
|
|||
private System.Windows.Forms.ComboBox SystemDropDown;
|
||||
private BizHawk.WinForms.Controls.LocLabelEx SystemLabel;
|
||||
private System.Windows.Forms.Button btnRemove;
|
||||
private System.Windows.Forms.Button SaveButton;
|
||||
}
|
||||
}
|
|
@ -74,28 +74,45 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
bool DoSave(out FileInfo fileInfo)
|
||||
{
|
||||
fileInfo = null;
|
||||
|
||||
if (!Recalculate())
|
||||
return false;
|
||||
|
||||
fileInfo = new FileInfo(NameBox.Text);
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
var result = MessageBox.Show(this, "File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||
if (result != DialogResult.OK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllText(fileInfo.FullName, _currentXml.ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SaveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
FileInfo dummy;
|
||||
DoSave(out dummy);
|
||||
}
|
||||
|
||||
private void SaveRunButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Recalculate())
|
||||
{
|
||||
var fileInfo = new FileInfo(NameBox.Text);
|
||||
if (fileInfo.Exists)
|
||||
{
|
||||
var result = MessageBox.Show(this, "File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||
if (result != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
FileInfo fileInfo;
|
||||
|
||||
File.WriteAllText(fileInfo.FullName, _currentXml.ToString());
|
||||
if (!DoSave(out fileInfo))
|
||||
return;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
|
||||
var lra = new LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = fileInfo.FullName } };
|
||||
MainForm.LoadRom(fileInfo.FullName, lra);
|
||||
}
|
||||
var lra = new LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = fileInfo.FullName } };
|
||||
MainForm.LoadRom(fileInfo.FullName, lra);
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, EventArgs e)
|
||||
|
@ -141,6 +158,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
//One to our looper
|
||||
i++;
|
||||
}
|
||||
|
||||
Recalculate();
|
||||
}
|
||||
|
||||
private void FileSelector_NameChanged(object sender, EventArgs e)
|
||||
|
@ -159,6 +178,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var names = FileSelectors.Select(f => f.Path).ToList();
|
||||
|
||||
if (names.Count == 0)
|
||||
goto BAIL;
|
||||
|
||||
var name = NameBox.Text;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
|
@ -194,18 +216,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
"Asset",
|
||||
new XAttribute("FileName", GetRelativePath(basePath, n))
|
||||
))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
SaveRunButton.Enabled = true;
|
||||
SaveButton.Enabled = true;
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_currentXml = null;
|
||||
SaveRunButton.Enabled = false;
|
||||
return false;
|
||||
//swallow exceptions, since this is just validation logic
|
||||
}
|
||||
|
||||
BAIL:
|
||||
_currentXml = null;
|
||||
SaveRunButton.Enabled = false;
|
||||
SaveButton.Enabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void NameBox_TextChanged(object sender, EventArgs e)
|
||||
|
@ -297,5 +324,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
AddButton_Click(null, null);
|
||||
AddButton_Click(null, null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue