Exemple #1
0
        /// <summary>
        /// Used to load a script from a specified location.
        /// </summary>
        /// <param name="location">The XML file to load the KScript from</param>
        /// <param name="fresh">Recreate container objects and document.</param>
        public void Load(string location, bool fresh)
        {
            if (fresh)
            {
                Document   = new XmlDocument();
                Properties = new KScriptProperties();
            }

            FilePath = location;

            Document.PreserveWhitespace = true;
            Document.Load(location);

            StartScriptTime = DateTime.Now;
        }
 /// <summary>
 /// Constructor for KScriptContainer
 /// </summary>
 /// <param name="prop">Properties class to use for KScript parsing.</param>
 /// <param name="parser">The parser object to use.</param>
 public KScriptContainer(KScriptProperties prop, KScriptParser parser)
 {
     _random                 = new Random();
     defs                    = new Dictionary <string, def>();
     arrays                  = new Dictionary <string, List <string> >();
     Properties              = prop;
     Parser                  = parser;
     AllowExecution          = true;
     StringHandler           = new KScriptStringHandler(this);
     LoadedKScriptObjects    = new Dictionary <string, Type>();
     ObjectStorageContainer  = new KScriptObjectStorageContainer();
     LoadedVariableFunctions = new Dictionary <string, Type>();
     LoadedParserHandlers    = new Dictionary <string, Type>();
     LoadedOperatorHandlers  = new Dictionary <string, Type>();
     KScriptArrayContainer   = new KScriptArrayContainer();
 }
Exemple #3
0
 public KScriptParser()
 {
     Document = new XmlDocument(); Properties = new KScriptProperties();
 }