From b11a76f73925cdfdf00b005f01470c228428175e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 4 Dec 2016 12:34:37 -0600 Subject: [PATCH] MultidiskBundler - add a RequiredService of IEmulator and use that property instead of Global.Emulator --- .../tools/MultiDiskBundler/MultiDiskBundler.cs | 15 +++++++++------ .../MultiDiskBundler/MultiDiskFileSelector.cs | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs index 1cf3b86494..df6896401a 100644 --- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs +++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs @@ -1,7 +1,5 @@ -using BizHawk.Client.Common; -using System; +using System; using System.Collections.Generic; -using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; @@ -10,8 +8,10 @@ using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; using System.Xml.Linq; -using BizHawk.Client.EmuHawk.WinFormExtensions; + using BizHawk.Emulation.Common; +using BizHawk.Client.Common; +using BizHawk.Client.EmuHawk.WinFormExtensions; namespace BizHawk.Client.EmuHawk { @@ -19,6 +19,9 @@ namespace BizHawk.Client.EmuHawk { private XElement _currentXml = null; + [RequiredService] + public IEmulator Emulator { get; set; } + public MultiDiskBundler() { InitializeComponent(); @@ -46,9 +49,9 @@ namespace BizHawk.Client.EmuHawk NameBox.Text = Path.ChangeExtension(GlobalWin.MainForm.CurrentlyOpenRom, ".xml"); } - if (SystemDropDown.Items.Contains(Global.Emulator.SystemId)) + if (SystemDropDown.Items.Contains(Emulator.SystemId)) { - SystemDropDown.SelectedItem = Global.Emulator.SystemId; + SystemDropDown.SelectedItem = Emulator.SystemId; } FileSelectors.First().SetName(GlobalWin.MainForm.CurrentlyOpenRom); diff --git a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs index c6d57470bf..14f9a83521 100644 --- a/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs +++ b/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskFileSelector.cs @@ -104,8 +104,8 @@ namespace BizHawk.Client.EmuHawk public void UpdateValues() { - UseCurrentRomButton.Enabled = Global.Emulator != null // For the designer - && !string.IsNullOrEmpty(GlobalWin.MainForm.CurrentlyOpenRom) + UseCurrentRomButton.Enabled = + !string.IsNullOrEmpty(GlobalWin.MainForm.CurrentlyOpenRom) && !GlobalWin.MainForm.CurrentlyOpenRom.Contains(".xml"); // Can't already be an xml }