Blame view

Vrh.iScheduler/XmlProcessing/PluginElement.cs 3.03 KB
ab9f2fbe   Schwirg László   Add project files.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  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
  {
      /// <summary>
      /// Plugin elérési mód esetén 
      /// itt találhatóak a szükséges adatok.
      /// </summary>
      public class PluginElement : XmlLinqBase
      {
          #region Built'in classes
  
          #region ElementNames class
          /// <summary>
          /// Az XML fájlban ilyen elem nevek találhatóak egy "Plugin" elemben.
          /// </summary>
          public new class ElementNames : XmlLinqBase.ElementNames
          {
              /// <summary>
              /// 'AssemblyPath' elem név.
              /// </summary>
              public const string ASSEMBLYPATH = "AssemblyPath";
  
              /// <summary>
              /// 'ObjectXml' elem név.
              /// </summary>
              public const string OBJECTXML = "ObjectXml";
          }
          #endregion ElementNames class
  
          #region AttributeNames static class
          /// <summary>
          /// Az XML fájlban ilyen attribútum nevek találhatóak egy 'Plugin' elemben.
          /// </summary>
          public static class AttributeNames
          {
          }
          #endregion AttributeNames static class
  
          #endregion Built'in classes
  
          #region Properties
  
          /// <summary>
          /// A plugin DLL fizikai elérésével együtt.
          /// </summary>
          public string AssemblyPath { get; set; }
  
          /// <summary>
          /// Az ütemezett objektum XmlParser kacsolati sztringje.
          /// A sztringben célszerűen fizikai elérési útvonalakat kell megadni.
          /// </summary>
          public string ObjectXml { get; set; }
  
          #endregion Properties
  
          #region Constructors
          /// <summary>
          /// Példányosítás egy 'Plugin' XElement alapján.
          /// </summary>
          /// <param name="xelement">A 'Plugin' elem XElement objektuma.</param>
          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
      }
  }