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

View File

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

View File

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

View File

@ -1228,10 +1228,9 @@ namespace BizHawk.MultiClient
}
else if (file.Extension.ToLower() == ".xml")
{
var XMLG = XmlGame.Create(file);
if (XMLG != null)
try
{
var XMLG = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML????????
game = XMLG.GI;
switch (game.System)
@ -1256,9 +1255,11 @@ namespace BizHawk.MultiClient
default:
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
{