SkipSpare() публичный Метод

Skip over the spare, discarding the contents
public SkipSpare ( ) : void
Результат void
Пример #1
0
        public object Read(Object target, BlobReader reader)
        {
            object[] args = new object[1];

            using (reader = reader.ReadFieldBlob())
            {
                while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
                {
                    reader.ReadFieldHeader();

                    // if there are no data bytes, we can "probably" assume that the keys are the values
                    if (reader.FieldDataBytes > 0)
                    {
                        args[0] = from.Read(target, reader);
                    }
                    else
                    {
                        // only handles ints, refactor this probably
                        args[0] = BitConverter.ToInt32(reader.ByteKey, 0);
                    }

                    add.Invoke(target, args);
                }

                reader.SkipSpare();
            }
            return null;
        }
Пример #2
0
        public object Read(Object target, BlobReader reader)
        {
            object[] args = new object[2];

            using (reader = reader.ReadFieldBlob())
            {
                while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
                {
                    reader.ReadFieldHeader();

                    switch (Type.GetTypeCode(leftType))
                    {
                    case TypeCode.Int32:
                        args[0] = BitConverter.ToInt32(reader.ByteKey, 0);
                        break;

                    case TypeCode.String:
                        args[0] = Encoding.ASCII.GetString(reader.ByteKey, 0, reader.FieldKeyBytes);
                        break;

                    default:
                        throw new NotImplementedException();
                    }

                    args[1] = from.Read(target, reader);
                    add.Invoke(target, args);
                }

                reader.SkipSpare();
            }

            return(null);
        }
Пример #3
0
        public object Read(Object target, BlobReader reader)
        {
            object[] args = new object[2];

            using (reader = reader.ReadFieldBlob())
            {
                while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
                {
                    reader.ReadFieldHeader();

                    switch (Type.GetTypeCode(leftType))
                    {
                        case TypeCode.Int32:
                            args[0] = BitConverter.ToInt32(reader.ByteKey, 0);
                            break;
                        case TypeCode.String:
                            args[0] = Encoding.ASCII.GetString(reader.ByteKey, 0, reader.FieldKeyBytes);
                            break;
                        default:
                            throw new NotImplementedException();
                    }

                    args[1] = from.Read(target, reader);
                    add.Invoke(target, args);
                }

                reader.SkipSpare();
            }

            return null;
        }
Пример #4
0
        public object Read(Object target, BlobReader reader)
        {
            if(target != null)
                reader = reader.ReadFieldBlob();

            object result = Activator.CreateInstance(targetType);

            read_field:
            while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
            {
                reader.ReadFieldHeader();

                for(int i = 0; i < fields.Length; i++)
                {
                    var field = fields[i];

                    if ((field.PeekIntKey != -1 && field.PeekIntKey == reader.PeekIntKey) || 
                        (field.ByteKey.Length == reader.FieldKeyBytes && BlobUtil.UnsafeCompare(field.ByteKey, reader.ByteKey)))
                    {
                        field.Serializer.Read(result, reader);
                        goto read_field;
                    }
                }

                reader.SkipField();
            }

            reader.SkipSpare();

            if (target != null)
                reader.Dispose();

            return result;
        }
Пример #5
0
        public object Read(Object target, BlobReader reader)
        {
            object[] args = new object[1];

            using (reader = reader.ReadFieldBlob())
            {
                while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
                {
                    reader.ReadFieldHeader();

                    // if there are no data bytes, we can "probably" assume that the keys are the values
                    if (reader.FieldDataBytes > 0)
                    {
                        args[0] = from.Read(target, reader);
                    }
                    else
                    {
                        // only handles ints, refactor this probably
                        args[0] = BitConverter.ToInt32(reader.ByteKey, 0);
                    }

                    add.Invoke(target, args);
                }

                reader.SkipSpare();
            }
            return(null);
        }
Пример #6
0
        public object Read(Object target, BlobReader reader)
        {
            if (target != null)
            {
                reader = reader.ReadFieldBlob();
            }

            object result = Activator.CreateInstance(targetType);

read_field:
            while (reader.CanTakeBytes(BlobReader.FieldHeaderLength))
            {
                reader.ReadFieldHeader();

                for (int i = 0; i < fields.Length; i++)
                {
                    var field = fields[i];

                    if ((field.PeekIntKey != -1 && field.PeekIntKey == reader.PeekIntKey) ||
                        (field.ByteKey.Length == reader.FieldKeyBytes && BlobUtil.UnsafeCompare(field.ByteKey, reader.ByteKey)))
                    {
                        field.Serializer.Read(result, reader);
                        goto read_field;
                    }
                }

                reader.SkipField();
            }

            reader.SkipSpare();

            if (target != null)
            {
                reader.Dispose();
            }

            return(result);
        }