Exemple #1
0
        private ClrValue[] GetValueList(ICorDebugValueEnum valueEnum)
        {
            uint count;

            valueEnum.GetCount(out count);

            ClrValue[]       result = new ClrValue[count];
            ICorDebugValue[] tmp    = new ICorDebugValue[1];
            uint             fetched;
            int i = 0;

            while (i < result.Length && valueEnum.Next(1, tmp, out fetched) >= 0 && fetched == 1)
            {
                result[i] = new CorDebugValue(_runtime, tmp[0]);
                i++;
            }

            return(result);
        }
Exemple #2
0
        private void GetClrValueAddressAndCodeTypeId(ClrValue clrValue, out ulong address, out int clrTypeId)
        {
            try
            {
                ClrType clrType = clrValue.Type;

                clrTypeId = GetClrTypeId(clrType);
                address   = clrValue.Address;
                if (!clrType.IsPointer)
                {
                    if (clrValue.ElementType == ClrElementType.Class)
                    {
                        address += (uint)IntPtr.Size;
                    }
                }
            }
            catch
            {
                address   = 0;
                clrTypeId = -1;
            }
        }
Exemple #3
0
 private static CompareFilter <ClrValue> Binary(PropertyPath path, CompareOperator @operator, ClrValue value)
 {
     return(new CompareFilter <ClrValue>(path, @operator, value ?? ClrValue.Null));
 }
Exemple #4
0
 public static CompareFilter <ClrValue> In(PropertyPath path, ClrValue value)
 {
     return(Binary(path, CompareOperator.In, value));
 }
Exemple #5
0
 public static CompareFilter <ClrValue> StartsWith(PropertyPath path, ClrValue value)
 {
     return(Binary(path, CompareOperator.StartsWith, value));
 }
Exemple #6
0
 public static CompareFilter <ClrValue> Contains(PropertyPath path, ClrValue value)
 {
     return(Binary(path, CompareOperator.Contains, value));
 }
Exemple #7
0
 public static CompareFilter <ClrValue> Ge(PropertyPath path, ClrValue value)
 {
     return(Binary(path, CompareOperator.GreaterThanOrEqual, value));
 }
Exemple #8
0
 public static CompareFilter <ClrValue> Ne(PropertyPath path, ClrValue value)
 {
     return(Binary(path, CompareOperator.NotEquals, value));
 }
Exemple #9
0
        public static ClrValue Convert(JsonSchema schema, IJsonValue value, PropertyPath path, List <string> errors)
        {
            ClrValue result = null;

            switch (GetType(schema))
            {
            case JsonObjectType.Boolean:
            {
                if (value is JsonArray jsonArray)
                {
                    result = ParseArray <bool>(errors, path, jsonArray, TryParseBoolean);
                }
                else if (TryParseBoolean(errors, path, value, out var temp))
                {
                    result = temp;
                }

                break;
            }

            case JsonObjectType.Integer:
            case JsonObjectType.Number:
            {
                if (value is JsonArray jsonArray)
                {
                    result = ParseArray <double>(errors, path, jsonArray, TryParseNumber);
                }
                else if (TryParseNumber(errors, path, value, out var temp))
                {
                    result = temp;
                }

                break;
            }

            case JsonObjectType.String:
            {
                if (schema.Format == JsonFormatStrings.Guid)
                {
                    if (value is JsonArray jsonArray)
                    {
                        result = ParseArray <Guid>(errors, path, jsonArray, TryParseGuid);
                    }
                    else if (TryParseGuid(errors, path, value, out var temp))
                    {
                        result = temp;
                    }
                }
                else if (schema.Format == JsonFormatStrings.DateTime)
                {
                    if (value is JsonArray jsonArray)
                    {
                        result = ParseArray <Instant>(errors, path, jsonArray, TryParseDateTime);
                    }
                    else if (TryParseDateTime(errors, path, value, out var temp))
                    {
                        result = temp;
                    }
                }
                else
                {
                    if (value is JsonArray jsonArray)
                    {
                        result = ParseArray <string>(errors, path, jsonArray, TryParseString);
                    }
                    else if (TryParseString(errors, path, value, out var temp))
                    {
                        result = temp;
                    }
                }

                break;
            }

            default:
            {
                errors.Add($"Unsupported type {schema.Type} for {path}.");
                break;
            }
            }

            return(result);
        }