コード例 #1
0
ファイル: DmdSignatureReader.cs プロジェクト: xi4oyu/dnSpy
 public static (DmdType fieldType, DmdMethodSignature methodSignature, bool containedGenericParams) ReadMethodSignatureOrFieldType(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool resolve)
 {
     try {
         using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) {
             var flags = (DmdSignatureCallingConvention)reader.ReadByte();
             if ((flags & DmdSignatureCallingConvention.Mask) == DmdSignatureCallingConvention.Field)
             {
                 var fieldType = sigReader.ReadType().type;
                 return(fieldType, null, sigReader.containedGenericParams);
             }
             else
             {
                 sigReader.ReadMethodSignature(flags, out var genericParameterCount, out var returnType, out var parameterTypes, out var varArgsParameterTypes);
                 if ((flags & DmdSignatureCallingConvention.Mask) != DmdSignatureCallingConvention.Property)
                 {
                     var methodSignature = new DmdMethodSignature(flags, genericParameterCount, returnType, parameterTypes, varArgsParameterTypes);
                     return(null, methodSignature, sigReader.containedGenericParams);
                 }
             }
         }
     }
     catch (IOException) {
     }
     catch (OutOfMemoryException) {
     }
     return(module.AppDomain.System_Void, null, false);
 }
コード例 #2
0
ファイル: DmdSignatureReader.cs プロジェクト: xi4oyu/dnSpy
 public static (DmdType fieldType, bool containedGenericParams) ReadFieldSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, bool resolve)
 {
     try {
         using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, null, resolve)) {
             var fieldType = sigReader.ReadFieldSignature();
             return(fieldType, sigReader.containedGenericParams);
         }
     }
     catch (IOException) {
     }
     catch (OutOfMemoryException) {
     }
     return(module.AppDomain.System_Void, false);
 }
コード例 #3
0
ファイル: DmdSignatureReader.cs プロジェクト: xi4oyu/dnSpy
 public static (DmdType[] types, bool containedGenericParams) ReadMethodSpecSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool resolve)
 {
     try {
         using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) {
             var types = sigReader.ReadInstantiation();
             return(types, sigReader.containedGenericParams);
         }
     }
     catch (IOException) {
     }
     catch (OutOfMemoryException) {
     }
     return(Array.Empty <DmdType>(), false);
 }
コード例 #4
0
ファイル: DmdSignatureReader.cs プロジェクト: xi4oyu/dnSpy
        public static (DmdMethodSignature methodSignature, bool containedGenericParams) ReadMethodSignature(DmdModule module, DmdDataStream reader, IList <DmdType> genericTypeArguments, IList <DmdType> genericMethodArguments, bool isProperty, bool resolve)
        {
            try {
                using (var sigReader = new DmdSignatureReader(module, reader, genericTypeArguments, genericMethodArguments, resolve)) {
                    sigReader.ReadMethodSignature(out var flags, out var genericParameterCount, out var returnType, out var parameterTypes, out var varArgsParameterTypes);
                    if (((flags & DmdSignatureCallingConvention.Mask) == DmdSignatureCallingConvention.Property) == isProperty)
                    {
                        var methodSignature = new DmdMethodSignature(flags, genericParameterCount, returnType, parameterTypes, varArgsParameterTypes);
                        return(methodSignature, sigReader.containedGenericParams);
                    }
                }
            }
            catch (IOException) {
            }
            catch (OutOfMemoryException) {
            }
            var dummySig = new DmdMethodSignature(isProperty ? DmdSignatureCallingConvention.Property : DmdSignatureCallingConvention.Default, 0, module.AppDomain.System_Void, null, null);

            return(dummySig, false);
        }