move xmlgame to client.common and refactor it a bit in order to achieve that

This commit is contained in:
adelikat 2013-10-25 17:08:18 +00:00
parent 0edfc03e34
commit 40f143e4ad
4 changed files with 13 additions and 12 deletions

View File

@ -33,6 +33,9 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\Newtonsoft.Json.dll</HintPath> <HintPath>..\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@ -112,6 +115,7 @@
<Compile Include="tools\RamSearchEngine.cs" /> <Compile Include="tools\RamSearchEngine.cs" />
<Compile Include="tools\Watch.cs" /> <Compile Include="tools\Watch.cs" />
<Compile Include="tools\WatchList.cs" /> <Compile Include="tools\WatchList.cs" />
<Compile Include="XmlGame.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\BizHawk.Common\BizHawk.Common.csproj"> <ProjectReference Include="..\BizHawk.Common\BizHawk.Common.csproj">

View File

@ -5,9 +5,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
using BizHawk.Client.Common; namespace BizHawk.Client.Common
namespace BizHawk.MultiClient
{ {
public class XmlGame public class XmlGame
{ {
@ -96,10 +94,9 @@ namespace BizHawk.MultiClient
} }
return ret; return ret;
} }
catch (Exception e) catch(Exception ex)
{ {
System.Windows.Forms.MessageBox.Show(e.ToString(), "XMLGame Load Error"); throw new InvalidOperationException(ex.ToString());
return null;
} }
} }

View File

@ -737,7 +737,6 @@
<Compile Include="tools\Watch\WatchValueBox.cs"> <Compile Include="tools\Watch\WatchValueBox.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="XmlGame.cs" />
<EmbeddedResource Include="AVOut\FFmpegWriterForm.resx"> <EmbeddedResource Include="AVOut\FFmpegWriterForm.resx">
<DependentUpon>FFmpegWriterForm.cs</DependentUpon> <DependentUpon>FFmpegWriterForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

View File

@ -1228,10 +1228,9 @@ namespace BizHawk.MultiClient
} }
else if (file.Extension.ToLower() == ".xml") else if (file.Extension.ToLower() == ".xml")
{ {
var XMLG = XmlGame.Create(file); try
if (XMLG != null)
{ {
var XMLG = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML????????
game = XMLG.GI; game = XMLG.GI;
switch (game.System) switch (game.System)
@ -1256,9 +1255,11 @@ namespace BizHawk.MultiClient
default: default:
return false; return false;
} }
} }
// if load fails, are we supposed to retry as a bsnes XML???????? catch(Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString(), "XMLGame Load Error");
}
} }
else // most extensions else // most extensions
{ {