public RangeCheckTrigger(Chain parentChain, XElement chainElement) : base(parentChain, chainElement) { XAttribute thAttr = null; Match match = null; int x, y; if (chainElement.HasAttributes == false || (thAttr = chainElement.Attribute("Range")) == null) { THLog.Log(LogLevel.Error, "Could not set up RangeCheckTrigger: Threshold is not specified."); return; } if (thresholdStringRegex.IsMatch(thAttr.Value) == false) { THLog.Log(LogLevel.Error, "Could not set up RangeCheckTrigger: Threshold {0} is invalid.", thAttr.Value); return; } if ((match = thresholdStringRegex.Match(thAttr.Value)) == null) { THLog.Log(LogLevel.Error, "Could not set up RangeCheckTrigger: Threshold {0} is invalid.", thAttr.Value); return; } if (int.TryParse(match.Groups[1].Value, out x) == true && int.TryParse(match.Groups[2].Value, out y) == true) { thresholdRange = new Vector2(x * 16, y * 16); } }
public CallAction(Chain parentChain, XElement actionElement) : base(parentChain, actionElement) { if (actionElement.HasAttributes == true && actionElement.Attribute("Chain") != null) { chainName = actionElement.Attribute("Chain").Value; } }
public Filter(Chain parentChain, XElement filterConfigurationElement) { if (parentChain == null) { throw new ArgumentNullException("parentChain"); } this.parentChain = parentChain; this.filterConfigurationElement = filterConfigurationElement; }
public PacketThresholdTrigger(Chain parent, XElement triggerElement) : base(parent, triggerElement) { if (triggerElement.HasAttributes == false || triggerElement.Attribute("Threshold") == null || int.TryParse(triggerElement.Attribute("Threshold").Value, out threshold) == false) { THLog.Log(LogLevel.Error, "Cannot set up this instance of PacketThresholdTrigger: Threshold attribute is missing or invalid."); throw new ArgumentException("@Threshold"); } timer = new System.Timers.Timer() { Interval = 1000, Enabled = true }; timer.Elapsed += timer_Elapsed; }
public PacketFilter(Chain parentChain, XElement filterElement) : base(parentChain, filterElement) { int r; if (filterElement.HasAttributes == true && filterElement.Attribute("MsgID") != null) { string elementValue = filterElement.Attribute("MsgID").Value; if (elementValue.Equals("any", StringComparison.CurrentCultureIgnoreCase) == true) { anyPacket = true; } else if (int.TryParse(elementValue, out r) == true) { msgId = r; } else { //tODO: log error } } }
public AlwaysFilter(Chain parentChain, XElement filterElement) : base(parentChain, filterElement) { }
public NeverFilter(Chain parentChain, XElement filterElement) : base(parentChain, filterElement) { }
public DisconnectPlayerAction(Chain parentChain, XElement actionElement) : base(parentChain, actionElement) { }
public HandlePacketAction(Chain parentChain, XElement actionElement) : base(parentChain, actionElement) { }
public Trigger(Chain parent, XElement triggerElement) { this.parentChain = parent; this.triggerElement = triggerElement; }
public Action(Chain parentChain, XElement actionElement) { this.parentChain = parentChain; this.actionElement = actionElement; }
public AlwaysTrigger(Chain parentChain, XElement triggerElement) : base(parentChain, triggerElement) { }