using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using Vrh.XmlProcessing; namespace Vrh.iScheduler { /// /// Plugin elérési mód esetén /// itt találhatóak a szükséges adatok. /// public class PluginElement : XmlLinqBase { #region Built'in classes #region ElementNames class /// /// Az XML fájlban ilyen elem nevek találhatóak egy "Plugin" elemben. /// public new class ElementNames : XmlLinqBase.ElementNames { /// /// 'AssemblyPath' elem név. /// public const string ASSEMBLYPATH = "AssemblyPath"; /// /// 'ObjectXml' elem név. /// public const string OBJECTXML = "ObjectXml"; } #endregion ElementNames class #region AttributeNames static class /// /// Az XML fájlban ilyen attribútum nevek találhatóak egy 'Plugin' elemben. /// public static class AttributeNames { } #endregion AttributeNames static class #endregion Built'in classes #region Properties /// /// A plugin DLL fizikai elérésével együtt. /// public string AssemblyPath { get; set; } /// /// Az ütemezett objektum XmlParser kacsolati sztringje. /// A sztringben célszerűen fizikai elérési útvonalakat kell megadni. /// public string ObjectXml { get; set; } #endregion Properties #region Constructors /// /// Példányosítás egy 'Plugin' XElement alapján. /// /// A 'Plugin' elem XElement objektuma. public PluginElement(XElement xelement) { if (xelement != null) { this.AssemblyPath = GetValue(GetXElement(xelement, ElementNames.ASSEMBLYPATH, true), "", true, true); this.ObjectXml = GetValue(GetXElement(xelement, ElementNames.OBJECTXML, true), "", true, true); if (!File.Exists(this.AssemblyPath)) { throw new ApplicationException(string.Concat( "The file \"", this.AssemblyPath, "\" does not exist in then Plugin.", nameof(PluginElement.AssemblyPath), " element!" )); } //if (!File.Exists(this.ObjectXml)) //{ // throw new ApplicationException(string.Concat( // "The file \"", this.ObjectXml, "\" does not exist in then Plugin.", // nameof(PluginElement.ObjectXml), " element!" // )); //} } } #endregion Constructors } }