Exemple #1
0
 public static unsafe void SetRawValue(this ICorDebugGenericValue corGenVal, byte[] value)
 {
     if (corGenVal.GetSize() != value.Length)
     {
         throw new ArgumentException("Incorrect length");
         fixed(byte *pValue = value)
         corGenVal.SetValue(new IntPtr(pValue));
 }
Exemple #2
0
        // ICorDebugGenericValue

        public static unsafe Byte[] GetRawValue(this ICorDebugGenericValue corGenVal)
        {
            byte[] retValue = new byte[(int)corGenVal.GetSize()];

            fixed(byte *pRetValue = retValue)
            corGenVal.GetValue(new IntPtr(pRetValue));

            return(retValue);
        }
Exemple #3
0
        public static unsafe object GetValue(this ICorDebugGenericValue corGenVal, Type type)
        {
            object retValue;

            byte[] value = new byte[(int)corGenVal.GetSize()];
            fixed(byte *pValue = value)
            {
                corGenVal.GetValue(new IntPtr(pValue));
                switch (type.FullName)
                {
                case "System.Boolean": retValue = *((System.Boolean *)pValue); break;

                case "System.Char": retValue = *((System.Char *)pValue); break;

                case "System.SByte": retValue = *((System.SByte *)pValue); break;

                case "System.Byte": retValue = *((System.Byte *)pValue); break;

                case "System.Int16": retValue = *((System.Int16 *)pValue); break;

                case "System.UInt16": retValue = *((System.UInt16 *)pValue); break;

                case "System.Int32": retValue = *((System.Int32 *)pValue); break;

                case "System.UInt32": retValue = *((System.UInt32 *)pValue); break;

                case "System.Int64": retValue = *((System.Int64 *)pValue); break;

                case "System.UInt64": retValue = *((System.UInt64 *)pValue); break;

                case "System.Single": retValue = *((System.Single *)pValue); break;

                case "System.Double": retValue = *((System.Double *)pValue); break;

                case "System.IntPtr": retValue = *((System.IntPtr *)pValue); break;

                case "System.UIntPtr": retValue = *((System.UIntPtr *)pValue); break;

                default: throw new NotSupportedException();
                }
            }

            return(retValue);
        }
Exemple #4
0
 internal CorGenericValue(ICorDebugGenericValue genericValue)
     : base(genericValue)
 {
     m_genVal = genericValue;
 }
Exemple #5
0
 public static unsafe void SetValue(this ICorDebugGenericValue corGenVal, object value)
 {
     if (value == null)
         throw new ArgumentNullException("value"); }
Exemple #6
0
 internal CorGenericValue(ICorDebugGenericValue genericValue)
     : base(genericValue)
 {
     m_genVal = genericValue;
 }
 private static string GetGenericValue(ICorDebugGenericValue gvalue, CorElementType type)
 {
     uint size = 0;
     StringBuilder sb = new StringBuilder();
     gvalue.GetSize(out size);
     unsafe {
     byte[] corValue = new byte[size];
     fixed (byte* pValue = corValue) {
         gvalue.GetValue(new IntPtr(pValue));
         switch (type){
             case CorElementType.ELEMENT_TYPE_BOOLEAN: sb.Append((*((System.Boolean*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_CHAR: sb.Append((*((System.Char*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_I1: sb.Append((*((System.SByte*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_U1: sb.Append((*((System.Byte*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_I2: sb.Append((*((System.Int16*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_U2: sb.Append((*((System.UInt16*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_I4: sb.Append((*((System.Int32*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_U4: sb.Append((*((System.UInt32*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_I8: sb.Append((*((System.Int64*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_U8: sb.Append((*((System.UInt64*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_R4: sb.Append((*((System.Single*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_R8: sb.Append((*((System.Double*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_PTR: sb.Append((*((System.IntPtr*)pValue)).ToString()); break;
             case CorElementType.ELEMENT_TYPE_U: sb.Append((*((System.UIntPtr*)pValue)).ToString()); break;
             default: sb.Append("Type is not known"); break;
         }
     }
     }
     return sb.ToString();
 }