public SortNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "direction": string dirStr = attr.Value.ToLower().Trim(); if (dirStr == "desc" || dirStr == "descending") direction = DirectionType.DESCENDING; else if (dirStr == "asc" || dirStr == "ascending") direction = DirectionType.ASCENDING; else { logger.Error("Invalid sort direction on: " + xmlNode.OuterXml); } break; case "by": sortBy = attr.Value; break; } } // Validate BY attribute if (sortBy == null) { logger.Error("Missing BY attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public ParseNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "input": input = attr.Value; break; case "regex": pattern = attr.Value; break; case "xpath": xpath = attr.Value; break; } } // Validate INPUT attribute if (input == null) { logger.Error("Missing INPUT attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } // Validate REGEX/XPATH attribute if (pattern == null && xpath == null) { logger.Error("Missing REGEX or XPATH attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public LoopNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { if (ScriptSettings.DebugMode) logger.Debug("executing loop: " + xmlNode.OuterXml); // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "on": loopingVariable = attr.Value; break; case "limit": try { limit = int.Parse(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; logger.Error("Invalid value for LIMIT attribute on: " + xmlNode.OuterXml); } break; } } // Validate ON attribute if (loopingVariable == null) { logger.Error("Missing ON attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public SetNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { if (settings.DebugMode) logger.Debug("executing set: " + xmlNode.OuterXml); // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "value": value = attr.Value; break; } } // get the innervalue string innerValue = xmlNode.InnerText.Trim(); // Validate TEST attribute if (value == null) { value = innerValue; if (innerValue.Equals(String.Empty)) { logger.Error("Missing VALUE attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } } else if (!innerValue.Equals(String.Empty)) { logger.Error("Ambiguous assignment on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public DistanceNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "string1": string1 = attr.Value; break; case "string2": string2 = attr.Value; break; } } // Validate STRING1 attribute if (string1 == null) { logger.Error("Missing STRING1 attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } // Validate STRING2 attribute if (string2 == null) { logger.Error("Missing STRING2 attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public SleepNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { if (settings.DebugMode) logger.Debug("executing set: " + xmlNode.OuterXml); // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "length": try { _length = int.Parse(attr.Value); } catch (Exception) { _length = 100; } break; } } // get the innervalue string innerValue = xmlNode.InnerText.Trim(); // Validate length attribute if (_length <= 0) { logger.Error("The LENGTH attribute must be greater than 0: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public LogNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { try { logLevel = LogLevel.FromString(xmlNode.Attributes["LogLevel"].Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; try { logLevel = LogLevel.FromString(xmlNode.Attributes["log_level"].Value); } catch (Exception e2) { if (e2.GetType() == typeof(ThreadAbortException)) throw e2; logLevel = LogLevel.Debug; } } try { message = xmlNode.Attributes["Message"].Value; } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; try { message = xmlNode.Attributes["message"].Value; } catch (Exception e2) { if (e2.GetType() == typeof(ThreadAbortException)) throw e2; logger.Error("Missing MESSAGE attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } } loadSuccess = true; }
public IfNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "test": test = attr.Value; break; } } // Validate TEST attribute if (test == null) { logger.Error("Missing TEST attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public ReplaceNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "input": input = attr.Value; break; case "pattern": pattern = attr.Value; break; case "with": replacement = attr.Value; break; } } // Validate INPUT attribute if (input == null) { logger.Error("Missing INPUT attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } // Validate PATTERN attribute if (pattern == null) { logger.Error("Missing PATTERN attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } // Validate WITH attribute if (replacement == null) { logger.Error("Missing WITH attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public MathNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Load attributes string resultTypeStr = null; foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "value1": value1 = attr.Value; break; case "value2": value2 = attr.Value; break; case "result_type": resultTypeStr = attr.Value; break; } } // Validate VALUE1 attribute if (value1 == null) { logger.Error("Missing VALUE1 attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } // Validate VALUE2 attribute if (value2 == null) { logger.Error("Missing VALUE2 attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } // Validate RESULT_TYPE attribute if (resultTypeStr != null && resultTypeStr.ToUpper().Equals("FLOAT")) resultType = ResultTypeEnum.FLOAT; else resultType = ResultTypeEnum.INT; }
public RetrieveNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { // Set default attribute valuess _useCaching = true; allowUnsafeHeader = false; maxRetries = 5; timeout = 5000; timeoutIncrement = 2000; _method = "GET"; // Load attributes foreach (XmlAttribute attr in xmlNode.Attributes) { switch (attr.Name) { case "url": url = attr.Value; break; case "file": file = attr.Value; break; case "useragent": userAgent = attr.Value; break; case "allow_unsafe_header": try { allowUnsafeHeader = bool.Parse(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; } break; case "use_caching": try { _useCaching = bool.Parse(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; } break; case "encoding": // grab encoding, if not specified it will try to set // the encoding using information from the response header. try { encoding = Encoding.GetEncoding(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; } break; case "retries": try { maxRetries = int.Parse(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; } break; case "timeout": try { timeout = int.Parse(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; } break; case "timeout_increment": try { timeoutIncrement = int.Parse(attr.Value); } catch (Exception e) { if (e.GetType() == typeof(ThreadAbortException)) throw e; } break; case "cookies": cookies = attr.Value; break; case "method": _method = attr.Value.Trim().ToUpper(); break; } } // Validate URL / FILE attribute if (url == null && file == null) { logger.Error("Missing URL or FILE attribute on: " + xmlNode.OuterXml); loadSuccess = false; return; } }
public AddNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { }
public MultiplyNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { }
public SubtractNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { }
public SubtractNode(XmlNode xmlNode, InternalScriptSettings settings) : base(xmlNode, settings) { }