Microsoft.Protocols.TestSuites.MS_OXCROPS.MS_OXCROPSAdapter.IsGUID C# (CSharp) Method

IsGUID() private method

Verify whether the GUID bytes is GUID or not
private IsGUID ( byte guidBytes ) : bool
guidBytes byte An array of bytes.
return bool
        private bool IsGUID(byte[] guidBytes)
        {
            bool isGUID = false;

            // Check GUID length with 16.
            if (guidBytes.Length == 16)
            {
                Guid guid = new Guid(guidBytes);

                // GUID format check regExpression.
                string regexPatten = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\"
                    + @"-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$";
                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(regexPatten);
                string guidStr = guid.ToString();
                isGUID = regex.IsMatch(guidStr);
            }

            return isGUID;
        }
MS_OXCROPSAdapter