示例#1
0
 //Methods
 /// <summary>
 /// Checks consistency
 /// </summary>
 protected override void Check()
 {
     if (SignalBeginThreshold < 0)
     {
         throw new ArgumentException($"Invalid SignalBeginThreshold {SignalBeginThreshold.ToString(CultureInfo.InvariantCulture)}. SignalBeginThreshold must be GE to 0.", "SignalBeginThreshold");
     }
     if (SignalEndThreshold < 0)
     {
         throw new ArgumentException($"Invalid SignalEndThreshold {SignalEndThreshold.ToString(CultureInfo.InvariantCulture)}. SignalEndThreshold must be GE to 0.", "SignalEndThreshold");
     }
     if (TargetTimePoints != AutoTargetTimePointsNum && TargetTimePoints <= 0)
     {
         throw new ArgumentException($"Invalid TargetTimePoints {TargetTimePoints.ToString(CultureInfo.InvariantCulture)}. TargetTimePoints must be equal to {AutoTargetTimePointsNum.ToString(CultureInfo.InvariantCulture)} for automatic target time points or GT 0.", "TargetTimePoints");
     }
     return;
 }
示例#2
0
        /// <summary>
        /// Generates xml element containing the settings.
        /// </summary>
        /// <param name="rootElemName">Name to be used as a name of the root element.</param>
        /// <param name="suppressDefaults">Specifies whether to ommit optional nodes having set default values</param>
        /// <returns>XElement containing the settings</returns>
        public override XElement GetXml(string rootElemName, bool suppressDefaults)
        {
            XElement rootElem = new XElement(rootElemName);

            if (!suppressDefaults || !IsDefaultSignalBeginThreshold)
            {
                rootElem.Add(new XAttribute("signalBeginThreshold", SignalBeginThreshold.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultSignalEndThreshold)
            {
                rootElem.Add(new XAttribute("signalEndThreshold", SignalEndThreshold.ToString(CultureInfo.InvariantCulture)));
            }
            if (!suppressDefaults || !IsDefaultUniformTimeScale)
            {
                rootElem.Add(new XAttribute("uniformTimeScale", UniformTimeScale.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()));
            }

            if (!suppressDefaults || !IsDefaultTargetTimePoints)
            {
                rootElem.Add(new XAttribute("targetTimePoints", TargetTimePoints == AutoTargetTimePointsNum ? AutoTargetTimePointsCode : TargetTimePoints.ToString(CultureInfo.InvariantCulture)));
            }
            Validate(rootElem, XsdTypeName);
            return(rootElem);
        }