protected override void WriteBody(BsonWriter writer) { writer.WriteValue(BsonDataType.Integer,0); writer.WriteString(this.FullCollectionName); writer.WriteValue(BsonDataType.Integer,0); writer.Write(this.Selector); }
protected override void WriteBody(BsonWriter writer) { writer.WriteValue(BsonDataType.Integer,0); writer.WriteString(this.FullCollectionName); writer.WriteValue(BsonDataType.Integer,this.NumberToReturn); writer.WriteValue(BsonDataType.Long,this.CursorID); }
public void TestWriteString() { MemoryStream ms = new MemoryStream(); BsonWriter writer = new BsonWriter(ms); string expected = "54-65-73-74-73-2E-69-6E-73-65-72-74-73-00"; writer.WriteString("Tests.inserts"); string hexdump = BitConverter.ToString(ms.ToArray()); Assert.AreEqual(expected, hexdump); }
/// <summary> /// Writes out a header and the chunk of documents. /// </summary> /// <param name="stream"></param> /// <param name="chunk"></param> protected void WriteChunk(Stream stream, MessageChunk chunk) { WriteHeader(new BinaryWriter(stream), chunk.Size); BsonWriter writer = new BsonWriter(stream); writer.WriteValue(BsonDataType.Integer,0); writer.WriteString(this.FullCollectionName); foreach(Document doc in chunk.Documents){ writer.Write(doc); } writer.Flush(); }
protected override void WriteBody(BsonWriter writer) { writer.WriteValue(BsonDataType.Integer,(int)this.Options); writer.WriteString(this.FullCollectionName); writer.WriteValue(BsonDataType.Integer,(int)this.NumberToSkip); writer.WriteValue(BsonDataType.Integer,(int)this.NumberToReturn); writer.Write(this.Query); if(this.ReturnFieldSelector != null){ writer.Write(this.ReturnFieldSelector); } }
protected override void WriteBody(BsonWriter writer) { writer.WriteString(this.Message); }
private string WriteStringAndGetHex(string val) { MemoryStream ms = new MemoryStream(); BsonWriter writer = new BsonWriter(ms); writer.WriteString(val); return BitConverter.ToString(ms.ToArray()); }
private string WriteAndReadLenString(string val) { MemoryStream ms = new MemoryStream(); BsonWriter bs = new BsonWriter(ms); BinaryWriter w = new BinaryWriter(ms); int byteCount = bs.CalculateSize(val,false); w.Write(byteCount); bs.WriteString(val); ms.Seek(0,SeekOrigin.Begin); BsonReader reader = new BsonReader(ms); return reader.ReadLenString(); }