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()
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,21 +36,25 @@ namespace SabreTools.Helper
|
||||
/// <returns>The XmlDocument representing the (possibly converted) file, null otherwise</returns>
|
||||
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();
|
||||
string alltext = "";
|
||||
string[] alllines;
|
||||
try
|
||||
{
|
||||
alltext = File.ReadAllText(filename);
|
||||
doc.LoadXml(alltext);
|
||||
doc.LoadXml(File.ReadAllText(filename));
|
||||
}
|
||||
catch (XmlException)
|
||||
{
|
||||
try
|
||||
{
|
||||
alllines = File.ReadAllLines(filename);
|
||||
alltext = Converters.ClrMameProToXML(alllines).ToString();
|
||||
doc.LoadXml(alltext);
|
||||
doc.LoadXml(Converters.ClrMameProToXML(File.ReadAllLines(filename)).ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user