init
This commit is contained in:
35
Common/DTS.Common/XMLUtils/DTSXMLFile.cs
Normal file
35
Common/DTS.Common/XMLUtils/DTSXMLFile.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using DTS.Common.Utils;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Xml;
|
||||
|
||||
namespace DTS.Common.XMLUtils
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Acronym")]
|
||||
public static class DTSXMLFile
|
||||
{
|
||||
public static double GetItemsToCompleteCount(string fileName)
|
||||
{
|
||||
var node = FileUtils.GetImportXmlNode(fileName, null, out _);
|
||||
double totalItems = 0;
|
||||
try
|
||||
{
|
||||
totalItems = Convert.ToDouble(node.GetAttribute("TotalItems"), CultureInfo.InvariantCulture);
|
||||
return totalItems;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return totalItems;
|
||||
}
|
||||
}
|
||||
public static string GetInnerXML(XmlReader reader)
|
||||
{
|
||||
if (null == reader) { throw new ArgumentException("GetInnerXML - XmlReader was null"); }
|
||||
reader.ReadStartElement(reader.Name);
|
||||
var s = reader.Value;
|
||||
if (reader.NodeType == XmlNodeType.Text) { reader.Read(); }
|
||||
reader.ReadEndElement();
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user