Beispiel #1
0
        private JsonSchemaType method_10(Type type_0, Required required_0)
        {
            JsonSchemaType none = JsonSchemaType.None;

            if ((required_0 != Required.Always) && Class194.smethod_9(type_0))
            {
                none = JsonSchemaType.Null;
                if (Class194.smethod_10(type_0))
                {
                    type_0 = Nullable.GetUnderlyingType(type_0);
                }
            }
            Enum17 enum2 = Class181.smethod_0(type_0);

            switch (enum2)
            {
            case Enum17.Empty:
            case Enum17.Object:
                return(none | JsonSchemaType.String);

            case Enum17.Char:
                return(none | JsonSchemaType.String);

            case Enum17.Boolean:
                return(none | JsonSchemaType.Boolean);

            case Enum17.SByte:
            case Enum17.Int16:
            case Enum17.UInt16:
            case Enum17.Int32:
            case Enum17.Byte:
            case Enum17.UInt32:
            case Enum17.Int64:
            case Enum17.UInt64:
            case Enum17.BigInteger:
                return(none | JsonSchemaType.Integer);

            case Enum17.Single:
            case Enum17.Double:
            case Enum17.Decimal:
                return(none | JsonSchemaType.Float);

            case Enum17.DateTime:
            case Enum17.DateTimeOffset:
                return(none | JsonSchemaType.String);

            case Enum17.Guid:
            case Enum17.TimeSpan:
            case Enum17.Uri:
            case Enum17.String:
            case Enum17.Bytes:
                return(none | JsonSchemaType.String);

            case Enum17.DBNull:
                return(none | JsonSchemaType.Null);
            }
            throw new JsonException("Unexpected type code '{0}' for type '{1}'.".smethod_1(CultureInfo.InvariantCulture, enum2, type_0));
        }
Beispiel #2
0
 public JsonPrimitiveContract(Type underlyingType) : base(underlyingType)
 {
     base.enum15_0 = Enum15.Primitive;
     this.Enum17_0 = Class181.smethod_0(underlyingType);
     base.bool_4   = true;
 }
        internal static bool smethod_0(Type type_0)
        {
            Enum17 enum2 = Class181.smethod_0(type_0);

            return((enum2 != Enum17.Empty) && (enum2 != Enum17.Object));
        }