Exemplo n.º 1
0
        private void encodeElement(MemoryStream ms, string name, BSONValue v)
        {
            switch (v.valueType)
            {
            case BSONValue.ValueType.Double:
                ms.WriteByte(0x01);
                this.encodeCString(ms, name);
                this.encodeDouble(ms, v.doubleValue);
                return;

            case BSONValue.ValueType.String:
                ms.WriteByte(0x02);
                this.encodeCString(ms, name);
                this.encodeString(ms, v.stringValue);
                return;

            case BSONValue.ValueType.Object:
                ms.WriteByte(0x03);
                this.encodeCString(ms, name);
                this.encodeDocument(ms, v as BSONObject);
                return;

            case BSONValue.ValueType.Array:
                ms.WriteByte(0x04);
                this.encodeCString(ms, name);
                this.encodeArray(ms, v as BSONArray);
                return;

            case BSONValue.ValueType.Binary:
                ms.WriteByte(0x05);
                this.encodeCString(ms, name);
                this.encodeBinary(ms, v.binaryValue);
                return;

            case BSONValue.ValueType.Boolean:
                ms.WriteByte(0x08);
                this.encodeCString(ms, name);
                this.encodeBool(ms, v.boolValue);
                return;

            case BSONValue.ValueType.UTCDateTime:
                ms.WriteByte(0x09);
                this.encodeCString(ms, name);
                this.encodeUTCDateTime(ms, v.dateTimeValue);
                return;

            case BSONValue.ValueType.None:
                ms.WriteByte(0x0A);
                this.encodeCString(ms, name);
                return;

            case BSONValue.ValueType.Int32:
                ms.WriteByte(0x10);
                this.encodeCString(ms, name);
                this.encodeInt32(ms, v.int32Value);
                return;

            case BSONValue.ValueType.Int64:
                ms.WriteByte(0x12);
                this.encodeCString(ms, name);
                this.encodeInt64(ms, v.int64Value);
                return;
            }
        }
Exemplo n.º 2
0
 public bool Remove(BSONValue v)
 {
     return(this.mList.Remove(v));
 }
Exemplo n.º 3
0
 public override bool Contains(BSONValue v)
 {
     return(this.mList.Contains(v));
 }
Exemplo n.º 4
0
 public int IndexOf(BSONValue item)
 {
     return(this.mList.IndexOf(item));
 }
Exemplo n.º 5
0
 public void Insert(int index, BSONValue item)
 {
     this.mList.Insert(index, item);
 }
Exemplo n.º 6
0
 public bool TryGetValue(string key, out BSONValue value)
 {
     return(this.mMap.TryGetValue(key, out value));
 }
Exemplo n.º 7
0
 // Methods
 public override void Add(BSONValue v)
 {
     this.mList.Add(v);
 }
Exemplo n.º 8
0
 public override bool Contains(BSONValue v)
 {
     return(this.mMap.ContainsValue(v));
 }
Exemplo n.º 9
0
 public override void Add(string key, BSONValue value)
 {
     this.mMap.Add(key, value);
 }
Exemplo n.º 10
0
 public virtual bool Contains(BSONValue v)
 {
     return(false);
 }
Exemplo n.º 11
0
 public virtual void Add(BSONValue value)
 {
 }
Exemplo n.º 12
0
 public virtual void Add(string key, BSONValue value)
 {
 }