Example #1
0
 public IType this[SystemTypeCode typeCode]
 {
     get
     {
         int index = (int)typeCode;
         return(_types[index] ?? (_types[index] = Resolve(typeCode)));
     }
 }
Example #2
0
        private static object ReadValue(BufferedBinaryReader reader, SystemTypeCode type)
        {
            switch (type)
            {
            case SystemTypeCode.Boolean:
                return(reader.ReadBoolean());

            case SystemTypeCode.Int8:
                return(reader.ReadInt8());

            case SystemTypeCode.UInt8:
                return(reader.ReadUInt8());

            case SystemTypeCode.Int16:
                return(reader.ReadInt16());

            case SystemTypeCode.UInt16:
                return(reader.ReadUInt16());

            case SystemTypeCode.Int32:
                return(reader.ReadInt32());

            case SystemTypeCode.UInt32:
                return(reader.ReadUInt32());

            case SystemTypeCode.Int64:
                return(reader.ReadInt64());

            case SystemTypeCode.UInt64:
                return(reader.ReadUInt64());

            case SystemTypeCode.Single:
                return(reader.ReadSingle());

            case SystemTypeCode.Double:
                return(reader.ReadDouble());

            case SystemTypeCode.Decimal:
                throw new NotImplementedException();

            case SystemTypeCode.DateTime:
                throw new NotImplementedException();

            case SystemTypeCode.Char:
                return(reader.ReadChar());

            case SystemTypeCode.String:
                return(reader.ReadCountedUtf8());

            case SystemTypeCode.Enum:
                throw new NotImplementedException();

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #3
0
        public static List <object> ReadArrayValues(IField f, SystemTypeCode type)
        {
            var reader = f.GetBlob();

            if (reader == null)
            {
                throw new ArgumentException("Invalid value of field. Value must be blob.", "f");
            }

            var vals = new List <object>();

            while (reader.Position < reader.Length)
            {
                var value = ReadValue(reader, type);
                vals.Add(value);
            }

            return(vals);
        }
Example #4
0
 public static IType ResolveSystemType(this Code code, SystemTypeCode typeCode)
 {
     return(code.Method.DeclaringType.SystemType(typeCode));
 }
Example #5
0
 private static IType ResolveSystemType(IType arrayType, SystemTypeCode typeCode)
 {
     return(arrayType.SystemType(typeCode));
 }
Example #6
0
 internal IType SysType(SystemTypeCode typeCode)
 {
     return(SystemTypes[typeCode]);
 }
Example #7
0
 public static IType ResolveSystemType(this MethodContext context, SystemTypeCode typeCode)
 {
     return(context.Method.DeclaringType.SystemType(typeCode));
 }
Example #8
0
        private static string GetFullName(SystemTypeCode typeCode)
        {
            var sysType = Types[(int)typeCode];

            return(sysType.FullName);
        }
Example #9
0
        private IType Resolve(SystemTypeCode typeCode)
        {
            var fullName = GetFullName(typeCode);

            return(_assembly.FindType(fullName));
        }
Example #10
0
        public static bool Is(this IType type, SystemTypeCode typeCode)
        {
            var st = type.SystemType();

            return(st != null && st.Code == typeCode);
        }
Example #11
0
 public static IType SystemType(this IType type, SystemTypeCode typeCode)
 {
     return(type != null ? type.Assembly.SystemTypes[typeCode] : null);
 }
Example #12
0
 public SystemType(SystemTypeCode code, string name)
 {
     Code = code;
     Name = name;
 }