コード例 #1
0
        private NuGenMashallingDescriptorItem ReadNativeType()
        {
            NuGenMashallingDescriptorItem result = new NuGenMashallingDescriptorItem();

            uint data;

            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));

            result.NativeType   = (CorNativeType)data;
            result.IsNativeType = true;

            switch (result.NativeType)
            {
            case CorNativeType.NATIVE_TYPE_SAFEARRAY:
                result.NextItem = ReadVariantType();
                break;

            case CorNativeType.NATIVE_TYPE_CUSTOMMARSHALER:
                result.Guid          = ReadString();
                result.UnmanagedType = ReadString();
                result.ManagedType   = ReadString();
                result.Cookie        = ReadString();
                break;

            case CorNativeType.NATIVE_TYPE_ARRAY:
                result.NextItem = ReadNativeType();

                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.ParamNumber = (int)data;

                if (result.ParamNumber > ParameterCount)
                {
                    result.ParamNumber = -1;
                }

                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.ElemMultiply = (int)data;

                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.NumberElem = (int)data;
                break;

            case CorNativeType.NATIVE_TYPE_FIXEDSYSSTRING:
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.NumberElem = (int)data;
                break;

            case CorNativeType.NATIVE_TYPE_FIXEDARRAY:
                NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));
                result.NumberElem = (int)data;

                result.NextItem = ReadNativeType();
                break;
            }

            return(result);
        }
コード例 #2
0
        private NuGenMashallingDescriptorItem ReadVariantType()
        {
            NuGenMashallingDescriptorItem result = new NuGenMashallingDescriptorItem();

            uint data;

            NuGenHelperFunctions.StepIntPtr(ref signatureBlob, NuGenSignatureCompression.CorSigUncompressData(SignatureBlob, out data));

            result.VariantType  = (VariantType)data;
            result.IsNativeType = false;

            return(result);
        }