Baku.LibqiDotNet.QiSignatureValidityChecker.GetHeadToken C# (CSharp) Method

GetHeadToken() private static method

private static GetHeadToken ( string src, bool &success ) : string
src string
success bool
return string
        private static string GetHeadToken(string src, out bool success)
        {
            string s = src[0].ToString();
            if (s == QiSignatures.TypeDynamic || EmbeddedTypeQiSignatures.Contains(s))
            {
                success = true;
                return s;
            }


            if (s == QiSignatures.TypeListBegin)
            {
                int index = GetContainerTokenEndIndex(src, QiSignatures.TypeListBegin, QiSignatures.TypeListEnd, out success);
                if (index > 0)
                {
                    return src.Substring(0, index + 1);
                }
            }
            if (s == QiSignatures.TypeMapBegin)
            {
                int index = GetContainerTokenEndIndex(src, QiSignatures.TypeMapBegin, QiSignatures.TypeMapEnd, out success);
                if (index > 0)
                {
                    return src.Substring(0, index + 1);
                }
            }
            if (s == QiSignatures.TypeTupleBegin)
            {
                int index = GetContainerTokenEndIndex(src, QiSignatures.TypeTupleBegin, QiSignatures.TypeTupleEnd, out success);
                if (index > 0)
                {
                    return src.Substring(0, index + 1);
                }
            }

            throw new InvalidOperationException($"could not found signature token properly: {src}");

        }