small improvements to MultiDiskBundler
This commit is contained in:
parent
995993357f
commit
3fd7e11f60
|
@ -39,6 +39,7 @@
|
||||||
this.SystemDropDown = new System.Windows.Forms.ComboBox();
|
this.SystemDropDown = new System.Windows.Forms.ComboBox();
|
||||||
this.SystemLabel = new BizHawk.WinForms.Controls.LocLabelEx();
|
this.SystemLabel = new BizHawk.WinForms.Controls.LocLabelEx();
|
||||||
this.btnRemove = new System.Windows.Forms.Button();
|
this.btnRemove = new System.Windows.Forms.Button();
|
||||||
|
this.SaveButton = new System.Windows.Forms.Button();
|
||||||
this.grpName.SuspendLayout();
|
this.grpName.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -54,11 +55,11 @@
|
||||||
//
|
//
|
||||||
this.SaveRunButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.SaveRunButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.SaveRunButton.Enabled = false;
|
this.SaveRunButton.Enabled = false;
|
||||||
this.SaveRunButton.Location = new System.Drawing.Point(343, 329);
|
this.SaveRunButton.Location = new System.Drawing.Point(318, 329);
|
||||||
this.SaveRunButton.Name = "SaveRunButton";
|
this.SaveRunButton.Name = "SaveRunButton";
|
||||||
this.SaveRunButton.Size = new System.Drawing.Size(85, 23);
|
this.SaveRunButton.Size = new System.Drawing.Size(85, 23);
|
||||||
this.SaveRunButton.TabIndex = 9;
|
this.SaveRunButton.TabIndex = 9;
|
||||||
this.SaveRunButton.Text = "&Save and Run";
|
this.SaveRunButton.Text = "Save and &Run";
|
||||||
this.SaveRunButton.UseVisualStyleBackColor = true;
|
this.SaveRunButton.UseVisualStyleBackColor = true;
|
||||||
this.SaveRunButton.Click += new System.EventHandler(this.SaveRunButton_Click);
|
this.SaveRunButton.Click += new System.EventHandler(this.SaveRunButton_Click);
|
||||||
//
|
//
|
||||||
|
@ -66,11 +67,11 @@
|
||||||
//
|
//
|
||||||
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
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.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.CancelBtn.Location = new System.Drawing.Point(434, 329);
|
this.CancelBtn.Location = new System.Drawing.Point(409, 329);
|
||||||
this.CancelBtn.Name = "CancelBtn";
|
this.CancelBtn.Name = "CancelBtn";
|
||||||
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
|
this.CancelBtn.Size = new System.Drawing.Size(85, 23);
|
||||||
this.CancelBtn.TabIndex = 10;
|
this.CancelBtn.TabIndex = 10;
|
||||||
this.CancelBtn.Text = "&Cancel";
|
this.CancelBtn.Text = "&Close";
|
||||||
this.CancelBtn.UseVisualStyleBackColor = true;
|
this.CancelBtn.UseVisualStyleBackColor = true;
|
||||||
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
|
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
|
||||||
//
|
//
|
||||||
|
@ -117,7 +118,7 @@
|
||||||
this.FileSelectorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.FileSelectorPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.FileSelectorPanel.Location = new System.Drawing.Point(8, 101);
|
this.FileSelectorPanel.Location = new System.Drawing.Point(8, 101);
|
||||||
this.FileSelectorPanel.Name = "FileSelectorPanel";
|
this.FileSelectorPanel.Name = "FileSelectorPanel";
|
||||||
this.FileSelectorPanel.Size = new System.Drawing.Size(486, 222);
|
this.FileSelectorPanel.Size = new System.Drawing.Size(486, 214);
|
||||||
this.FileSelectorPanel.TabIndex = 12;
|
this.FileSelectorPanel.TabIndex = 12;
|
||||||
//
|
//
|
||||||
// AddButton
|
// AddButton
|
||||||
|
@ -173,11 +174,24 @@
|
||||||
this.btnRemove.UseVisualStyleBackColor = true;
|
this.btnRemove.UseVisualStyleBackColor = true;
|
||||||
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
|
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
|
// MultiDiskBundler
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(506, 364);
|
this.ClientSize = new System.Drawing.Size(506, 364);
|
||||||
|
this.Controls.Add(this.SaveButton);
|
||||||
this.Controls.Add(this.btnRemove);
|
this.Controls.Add(this.btnRemove);
|
||||||
this.Controls.Add(this.SystemLabel);
|
this.Controls.Add(this.SystemLabel);
|
||||||
this.Controls.Add(this.SystemDropDown);
|
this.Controls.Add(this.SystemDropDown);
|
||||||
|
@ -211,5 +225,6 @@
|
||||||
private System.Windows.Forms.ComboBox SystemDropDown;
|
private System.Windows.Forms.ComboBox SystemDropDown;
|
||||||
private BizHawk.WinForms.Controls.LocLabelEx SystemLabel;
|
private BizHawk.WinForms.Controls.LocLabelEx SystemLabel;
|
||||||
private System.Windows.Forms.Button btnRemove;
|
private System.Windows.Forms.Button btnRemove;
|
||||||
|
private System.Windows.Forms.Button SaveButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -74,21 +74,39 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveRunButton_Click(object sender, EventArgs e)
|
bool DoSave(out FileInfo fileInfo)
|
||||||
{
|
{
|
||||||
if (Recalculate())
|
fileInfo = null;
|
||||||
{
|
|
||||||
var fileInfo = new FileInfo(NameBox.Text);
|
if (!Recalculate())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fileInfo = new FileInfo(NameBox.Text);
|
||||||
if (fileInfo.Exists)
|
if (fileInfo.Exists)
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show(this, "File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
var result = MessageBox.Show(this, "File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
|
||||||
if (result != DialogResult.OK)
|
if (result != DialogResult.OK)
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllText(fileInfo.FullName, _currentXml.ToString());
|
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)
|
||||||
|
{
|
||||||
|
FileInfo fileInfo;
|
||||||
|
|
||||||
|
if (!DoSave(out fileInfo))
|
||||||
|
return;
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
|
@ -96,7 +114,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var lra = new LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = fileInfo.FullName } };
|
var lra = new LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom { Path = fileInfo.FullName } };
|
||||||
MainForm.LoadRom(fileInfo.FullName, lra);
|
MainForm.LoadRom(fileInfo.FullName, lra);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void AddButton_Click(object sender, EventArgs e)
|
private void AddButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -141,6 +158,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
//One to our looper
|
//One to our looper
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Recalculate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FileSelector_NameChanged(object sender, EventArgs e)
|
private void FileSelector_NameChanged(object sender, EventArgs e)
|
||||||
|
@ -159,6 +178,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
var names = FileSelectors.Select(f => f.Path).ToList();
|
var names = FileSelectors.Select(f => f.Path).ToList();
|
||||||
|
|
||||||
|
if (names.Count == 0)
|
||||||
|
goto BAIL;
|
||||||
|
|
||||||
var name = NameBox.Text;
|
var name = NameBox.Text;
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
@ -198,15 +220,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
);
|
);
|
||||||
|
|
||||||
SaveRunButton.Enabled = true;
|
SaveRunButton.Enabled = true;
|
||||||
|
SaveButton.Enabled = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
//swallow exceptions, since this is just validation logic
|
||||||
|
}
|
||||||
|
|
||||||
|
BAIL:
|
||||||
_currentXml = null;
|
_currentXml = null;
|
||||||
SaveRunButton.Enabled = false;
|
SaveRunButton.Enabled = false;
|
||||||
|
SaveButton.Enabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void NameBox_TextChanged(object sender, EventArgs e)
|
private void NameBox_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -297,5 +324,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AddButton_Click(null, null);
|
AddButton_Click(null, null);
|
||||||
AddButton_Click(null, null);
|
AddButton_Click(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue