Пример #1
0
        /// <summary>
        /// Parses the specified provider.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        public static MethodSignature Parse(IMetadataProvider provider, TokenTypes token)
        {
            byte[] buffer;
            int    index = 0;

            provider.Read(token, out buffer);
            MethodSignature msig = new MethodSignature(token);

            msig.ParseSignature(buffer, ref index);
            Debug.Assert(index == buffer.Length, @"Signature parser didn't complete.");
            return(msig);
        }
Пример #2
0
        /// <summary>
        /// Froms the member ref signature token.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        public static Signature FromMemberRefSignatureToken(ISignatureContext context, IMetadataProvider provider, TokenTypes token)
        {
            Signature result;
            int index = 0;
            byte[] buffer;
            provider.Read(token, out buffer);

            if (0x06 == buffer[0])
            {
                result = new FieldSignature();
                result.ParseSignature(context, buffer, ref index);
            }
            else
            {
                result = new MethodSignature();
                result.ParseSignature(context, buffer, ref index);
            }
            Debug.Assert(index == buffer.Length, @"Not all signature bytes read.");
            return result;
        }
Пример #3
0
        /// <summary>
        /// Froms the member ref signature token.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        public static Signature FromMemberRefSignatureToken(IMetadataProvider provider, TokenTypes token)
        {
            Signature result;
            int       index = 0;

            byte[] buffer;
            provider.Read(token, out buffer);

            if (0x6 == buffer[0])
            {
                result = new FieldSignature();
                result.ParseSignature(buffer, ref index);
            }
            else
            {
                result = new MethodSignature(token);
                result.ParseSignature(buffer, ref index);
            }
            Debug.Assert(index == buffer.Length, "Not all signature bytes read.");
            return(result);
        }
Пример #4
0
 /// <summary>
 /// Parses the specified provider.
 /// </summary>
 /// <param name="provider">The provider.</param>
 /// <param name="token">The token.</param>
 /// <returns></returns>
 public static MethodSignature Parse(IMetadataProvider provider, TokenTypes token)
 {
     byte[] buffer;
     int index = 0;
     provider.Read(token, out buffer);
     MethodSignature msig = new MethodSignature(token);
     msig.ParseSignature(buffer, ref index);
     Debug.Assert(index == buffer.Length, @"Signature parser didn't complete.");
     return msig;
 }