mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Minor logging and fixes
This commit is contained in:
@@ -75,9 +75,9 @@ namespace SabreTools
|
|||||||
public bool Process()
|
public bool Process()
|
||||||
{
|
{
|
||||||
// Check if there are enough inputs
|
// Check if there are enough inputs
|
||||||
if (_inputs.Count < 0)
|
if (_inputs.Count < 2)
|
||||||
{
|
{
|
||||||
_logger.Warning("At least inputs are required!");
|
_logger.Warning("At least 2 inputs are required!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,21 +36,25 @@ namespace SabreTools.Helper
|
|||||||
/// <returns>The XmlDocument representing the (possibly converted) file, null otherwise</returns>
|
/// <returns>The XmlDocument representing the (possibly converted) file, null otherwise</returns>
|
||||||
public static XmlDocument GetXmlDocument(string filename, Logger logger)
|
public static XmlDocument GetXmlDocument(string filename, Logger logger)
|
||||||
{
|
{
|
||||||
|
logger.Log("Attempting to read file: " + filename);
|
||||||
|
|
||||||
|
// Check if file exists
|
||||||
|
if (!File.Exists(filename))
|
||||||
|
{
|
||||||
|
logger.Warning("File '" + filename + "' could not read from!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
XmlDocument doc = new XmlDocument();
|
XmlDocument doc = new XmlDocument();
|
||||||
string alltext = "";
|
|
||||||
string[] alllines;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
alltext = File.ReadAllText(filename);
|
doc.LoadXml(File.ReadAllText(filename));
|
||||||
doc.LoadXml(alltext);
|
|
||||||
}
|
}
|
||||||
catch (XmlException)
|
catch (XmlException)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
alllines = File.ReadAllLines(filename);
|
doc.LoadXml(Converters.ClrMameProToXML(File.ReadAllLines(filename)).ToString());
|
||||||
alltext = Converters.ClrMameProToXML(alllines).ToString();
|
|
||||||
doc.LoadXml(alltext);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user