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); }
/// <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); } }
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; }
/// <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; } }