/// <summary> /// Writes the body. /// </summary> /// <param name="writer">The writer.</param> protected override void WriteBody(WireProtocolWriter writer) { writer.Write(0); writer.WriteNullTerminated(FullNameSpace); writer.Write(DeleteQuery.HasOid() ? 1 : 0); WriteDBObject(writer, DeleteQuery); }
/// <summary> /// Writes the body. /// </summary> /// <param name="writer">The writer.</param> protected override void WriteBody(WireProtocolWriter writer) { writer.Write(0); writer.WriteNullTerminated(Cursor.Options.Collection.FullName); writer.Write(Cursor.Options.NumberToReturn); writer.Write(Cursor.CursorID.Value); }
/// <summary> /// Writes the body. /// </summary> /// <param name="writer">The writer.</param> protected override void WriteBody(WireProtocolWriter writer) { writer.Write(0); writer.Write(this.CursorIDs.Count); foreach (long cursorID in CursorIDs) { writer.Write(cursorID); } }
/// <summary> /// Writes the body. /// </summary> /// <param name="writer">The writer.</param> protected override void WriteBody(WireProtocolWriter writer) { writer.Write((int)Options.Flags); writer.WriteNullTerminated(Options.Collection.FullName); writer.Write(Options.NumberToSkip.HasValue ? Options.NumberToSkip.Value : 0); writer.Write(Options.NumberToReturn); writer.Write(Options.Selector); if (Options.ReturnFields != null) writer.Write(Options.ReturnFields); }
public void TestWriteInt() { MemoryStream ms = new MemoryStream(); WireProtocolWriter writer = new WireProtocolWriter(ms); string expected = "01-00-00-00"; writer.Write(1); string hexdump = BitConverter.ToString(ms.ToArray()); Assert.AreEqual(expected, hexdump); }
public void TestWriteArrayDoc() { String expected = "2000000002300002000000610002310002000000620002320002000000630000"; MemoryStream ms = new MemoryStream(); WireProtocolWriter writer = new WireProtocolWriter(ms); String[] str = new String[] { "a", "b", "c" }; writer.Write(new DBObjectArray((IList)str)); string hexdump = BitConverter.ToString(ms.ToArray()); hexdump = hexdump.Replace("-", ""); Assert.AreEqual(expected, hexdump); }
public void TestWriteDocument() { MemoryStream ms = new MemoryStream(); WireProtocolWriter writer = new WireProtocolWriter(ms); string expected = "1400000002746573740005000000746573740000"; DBObject doc = new DBObject("test", "test"); writer.Write(doc); string hexdump = BitConverter.ToString(ms.ToArray()); hexdump = hexdump.Replace("-", ""); Assert.AreEqual(expected, hexdump); }
/// <summary> /// Writes the body. /// </summary> /// <param name="writer">The writer.</param> protected override void WriteBody(WireProtocolWriter writer) { writer.Write(0); writer.WriteNullTerminated(FullNameSpace); writer.Write((int)Flags); writer.Write(Selector); writer.Write(Document); }
/// <summary> /// Writes the body. /// </summary> /// <param name="writer">The writer.</param> protected override void WriteBody(WireProtocolWriter writer) { writer.Write(0); writer.WriteNullTerminated(FullCollectionName); foreach (IDBObject document in _documents) { WriteDBObject(writer, document); } }
/// <summary> /// Writes the DB object. /// </summary> /// <param name="writer">The writer.</param> /// <param name="dbo">The dbo.</param> protected virtual void WriteDBObject(WireProtocolWriter writer, IDBObject dbo) { writer.Write(dbo); }
/// <summary> /// Writes the specified writer. /// </summary> /// <param name="writer">The writer.</param> public void Write(WireProtocolWriter writer) { //Write the header int start = writer.Position; writer.Write(MessageLength); //placeholder for size writer.Write(RequestID); writer.Write(ResponseTo); writer.Write((int)OpCode); //Write the payload WriteBody(writer); int finish = writer.Position; writer.Seek(start, SeekOrigin.Begin); MessageLength = finish - start; writer.Write(MessageLength); writer.Seek(finish, SeekOrigin.Begin); }