This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using DTS.Common.Import.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Import.Parsers
{
public abstract class ParseVariantBase : IParseVariant
{
public string FileName { get; set; }
public abstract void Parse(ref ImportObject importObject);
}
}

View File

@@ -0,0 +1,62 @@
using DTS.Common.Import.Interfaces;
using DTS.Common.Interface;
using System;
using System.Collections.Generic;
using System.Xml;
namespace DTS.Common.Import.XML
{
public class XMLParseGlobalSettings : XMLParseBase
{
public XMLParseGlobalSettings(XmlElement root, double importedVersion, Func<bool> isCancelled = null) : base(root, importedVersion, isCancelled)
{
}
public IImportNotification ImportNotification { get; set; }
public override void Parse(ref ImportObject importObject)
{
importObject.AssignGlobalSettings(ParseGlobalSettings(_root));
}
private Dictionary<string, string> ParseGlobalSettings(XmlElement root)
{
Dictionary<string, string> settings = new Dictionary<string, string>();
foreach (var child in root.ChildNodes)
{
if (IsCancelled()) { return settings; }
if (child is XmlElement)
{
GetGlobalSetting(child as XmlElement, ref settings);
}
}
return settings;
}
private void GetGlobalSetting(XmlElement node, ref Dictionary<string, string> settings)
{
string sName = "", sValue = "";
foreach (var child in node.ChildNodes)
{
if (child is XmlElement)
{
var childNode = child as XmlElement;
switch (childNode.Name)
{
case "SettingName":
sName = childNode.InnerText;
break;
case "SettingValue":
sValue = childNode.InnerText;
break;
}
}
}
if (!string.IsNullOrWhiteSpace(sName))
{
settings[sName] = sValue;
}
}
}
}