mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, FileTools] Move GetXmlTextReader to a better location
This commit is contained in:
@@ -11,6 +11,7 @@ using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace SabreTools.Helper
|
||||
{
|
||||
@@ -1080,6 +1081,30 @@ namespace SabreTools.Helper
|
||||
|
||||
#region File Manipulation
|
||||
|
||||
/// <summary>
|
||||
/// Get the XmlTextReader associated with a file, if possible
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to be parsed</param>
|
||||
/// <param name="logger">Logger object for console and file output</param>
|
||||
/// <returns>The XmlTextReader representing the (possibly converted) file, null otherwise</returns>
|
||||
public static XmlTextReader GetXmlTextReader(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;
|
||||
}
|
||||
|
||||
XmlTextReader xtr;
|
||||
xtr = new XmlTextReader(filename);
|
||||
xtr.WhitespaceHandling = WhitespaceHandling.None;
|
||||
xtr.DtdProcessing = DtdProcessing.Ignore;
|
||||
return xtr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove an arbitrary number of bytes from the inputted file
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user