Пример #1
0
        /// <summary>
        /// Creates a clone of the specified <see cref="TagSettings"/> object.
        /// </summary>
        /// <param name="other">The object to clone.</param>
        /// <exception cref="ArgumentNullException"><paramref name="other"/> is <see langword="null"/>.</exception>
        internal TagSettings(TagSettings other) : this()
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            Name                    = other.Name;
            Description             = other.Description;
            Units                   = other.Units;
            DataType                = other.DataType;
            StateSet                = other.StateSet;
            ExceptionFilterSettings = other.ExceptionFilterSettings == null
                ? null
                : new TagValueFilterSettingsUpdate()
            {
                IsEnabled  = other.ExceptionFilterSettings.IsEnabled,
                LimitType  = other.ExceptionFilterSettings.LimitType,
                Limit      = other.ExceptionFilterSettings.Limit,
                WindowSize = other.ExceptionFilterSettings.WindowSize
            };
            CompressionFilterSettings = other.CompressionFilterSettings == null
                ? null
                : new TagValueFilterSettingsUpdate()
            {
                IsEnabled  = other.CompressionFilterSettings.IsEnabled,
                LimitType  = other.CompressionFilterSettings.LimitType,
                Limit      = other.CompressionFilterSettings.Limit,
                WindowSize = other.CompressionFilterSettings.WindowSize
            };
        }
Пример #2
0
        /// <summary>
        /// Updates the filter settings.
        /// </summary>
        /// <param name="update">The updated settings.</param>
        /// <exception cref="ArgumentNullException"><paramref name="update"/> is <see langword="null"/>.</exception>
        public void Update(TagValueFilterSettingsUpdate update)
        {
            if (update == null)
            {
                throw new ArgumentNullException(nameof(update));
            }

            IsEnabled = update.IsEnabled;
            if (update.LimitType.HasValue)
            {
                LimitType = update.LimitType.Value;
            }
            if (update.Limit.HasValue)
            {
                Limit = update.Limit.Value;
            }
            if (update.WindowSize.HasValue)
            {
                WindowSize = update.WindowSize.Value;
            }
        }