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);
            }
        }
예제 #2
0
 public CallAction(Chain parentChain, XElement actionElement)
     : base(parentChain, actionElement)
 {
     if (actionElement.HasAttributes == true && actionElement.Attribute("Chain") != null) {
         chainName = actionElement.Attribute("Chain").Value;
     }
 }
예제 #3
0
 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;
        }
예제 #5
0
        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
                }
            }
        }
예제 #6
0
 public AlwaysFilter(Chain parentChain, XElement filterElement)
     : base(parentChain, filterElement)
 {
 }
예제 #7
0
 public NeverFilter(Chain parentChain, XElement filterElement)
     : base(parentChain, filterElement)
 {
 }
예제 #8
0
 public DisconnectPlayerAction(Chain parentChain, XElement actionElement)
     : base(parentChain, actionElement)
 {
 }
 public HandlePacketAction(Chain parentChain, XElement actionElement)
     : base(parentChain, actionElement)
 {
 }
예제 #10
0
 public Trigger(Chain parent, XElement triggerElement)
 {
     this.parentChain = parent;
     this.triggerElement = triggerElement;
 }
예제 #11
0
 public Action(Chain parentChain, XElement actionElement)
 {
     this.parentChain = parentChain;
     this.actionElement = actionElement;
 }
예제 #12
0
 public AlwaysTrigger(Chain parentChain, XElement triggerElement)
     : base(parentChain, triggerElement)
 {
 }