コード例 #1
0
 /// <summary>
 /// Checks whether the given alert type was used
 /// </summary>
 private bool IsDetectionTypeOn(DetectionType lookedForType, DetectionType[] userSelectedTypes)
 {
     if (userSelectedTypes.Contains(lookedForType))
     {
         return true;
     }
     return false;
 }
コード例 #2
0
        /// <summary>
        /// In cases where the user decided to use the shortcut NONE, this method sets the value of the ExcludedDetectionType property to reflect the correct values.
        /// </summary>
        public static DetectionType[] ProcessExcludedDetectionTypes(DetectionType[] excludedDetectionTypes)
        {
            if (excludedDetectionTypes == null || excludedDetectionTypes.Length == 0)
            {
                return excludedDetectionTypes;
            }

            if (excludedDetectionTypes.Length == 1)
            {
                if (excludedDetectionTypes[0] == DetectionType.None)
                {
                    return new DetectionType[] { };
                }
            }
            else
            {
                if (excludedDetectionTypes.Contains(DetectionType.None))
                {
                    throw new Exception(string.Format(Properties.Resources.InvalidExcludedDetectionTypeSet, DetectionType.None));
                }
            }
            return excludedDetectionTypes;
        }