diff --git a/DATabase/DATabase.cs b/DATabase/DATabase.cs
index 47143b0e..b681a4fe 100644
--- a/DATabase/DATabase.cs
+++ b/DATabase/DATabase.cs
@@ -16,10 +16,9 @@ namespace SabreTools
private static Logger logger;
private static string _dbName = "DATabase.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
- private static string _version = "0.3.0.0";
private static string _header =
@"+-----------------------------------------------------------------------------+
-| DATabase " + _version + @" |
+| DATabase " + Build.Version + @" |
| |
| Programming: Matt Nadareski (darksabre76) |
| Testing: @tractivo |
@@ -656,9 +655,9 @@ or 'b' to go back to the previous menu:
fs.Close();
Console.WriteLine("Converted file: " + Path.GetFileNameWithoutExtension(filename) + ".new.dat");
}
- catch (XmlException ex)
+ catch (XmlException)
{
- logger.Warning("The file " + filename + " could not be parsed as an XML file.");
+ logger.Warning("The file " + filename + " could not be parsed as an XML file");
}
}
else
diff --git a/DATabase/DATabase.csproj b/DATabase/DATabase.csproj
index 4f6638aa..3826e029 100644
--- a/DATabase/DATabase.csproj
+++ b/DATabase/DATabase.csproj
@@ -66,15 +66,10 @@
-
-
-
-
+
+
-
-
-
@@ -97,6 +92,12 @@
PreserveNewest
+
+
+ {225a1afd-0890-44e8-b779-7502665c23a5}
+ SabreHelper
+
+
diff --git a/DATabase/Core/Generate.cs b/DATabase/Generate.cs
similarity index 100%
rename from DATabase/Core/Generate.cs
rename to DATabase/Generate.cs
diff --git a/DATabase/Core/Import.cs b/DATabase/Import.cs
similarity index 99%
rename from DATabase/Core/Import.cs
rename to DATabase/Import.cs
index b80e52c3..88b6869e 100644
--- a/DATabase/Core/Import.cs
+++ b/DATabase/Import.cs
@@ -340,7 +340,7 @@ namespace SabreTools
{
doc.LoadXml(File.ReadAllText(_filepath));
}
- catch (XmlException ex)
+ catch (XmlException)
{
doc.LoadXml(Converters.RomVaultToXML(File.ReadAllLines(_filepath)).ToString());
}
diff --git a/DatSplit/DatSplit.cs b/DatSplit/DatSplit.cs
index 84c969e1..8c410dcf 100644
--- a/DatSplit/DatSplit.cs
+++ b/DatSplit/DatSplit.cs
@@ -14,7 +14,6 @@ namespace DatSplit
private static string extA;
private static string extB;
private static string filename;
- private static string _version = "0.3.0.0";
public static void Main(string[] args)
{
@@ -36,7 +35,7 @@ namespace DatSplit
{
doc.LoadXml(File.ReadAllText(filename));
}
- catch (XmlException ex)
+ catch (XmlException)
{
doc.LoadXml(Converters.RomVaultToXML(File.ReadAllLines(filename)).ToString());
}
diff --git a/DatSplit/DatSplit.csproj b/DatSplit/DatSplit.csproj
index 3b024aa3..dbb3d7a9 100644
--- a/DatSplit/DatSplit.csproj
+++ b/DatSplit/DatSplit.csproj
@@ -50,9 +50,9 @@
-
- {3b615702-1866-4d7b-8af1-7b43fd0cc1d0}
- DATabase
+
+ {225a1afd-0890-44e8-b779-7502665c23a5}
+ SabreHelper
diff --git a/Deheader/Headerer.cs b/Deheader/Headerer.cs
index 7d881bee..973a5779 100644
--- a/Deheader/Headerer.cs
+++ b/Deheader/Headerer.cs
@@ -13,7 +13,6 @@ namespace SabreTools
///
class Headerer
{
- private static string _version = "0.3.0.0";
private static string _dbName = "Headerer.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
private static Dictionary types;
diff --git a/Deheader/Headerer.csproj b/Deheader/Headerer.csproj
index bc37e97f..856b8446 100644
--- a/Deheader/Headerer.csproj
+++ b/Deheader/Headerer.csproj
@@ -73,6 +73,12 @@
+
+
+ {225a1afd-0890-44e8-b779-7502665c23a5}
+ SabreHelper
+
+
diff --git a/SabreHelper/App.config b/SabreHelper/App.config
new file mode 100644
index 00000000..764bdd32
--- /dev/null
+++ b/SabreHelper/App.config
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SabreHelper/Build.cs b/SabreHelper/Build.cs
new file mode 100644
index 00000000..85cc503d
--- /dev/null
+++ b/SabreHelper/Build.cs
@@ -0,0 +1,10 @@
+namespace SabreTools.Helper
+{
+ public class Build
+ {
+ public static string Version
+ {
+ get { return "0.3.0.0"; }
+ }
+ }
+}
diff --git a/DATabase/Helper/Converters.cs b/SabreHelper/Converters.cs
similarity index 100%
rename from DATabase/Helper/Converters.cs
rename to SabreHelper/Converters.cs
diff --git a/DATabase/Helper/DBTools.cs b/SabreHelper/DBTools.cs
similarity index 99%
rename from DATabase/Helper/DBTools.cs
rename to SabreHelper/DBTools.cs
index 30e54fcb..d1c63fff 100644
--- a/DATabase/Helper/DBTools.cs
+++ b/SabreHelper/DBTools.cs
@@ -7,7 +7,7 @@ namespace SabreTools.Helper
///
/// All general database operations
///
- class DBTools
+ public class DBTools
{
///
/// Ensure that the databse exists and has the proper schema
diff --git a/DATabase/Helper/Logger.cs b/SabreHelper/Logger.cs
similarity index 100%
rename from DATabase/Helper/Logger.cs
rename to SabreHelper/Logger.cs
diff --git a/SabreHelper/Properties/AssemblyInfo.cs b/SabreHelper/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..35fe16ea
--- /dev/null
+++ b/SabreHelper/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SabreHelper")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SabreHelper")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("225a1afd-0890-44e8-b779-7502665c23a5")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/DATabase/Helper/Remapping.cs b/SabreHelper/Remapping.cs
similarity index 99%
rename from DATabase/Helper/Remapping.cs
rename to SabreHelper/Remapping.cs
index 9d223456..8ac11740 100644
--- a/DATabase/Helper/Remapping.cs
+++ b/SabreHelper/Remapping.cs
@@ -8,7 +8,7 @@ namespace SabreTools.Helper
///
/// Contains all remappings of known import classes
///
- class Remapping
+ public class Remapping
{
// Remapping classes represented by dictionaries
public static Dictionary MAME = new Dictionary();
diff --git a/SabreHelper/SabreHelper.csproj b/SabreHelper/SabreHelper.csproj
new file mode 100644
index 00000000..1a776f5e
--- /dev/null
+++ b/SabreHelper/SabreHelper.csproj
@@ -0,0 +1,93 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {225A1AFD-0890-44E8-B779-7502665C23A5}
+ Library
+ Properties
+ SabreTools.Helper
+ SabreTools
+ v4.5.2
+ 512
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll
+ True
+
+
+ ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll
+ True
+
+
+
+
+
+ ..\packages\System.Data.SQLite.Core.1.0.99.0\lib\net451\System.Data.SQLite.dll
+ True
+
+
+ ..\packages\System.Data.SQLite.EF6.1.0.99.0\lib\net451\System.Data.SQLite.EF6.dll
+ True
+
+
+ ..\packages\System.Data.SQLite.Linq.1.0.99.0\lib\net451\System.Data.SQLite.Linq.dll
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
\ No newline at end of file
diff --git a/DATabase/Helper/Style.cs b/SabreHelper/Style.cs
similarity index 100%
rename from DATabase/Helper/Style.cs
rename to SabreHelper/Style.cs
diff --git a/SabreHelper/packages.config b/SabreHelper/packages.config
new file mode 100644
index 00000000..dac74cbf
--- /dev/null
+++ b/SabreHelper/packages.config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SabreTools.sln b/SabreTools.sln
index 6c8ab127..d5a36b6f 100644
--- a/SabreTools.sln
+++ b/SabreTools.sln
@@ -11,6 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreToolsUI", "SabreToolsU
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatSplit", "DatSplit\DatSplit.csproj", "{9EB4738D-CAE7-420D-8A26-78A53CEA5E82}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SingleGame", "SingleGame\SingleGame.csproj", "{07EB8EA7-303A-407F-A881-060ED4595D7F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreHelper", "SabreHelper\SabreHelper.csproj", "{225A1AFD-0890-44E8-B779-7502665C23A5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,6 +37,14 @@ Global
{9EB4738D-CAE7-420D-8A26-78A53CEA5E82}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EB4738D-CAE7-420D-8A26-78A53CEA5E82}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EB4738D-CAE7-420D-8A26-78A53CEA5E82}.Release|Any CPU.Build.0 = Release|Any CPU
+ {07EB8EA7-303A-407F-A881-060ED4595D7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {07EB8EA7-303A-407F-A881-060ED4595D7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {07EB8EA7-303A-407F-A881-060ED4595D7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {07EB8EA7-303A-407F-A881-060ED4595D7F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {225A1AFD-0890-44E8-B779-7502665C23A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {225A1AFD-0890-44E8-B779-7502665C23A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {225A1AFD-0890-44E8-B779-7502665C23A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {225A1AFD-0890-44E8-B779-7502665C23A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/SabreToolsUI/Helper.cs b/SabreToolsUI/Helper.cs
index 3b7601ca..f48c7485 100644
--- a/SabreToolsUI/Helper.cs
+++ b/SabreToolsUI/Helper.cs
@@ -8,7 +8,7 @@ using System.Threading.Tasks;
namespace SabreTools
{
- class Helper
+ class UIHelper
{
private static string _dbName = "DATabase.sqlite";
private static string _connectionString = "Data Source=" + _dbName + ";Version = 3;";
diff --git a/SabreToolsUI/SabreToolsUI.Designer.cs b/SabreToolsUI/SabreToolsUI.Designer.cs
index 07862649..e9f0d447 100644
--- a/SabreToolsUI/SabreToolsUI.Designer.cs
+++ b/SabreToolsUI/SabreToolsUI.Designer.cs
@@ -123,7 +123,7 @@
// systemsCheckedListBox
//
this.systemsCheckedListBox.FormattingEnabled = true;
- this.systemsCheckedListBox.Items.AddRange(Helper.GetAllSystems());
+ this.systemsCheckedListBox.Items.AddRange(UIHelper.GetAllSystems());
this.systemsCheckedListBox.Location = new System.Drawing.Point(77, 65);
this.systemsCheckedListBox.Name = "systemsCheckedListBox";
this.systemsCheckedListBox.Size = new System.Drawing.Size(260, 34);
@@ -132,7 +132,7 @@
// sourcesCheckedListBox
//
this.sourcesCheckedListBox.FormattingEnabled = true;
- this.sourcesCheckedListBox.Items.AddRange(Helper.GetAllSources());
+ this.sourcesCheckedListBox.Items.AddRange(UIHelper.GetAllSources());
this.sourcesCheckedListBox.Location = new System.Drawing.Point(415, 65);
this.sourcesCheckedListBox.Name = "sourcesCheckedListBox";
this.sourcesCheckedListBox.Size = new System.Drawing.Size(244, 34);
diff --git a/SabreToolsUI/SabreToolsUI.csproj b/SabreToolsUI/SabreToolsUI.csproj
index b76c9502..bd4a35b8 100644
--- a/SabreToolsUI/SabreToolsUI.csproj
+++ b/SabreToolsUI/SabreToolsUI.csproj
@@ -104,6 +104,12 @@
+
+
+ {225a1afd-0890-44e8-b779-7502665c23a5}
+ SabreHelper
+
+
diff --git a/SingleGame/App.config b/SingleGame/App.config
new file mode 100644
index 00000000..88fa4027
--- /dev/null
+++ b/SingleGame/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SingleGame/Properties/AssemblyInfo.cs b/SingleGame/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..f76bc5ff
--- /dev/null
+++ b/SingleGame/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SingleGame")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SingleGame")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("07eb8ea7-303a-407f-a881-060ed4595d7f")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SingleGame/SingleGame.cs b/SingleGame/SingleGame.cs
new file mode 100644
index 00000000..51ae0aa1
--- /dev/null
+++ b/SingleGame/SingleGame.cs
@@ -0,0 +1,145 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+using System.Xml.Linq;
+
+using SabreTools.Helper;
+
+namespace SabreTools
+{
+ public class SingleGame
+ {
+ private static string filename;
+
+ public static void Main(string[] args)
+ {
+ if (args.Length != 1)
+ {
+ Help();
+ return;
+ }
+
+ filename = args[0];
+
+ // Take the filename, and load it as an XML document
+ XmlDocument doc = new XmlDocument();
+ try
+ {
+ doc.LoadXml(File.ReadAllText(filename));
+ }
+ catch (XmlException)
+ {
+ doc.LoadXml(Converters.RomVaultToXML(File.ReadAllLines(filename)).ToString());
+ }
+
+ // We all start the same
+ XmlNode node = doc.FirstChild;
+ if (node != null && node.Name == "xml")
+ {
+ // Skip over everything that's not an element
+ while (node.NodeType != XmlNodeType.Element)
+ {
+ node = node.NextSibling;
+ }
+ }
+
+ XmlDocument tempDoc = new XmlDocument();
+ XmlNode outNode = tempDoc.CreateNode(XmlNodeType.Element, node.Name, "");
+
+ // Once we find the main body, enter it
+ if (node != null && node.Name == "datafile")
+ {
+ node = node.FirstChild;
+ }
+
+ // Now here's where it differs from import
+ bool inGame = false;
+ while (node != null)
+ {
+ // If we're at a game node, add the parent node but not all the internals
+ if (node.NodeType == XmlNodeType.Element && (node.Name == "machine" || node.Name == "game"))
+ {
+ if (!inGame)
+ {
+ XmlElement tempNode = tempDoc.CreateElement(node.Name);
+ tempNode.SetAttribute("name", "!");
+ outNode.AppendChild(tempNode);
+ outNode = outNode.LastChild;
+ inGame = true;
+ }
+
+ // Get the roms from the machine
+ if (node.HasChildNodes)
+ {
+ // If this node has children, traverse the children
+ foreach (XmlNode child in node.ChildNodes)
+ {
+ // If we find a rom or disk, add it
+ if (child.NodeType == XmlNodeType.Element && (child.Name == "rom" || child.Name == "disk"))
+ {
+ // Take care of hex-sized files
+ long size = -1;
+ if (child.Attributes["size"] != null && child.Attributes["size"].Value.Contains("0x"))
+ {
+ size = Convert.ToInt64(child.Attributes["size"].Value, 16);
+ }
+ else if (child.Attributes["size"] != null)
+ {
+ size = Int64.Parse(child.Attributes["size"].Value);
+ }
+
+ XmlElement tempNode = (XmlElement)tempDoc.ImportNode(child, true);
+
+ // Windows max name length is 260. Taking into account the game name of "!", we can use 259 characters
+ tempNode.SetAttribute("name", "(" + node.Attributes["name"].Value + ")" + child.Attributes["name"].Value);
+ tempNode.Attributes["name"].Value = (tempNode.Attributes["name"].Value.Length > 259 ? tempNode.Attributes["name"].Value.Substring(0, 259) : tempNode.Attributes["name"].Value);
+ outNode.AppendChild(tempNode);
+ }
+ }
+ }
+ }
+ else
+ {
+ XmlNode tempNode = tempDoc.ImportNode(node, true);
+ outNode.AppendChild(tempNode);
+ }
+ node = node.NextSibling;
+ }
+
+ tempDoc.AppendChild(tempDoc.CreateDocumentType("datafile", "-//Logiqx//DTD ROM Management Datafile//EN", "http://www.logiqx.com/Dats/datafile.dtd", null));
+ tempDoc.AppendChild(outNode);
+ string outPath = Path.GetFileNameWithoutExtension(filename) + ".new" + Path.GetExtension(filename);
+ File.WriteAllText(outPath, Beautify(tempDoc));
+ }
+
+ private static void Help()
+ {
+
+ }
+
+ // http://stackoverflow.com/questions/203528/what-is-the-simplest-way-to-get-indented-xml-with-line-breaks-from-xmldocument
+ // http://www.timvw.be/2007/01/08/generating-utf-8-with-systemxmlxmlwriter/
+ static public string Beautify(XmlDocument doc)
+ {
+ MemoryStream ms = new MemoryStream();
+ XmlWriterSettings settings = new XmlWriterSettings
+ {
+ Encoding = new UTF8Encoding(false),
+ Indent = true,
+ IndentChars = "\t",
+ NewLineChars = "\r\n",
+ NewLineHandling = NewLineHandling.Replace
+ };
+
+ using (XmlWriter writer = XmlWriter.Create(ms, settings))
+ {
+ doc.Save(writer);
+ }
+ return Encoding.UTF8.GetString(ms.ToArray());
+ }
+ }
+}
diff --git a/SingleGame/SingleGame.csproj b/SingleGame/SingleGame.csproj
new file mode 100644
index 00000000..01d4676e
--- /dev/null
+++ b/SingleGame/SingleGame.csproj
@@ -0,0 +1,66 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {07EB8EA7-303A-407F-A881-060ED4595D7F}
+ Exe
+ Properties
+ SingleGame
+ SingleGame
+ v4.5.2
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ ..\..\Builds\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {225a1afd-0890-44e8-b779-7502665c23a5}
+ SabreHelper
+
+
+
+
+
\ No newline at end of file