protected RuntimeValue(Engine eng, WireProtocol.Commands.Debugging_Value handle)// where T : MFDevice { m_eng = eng; m_handle = handle; switch ((RuntimeDataType)handle.m_dt) { case RuntimeDataType.DATATYPE_BOOLEAN: m_corElementType = CorElementType.ELEMENT_TYPE_BOOLEAN; break; case RuntimeDataType.DATATYPE_I1: m_corElementType = CorElementType.ELEMENT_TYPE_I1; break; case RuntimeDataType.DATATYPE_U1: m_corElementType = CorElementType.ELEMENT_TYPE_U1; break; case RuntimeDataType.DATATYPE_CHAR: m_corElementType = CorElementType.ELEMENT_TYPE_CHAR; break; case RuntimeDataType.DATATYPE_I2: m_corElementType = CorElementType.ELEMENT_TYPE_I2; break; case RuntimeDataType.DATATYPE_U2: m_corElementType = CorElementType.ELEMENT_TYPE_U2; break; case RuntimeDataType.DATATYPE_I4: m_corElementType = CorElementType.ELEMENT_TYPE_I4; break; case RuntimeDataType.DATATYPE_U4: m_corElementType = CorElementType.ELEMENT_TYPE_U4; break; case RuntimeDataType.DATATYPE_R4: m_corElementType = CorElementType.ELEMENT_TYPE_R4; break; case RuntimeDataType.DATATYPE_I8: m_corElementType = CorElementType.ELEMENT_TYPE_I8; break; case RuntimeDataType.DATATYPE_U8: m_corElementType = CorElementType.ELEMENT_TYPE_U8; break; case RuntimeDataType.DATATYPE_R8: m_corElementType = CorElementType.ELEMENT_TYPE_R8; break; case RuntimeDataType.DATATYPE_DATETIME: m_corElementType = CorElementType.ELEMENT_TYPE_VALUETYPE; break; case RuntimeDataType.DATATYPE_TIMESPAN: m_corElementType = CorElementType.ELEMENT_TYPE_VALUETYPE; break; case RuntimeDataType.DATATYPE_STRING: m_corElementType = CorElementType.ELEMENT_TYPE_STRING; break; case RuntimeDataType.DATATYPE_OBJECT: m_corElementType = CorElementType.ELEMENT_TYPE_OBJECT; break; case RuntimeDataType.DATATYPE_BYREF: m_corElementType = CorElementType.ELEMENT_TYPE_BYREF; break; case RuntimeDataType.DATATYPE_ARRAY_BYREF: m_corElementType = CorElementType.ELEMENT_TYPE_BYREF; break; case RuntimeDataType.DATATYPE_CLASS: m_corElementType = CorElementType.ELEMENT_TYPE_CLASS; break; case RuntimeDataType.DATATYPE_VALUETYPE: m_corElementType = CorElementType.ELEMENT_TYPE_VALUETYPE; break; case RuntimeDataType.DATATYPE_SZARRAY: m_corElementType = CorElementType.ELEMENT_TYPE_SZARRAY; break; case RuntimeDataType.DATATYPE_REFLECTION: m_corElementType = CorElementType.ELEMENT_TYPE_CLASS; break; case RuntimeDataType.DATATYPE_DELEGATE_HEAD: m_corElementType = CorElementType.ELEMENT_TYPE_CLASS; break; case RuntimeDataType.DATATYPE_DELEGATELIST_HEAD: m_corElementType = CorElementType.ELEMENT_TYPE_CLASS; break; case RuntimeDataType.DATATYPE_WEAKCLASS: m_corElementType = CorElementType.ELEMENT_TYPE_CLASS; break; case RuntimeDataType.DATATYPE_TRANSPARENT_PROXY: m_corElementType = CorElementType.ELEMENT_TYPE_CLASS; break; } }
protected internal RuntimeValue_String(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { byte[] buf = handle.m_builtinValue; if (handle.m_bytesInString >= buf.Length) { var task = m_eng.ReadMemoryAsync(m_handle.m_charsInString, m_handle.m_bytesInString); task.Start(); if (task.Wait(5000)) { if (task.Result.Item2 == false) { // Revert to the preview on failure buf = handle.m_builtinValue; } else { // copy return value back to handler value Array.Copy(task.Result.Item1, 0, handle.m_builtinValue, 0, task.Result.Item1.Length); } } } m_value = WireProtocol.Commands.GetZeroTerminatedString(buf, true); }
protected internal RuntimeValue_String(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { byte[] buf = handle.m_builtinValue; if (handle.m_bytesInString >= buf.Length) { if (m_eng.ReadMemory(m_handle.m_charsInString, m_handle.m_bytesInString, out buf) == false) { // Revert to the preview on failure buf = handle.m_builtinValue; } } m_value = WireProtocol.Commands.GetZeroTerminatedString(buf, true); }
protected internal RuntimeValue_String(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { byte[] buf = handle.m_builtinValue; if (handle.m_bytesInString >= buf.Length) { var result = m_eng.ReadMemory(m_handle.m_charsInString, m_handle.m_bytesInString); if (!result.Success) { // Revert to the preview on failure buf = handle.m_builtinValue; } else { // copy return value back to handler value Array.Copy(result.Buffer, 0, handle.m_builtinValue, 0, result.Buffer.Length); } } m_value = WireProtocol.Commands.GetZeroTerminatedString(buf, true); }
protected internal RuntimeValue_Primitive(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { Type t; switch ((nanoClrDataType)handle.m_dt) { case nanoClrDataType.DATATYPE_BOOLEAN: t = typeof(bool); break; case nanoClrDataType.DATATYPE_I1: t = typeof(sbyte); break; case nanoClrDataType.DATATYPE_U1: t = typeof(byte); break; case nanoClrDataType.DATATYPE_CHAR: t = typeof(char); break; case nanoClrDataType.DATATYPE_I2: t = typeof(short); break; case nanoClrDataType.DATATYPE_U2: t = typeof(ushort); break; case nanoClrDataType.DATATYPE_I4: t = typeof(int); break; case nanoClrDataType.DATATYPE_U4: t = typeof(uint); break; case nanoClrDataType.DATATYPE_R4: t = typeof(float); break; case nanoClrDataType.DATATYPE_I8: t = typeof(long); break; case nanoClrDataType.DATATYPE_U8: t = typeof(ulong); break; case nanoClrDataType.DATATYPE_R8: t = typeof(double); break; default: throw new ArgumentException(String.Format("Not a primitive: {0}", handle.m_dt)); } m_value = Activator.CreateInstance(t); m_eng.CreateConverter().Deserialize(m_value, handle.m_builtinValue); }
protected internal RuntimeValue_Internal(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { }
static protected RuntimeValue Convert(Engine eng, WireProtocol.Commands.Debugging_Value[] array, int pos) { WireProtocol.Commands.Debugging_Value src = array[pos]; if (src == null) { return(null); } switch ((RuntimeDataType)src.m_dt) { case RuntimeDataType.DATATYPE_BOOLEAN: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_I1: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_U1: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_CHAR: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_I2: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_U2: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_I4: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_U4: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_R4: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_I8: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_U8: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_R8: return(new RuntimeValue_Primitive(eng, src)); case RuntimeDataType.DATATYPE_DATETIME: return(new RuntimeValue_ValueType(eng, src)); case RuntimeDataType.DATATYPE_TIMESPAN: return(new RuntimeValue_ValueType(eng, src)); case RuntimeDataType.DATATYPE_STRING: return(new RuntimeValue_String(eng, src)); case RuntimeDataType.DATATYPE_OBJECT: return(new RuntimeValue_Object(eng, array, pos)); case RuntimeDataType.DATATYPE_BYREF: return(new RuntimeValue_ByRef(eng, array, pos)); case RuntimeDataType.DATATYPE_ARRAY_BYREF: return(new RuntimeValue_ByRef(eng, array, pos)); case RuntimeDataType.DATATYPE_CLASS: return(new RuntimeValue_Class(eng, src)); case RuntimeDataType.DATATYPE_VALUETYPE: return(new RuntimeValue_ValueType(eng, src)); case RuntimeDataType.DATATYPE_SZARRAY: return(new RuntimeValue_Array(eng, src)); case RuntimeDataType.DATATYPE_REFLECTION: return(new RuntimeValue_Reflection(eng, src)); case RuntimeDataType.DATATYPE_DELEGATE_HEAD: return(new RuntimeValue_Class(eng, src)); case RuntimeDataType.DATATYPE_DELEGATELIST_HEAD: return(new RuntimeValue_Class(eng, src)); case RuntimeDataType.DATATYPE_WEAKCLASS: return(new RuntimeValue_Class(eng, src)); default: return(new RuntimeValue_Internal(eng, src)); } }
protected internal RuntimeValue_Reflection(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { m_rd = (ReflectionDefinition)System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof(ReflectionDefinition)); m_eng.CreateConverter().Deserialize(m_rd, handle.m_builtinValue); }
protected internal RuntimeValue_Reflection(Engine eng, WireProtocol.Commands.Debugging_Value handle) : base(eng, handle) { m_rd = (ReflectionDefinition)Activator.CreateInstance((typeof(ReflectionDefinition))); m_eng.CreateConverter().Deserialize(m_rd, handle.m_builtinValue); }