Пример #1
0
        protected bool ValidatingFrameID(string FrameIdentifier, ValidatingErrorTypes ErrorType)
        {
            bool IsValid = FramesInfo.IsValidFrameID(FrameIdentifier);

            if (!IsValid)
            {
                if (ErrorType == ValidatingErrorTypes.Exception)
                {
                    throw (new ArgumentException("FrameID must be 4 capital letters"));
                }
                else if (ErrorType == ValidatingErrorTypes.ID3Error)
                {
                    ErrorOccur(FrameIdentifier + " is not valid FrameID", true);
                }
            }

            return(IsValid);
        }
Пример #2
0
        /// <summary>
        /// Indicate is value of Enumeration valid for that enum
        /// </summary>
        /// <param name="Enumeration">Enumeration to control value for</param>
        /// <param name="ErrorType">if not valid how error occur</param>
        /// <returns>true if valid otherwise false</returns>
        protected bool IsValidEnumValue(Enum Enumeration, ValidatingErrorTypes ErrorType)
        {
            if (Enum.IsDefined(Enumeration.GetType(), Enumeration))
            {
                return(true);
            }
            else
            {
                if (ErrorType == ValidatingErrorTypes.ID3Error)
                {
                    ErrorOccur(Enumeration.ToString() +
                               " is out of range of " + Enumeration.GetType().ToString(), true);
                }
                else if (ErrorType == ValidatingErrorTypes.Exception)
                {
                    throw (new ArgumentOutOfRangeException(Enumeration.ToString() +
                                                           " is out of range of " + Enumeration.GetType().ToString()));
                }

                return(false);
            }
        }
Пример #3
0
        protected bool ValidatingFrameID(string FrameIdentifier, ValidatingErrorTypes ErrorType)
        {
            bool IsValid = FramesInfo.IsValidFrameID(FrameIdentifier);

            if (!IsValid)
            {
                if (ErrorType == ValidatingErrorTypes.Exception)
                    throw (new ArgumentException("FrameID must be 4 capital letters"));
                else if (ErrorType == ValidatingErrorTypes.ID3Error)
                    ErrorOccur(FrameIdentifier + " is not valid FrameID", true);
            }

            return IsValid;
        }
Пример #4
0
        /// <summary>
        /// Indicate is value of Enumeration valid for that enum
        /// </summary>
        /// <param name="Enumeration">Enumeration to control value for</param>
        /// <param name="ErrorType">if not valid how error occur</param>
        /// <returns>true if valid otherwise false</returns>
        protected bool IsValidEnumValue(Enum Enumeration, ValidatingErrorTypes ErrorType)
        {
            if (Enum.IsDefined(Enumeration.GetType(), Enumeration))
                return true;
            else
            {
                if (ErrorType == ValidatingErrorTypes.ID3Error)
                {
                    ErrorOccur(Enumeration.ToString() +
                        " is out of range of " + Enumeration.GetType().ToString(), true);
                }
                else if (ErrorType == ValidatingErrorTypes.Exception)
                    throw (new ArgumentOutOfRangeException(Enumeration.ToString() +
                        " is out of range of " + Enumeration.GetType().ToString()));

                return false;
            }
        }