init
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using DTS.Common.Import.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
|
||||
namespace DTS.Common.Import.XML
|
||||
{
|
||||
public abstract class XMLParseBase : IParseVariant
|
||||
{
|
||||
protected static readonly Dictionary<int, int> _dasIdMapping = new Dictionary<int, int>();
|
||||
//Use string to handle both new (Id (int.ToString())) and old (Name (string)) exports
|
||||
protected static readonly Dictionary<string, int> _groupIdMapping = new Dictionary<string, int>();
|
||||
protected static readonly Dictionary<int, int> _sensorIdMapping = new Dictionary<int, int>();
|
||||
protected static readonly Dictionary<long, long> _channelIdMapping = new Dictionary<long, long>();
|
||||
|
||||
protected double _importedVersion;
|
||||
|
||||
protected readonly Func<bool> IsCancelled;
|
||||
protected readonly XmlElement _root;
|
||||
protected XmlWriter _writer;
|
||||
private readonly XmlDocument _doc;
|
||||
|
||||
public string FileName { get; set; }
|
||||
public abstract void Parse(ref ImportObject importObject);
|
||||
|
||||
protected XMLParseBase(XmlElement root, double importedVersion, Func<bool> isCancelled = null)
|
||||
{
|
||||
_importedVersion = importedVersion;
|
||||
|
||||
IsCancelled = isCancelled == null ? () => false : isCancelled;
|
||||
|
||||
_root = root;
|
||||
|
||||
_doc = new XmlDocument();
|
||||
_writer = _doc.CreateNavigator().AppendChild();
|
||||
}
|
||||
|
||||
protected XmlElement GetXmlElement()
|
||||
{
|
||||
_writer.Close();
|
||||
return _doc.DocumentElement;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user