public BasePowerTarget(IStep parent) : base(ITarget.TargetType.Power, parent) { if (Options.Instance.UseSportTracksPowerZones) { ConcreteTarget = new PowerZoneSTTarget(this); } else { ConcreteTarget = new PowerZoneGTCTarget(this); } }
public override void HandleTargetOverride(XmlNode extensionNode) { // We got here so our target must be a range Debug.Assert(ConcreteTarget.Type == IConcretePowerTarget.PowerTargetType.Range); IZoneCategory referenceZones = Options.Instance.PowerZoneCategory; string zoneReferenceId = null; int zoneIndex = -1; for (int j = 0; j < extensionNode.ChildNodes.Count; ++j) { XmlNode childNode = extensionNode.ChildNodes[j]; if (childNode.Name == "Id" && childNode.ChildNodes.Count == 1 && childNode.FirstChild.GetType() == typeof(XmlText)) { zoneReferenceId = childNode.FirstChild.Value; } else if (childNode.Name == "Index" && childNode.ChildNodes.Count == 1 && childNode.FirstChild.GetType() == typeof(XmlText) && Utils.IsTextIntegerInRange(childNode.FirstChild.Value, (UInt16)0, (UInt16)(referenceZones.Zones.Count - 1))) { zoneIndex = int.Parse(childNode.FirstChild.Value); } } if (zoneReferenceId == referenceZones.ReferenceId && zoneIndex != -1) { ConcreteTarget = new PowerZoneSTTarget(referenceZones.Zones[zoneIndex], this); } }