/// <inheritdoc /> public override XElement GetXml(string rootElemName, bool suppressDefaults) { XElement rootElem = new XElement(rootElemName); if (!suppressDefaults || !IsDefaultDelayMethod) { rootElem.Add(new XAttribute("delayMethod", DelayMethod.ToString())); } if (!suppressDefaults || !IsDefaultMaxDelay) { rootElem.Add(new XAttribute("maxDelay", MaxDelay.ToString(CultureInfo.InvariantCulture))); } if (!suppressDefaults || !IsDefaultRelShare) { rootElem.Add(new XAttribute("relShare", RelShare.ToString(CultureInfo.InvariantCulture))); } if (!suppressDefaults || !IsDefaultAnalogSourceCfg) { rootElem.Add(AnalogSourceCfg.GetXml(suppressDefaults)); } if (!suppressDefaults || !IsDefaultSpikingSourceCfg) { rootElem.Add(SpikingSourceCfg.GetXml(suppressDefaults)); } Validate(rootElem, XsdTypeName); return(rootElem); }
public bool Equals(CarGenerator other) { if (other == null) { return(false); } return(Model.Equals(other.Model) && Position.Equals(other.Position) && Heading.Equals(other.Heading) && Color1.Equals(other.Color1) && Color2.Equals(other.Color2) && ForceSpawn.Equals(other.ForceSpawn) && AlarmChance.Equals(other.AlarmChance) && LockedChance.Equals(other.LockedChance) && MinDelay.Equals(other.MinDelay) && MaxDelay.Equals(other.MaxDelay) && Timer.Equals(other.Timer) && Handle.Equals(other.Handle) && Enabled.Equals(other.Enabled) && IsBlocking.Equals(other.IsBlocking) && CollisionBoundingMin.Equals(other.CollisionBoundingMin) && CollisionBoundingMax.Equals(other.CollisionBoundingMax) && CollisionSize.Equals(other.CollisionSize)); }
//Methods /// <summary> /// Checks consistency /// </summary> protected override void Check() { if (MaxDelay < 0) { throw new ArgumentException($"Invalid MaxDelay {MaxDelay.ToString(CultureInfo.InvariantCulture)}. MaxDelay must be GE to 0.", "MaxDelay"); } return; }
public override byte[] ToBytes() { return(TLUtils.Combine( TLUtils.SignatureToBytes(Signature), MaxDelay.ToBytes(), WaitAfter.ToBytes(), MaxWait.ToBytes())); }
//arguments: server_id host port min_delay max_delay version public string CollapseArguments() { string[] args = { ServerId, Host, Port.ToString(), MinDelay.ToString(), MaxDelay.ToString(), Version.ToString() }; return(string.Join(" ", args)); }