/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("streetNum", StreetNumber); writer.WriteInt("flatNum", FlatNumber); writer.WriteString("city", City); writer.WriteString("street", Street); }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { BinaryWriter writer0 = (BinaryWriter) writer.GetRawWriter(); writer0.WithDetach(w => w.WriteObject(_clo)); writer0.WithDetach(w => w.WriteObject(_arg)); }
/// <summary> /// Writes this object to the given writer. /// </summary> /// <param name="writer">Writer.</param> public void WriteBinary(IBinaryWriter writer) { var rawWriter = (BinaryWriter) writer.GetRawWriter(); rawWriter.WriteObject(_filter); rawWriter.WriteBoolean(_keepBinary); }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteByte("Byte", Byte); writer.WriteByteArray("ByteArray", ByteArray); writer.WriteChar("Char", Char); writer.WriteCharArray("CharArray", CharArray); writer.WriteShort("Short", Short); writer.WriteShortArray("ShortArray", ShortArray); writer.WriteInt("Int", Int); writer.WriteIntArray("IntArray", IntArray); writer.WriteLong("Long", Long); writer.WriteLongArray("LongArray", LongArray); writer.WriteBoolean("Boolean", Boolean); writer.WriteBooleanArray("BooleanArray", BooleanArray); writer.WriteFloat("Float", Float); writer.WriteFloatArray("FloatArray", FloatArray); writer.WriteDouble("Double", Double); writer.WriteDoubleArray("DoubleArray", DoubleArray); writer.WriteDecimal("Decimal", Decimal); writer.WriteDecimalArray("DecimalArray", DecimalArray); writer.WriteTimestamp("Date", Date); writer.WriteTimestampArray("DateArray", DateArray); writer.WriteString("String", String); writer.WriteStringArray("StringArray", StringArray); writer.WriteGuid("Guid", Guid); writer.WriteGuidArray("GuidArray", GuidArray); }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { Debug.Assert(writer != null); var writer0 = (BinaryWriter)writer.GetRawWriter(); writer0.WithDetach(w => new BinaryFormatter().Serialize(new BinaryStreamAdapter(w.Stream), Item)); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { var writer0 = (BinaryWriter)writer.GetRawWriter(); writer0.WithDetach(w => w.WriteObject(_pred)); writer0.WriteBoolean(_keepBinary); }
public void WriteBinary(IBinaryWriter writer) { writer.WriteByte("Byte", 1); writer.WriteByteArray("ByteArray", new byte[] {1}); writer.WriteChar("Char", '1'); writer.WriteCharArray("CharArray", new[] {'1'}); writer.WriteShort("Short", 1); writer.WriteShortArray("ShortArray", new short[] {1}); writer.WriteInt("Int", 1); writer.WriteIntArray("IntArray", new[] {1}); writer.WriteLong("Long", 1); writer.WriteLongArray("LongArray", new long[] {1}); writer.WriteBoolean("Boolean", true); writer.WriteBooleanArray("BooleanArray", new[] {true}); writer.WriteFloat("Float", 1); writer.WriteFloatArray("FloatArray", new float[] {1}); writer.WriteDouble("Double", 1); writer.WriteDoubleArray("DoubleArray", new double[] {1}); writer.WriteDecimal("Decimal", 1); writer.WriteDecimalArray("DecimalArray", new decimal?[] {1}); writer.WriteTimestamp("Timestamp", Date); writer.WriteTimestampArray("TimestampArray", new DateTime?[] {Date}); writer.WriteString("String", "1"); writer.WriteStringArray("StringArray", new[] {"1"}); writer.WriteGuid("Guid", Guid); writer.WriteGuidArray("GuidArray", new Guid?[] {Guid}); writer.WriteEnum("Enum", MyEnum.Bar); writer.WriteEnumArray("EnumArray", new[] {MyEnum.Bar}); var raw = writer.GetRawWriter(); raw.WriteByte(1); raw.WriteByteArray(new byte[] {1}); raw.WriteChar('1'); raw.WriteCharArray(new[] {'1'}); raw.WriteShort(1); raw.WriteShortArray(new short[] {1}); raw.WriteInt(1); raw.WriteIntArray(new[] {1}); raw.WriteLong(1); raw.WriteLongArray(new long[] {1}); raw.WriteBoolean(true); raw.WriteBooleanArray(new[] {true}); raw.WriteFloat(1); raw.WriteFloatArray(new float[] {1}); raw.WriteDouble(1); raw.WriteDoubleArray(new double[] {1}); raw.WriteDecimal(1); raw.WriteDecimalArray(new decimal?[] {1}); raw.WriteTimestamp(Date); raw.WriteTimestampArray(new DateTime?[] {Date}); raw.WriteString("1"); raw.WriteStringArray(new[] {"1"}); raw.WriteGuid(Guid); raw.WriteGuidArray(new Guid?[] {Guid}); raw.WriteEnum(MyEnum.Bar); raw.WriteEnumArray(new[] {MyEnum.Bar}); }
/// <summary> /// Write portalbe object. /// </summary> /// <param name="obj">Object.</param> /// <param name="writer">Writer.</param> /// <exception cref="BinaryObjectException">Type is not registered in serializer: + type.Name</exception> public void WriteBinary(object obj, IBinaryWriter writer) { var binarizable = obj as IBinarizable; if (binarizable != null) binarizable.WriteBinary(writer); else GetDescriptor(obj).Write(obj, writer); }
/// <summary> /// Serialize object to stream using specified binary writer. /// </summary> /// <param name="writer">Binary writer (output formatter) object</param> internal override void Serialize(IBinaryWriter writer) { // documents count & content writer.Write(Count); foreach (string content in this) { writer.Write(content); } }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { var writer0 = (BinaryWriter) writer.GetRawWriter(); if (writer0.IsBinarizable(_err)) { writer0.WriteBoolean(true); writer0.WriteObject(_err); } else { writer0.WriteBoolean(false); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(new BinaryStreamAdapter(writer0.Stream), _err); } }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { // No-op. }
public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("mode", mode); switch (mode) { case 1: writer.WriteInt("f2", f2); break; case 2: writer.WriteInt("f2", f2); writer.WriteInt("f3", f3); writer.WriteInt("f4", f4); break; case 3: writer.WriteInt("f2", f2); writer.WriteInt("f3", f3); writer.WriteInt("f5", f5); break; case 4: writer.WriteInt("f2", f2); writer.WriteInt("f3", f3); writer.WriteInt("f5", f5); writer.WriteInt("f6", f6); break; case 5: writer.WriteInt("f2", f2); writer.WriteInt("f3", f3); writer.WriteInt("f7", f7); break; case 6: writer.WriteInt("f8", f8); break; } }
protected virtual void WriteHead(IBinaryWriter writer) { writer.Write(Name); writer.Write((int)FilterType); }
/// <summary> /// Copies the contents of one stream to another. /// </summary> /// <param name="source">The source, to read data from.</param> /// <param name="writer">The destination, to write data to.</param> public static void CopyTo( this Stream source, IBinaryWriter writer ) { Ensure.Debug(source, s => s.NotNull()); Ensure.That(writer).NotNull(); if( !source.CanRead ) throw new ArgumentException("Source stream not readable!").StoreFileLine(); int bytesRead; var buffer = CopyBuffer.Value; while( (bytesRead = source.Read(buffer, 0, buffer.Length)) != 0 ) writer.Write(buffer, 0, bytesRead); }
internal IBinaryWriterAsStream( IBinaryWriter writer ) { if( writer.NullReference() ) throw new ArgumentNullException().StoreFileLine(); this.binaryWriter = writer; }
public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("Int", Int); writer.GetRawWriter().WriteString(Str); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("TestProp", TestProperty); }
/// <summary> /// Releases any resources held by an open writer. /// </summary> /// <param name="writer">The writer of the value.</param> protected override void CloseWriter( IBinaryWriter writer ) { var valueNode = new DataStoreBinaryValue(this.currentValueNodeName, this.memoryStream.ToArray()); this.memoryStream.SetLength(0); this.AddChild(valueNode); }
/// <summary> /// Serialize query parameters to specified writer /// </summary> /// <param name="writer"><see cref="IBinaryWriter"/> writer used to serialize data to underlying stream.</param> internal void Serialize(IBinaryWriter writer) { // offset, limits and match mode writer.Write(Offset); writer.Write(Limit); writer.Write((int)MatchMode); writer.Write((int)RankingMode); if (RankingMode == MatchRankMode.Expression) { writer.Write(RankingExpression); } // sorting writer.Write((int)SortMode); writer.Write(SortBy); writer.Write(Query); // NOTE: don't use deprecated per-field weights list, use FieldWeights instead writer.Write(0); Indexes.Serialize(writer); // documents id range writer.Write((int)IdSize); writer.Write(MinDocumentId); writer.Write(MaxDocumentId); // filters AttributeFilters.Serialize(writer); // grouping writer.Write((int)GroupFunc); writer.Write(GroupBy); writer.Write(MaxMatches); writer.Write(GroupSort); // cutoff writer.Write(Cutoff); // retry writer.Write(RetryCount); writer.Write(RetryDelay); // group distinct writer.Write(GroupDistinct); // geo anchor GeoAnchor.Serialize(writer); // index weights IndexWeights.Serialize(writer); // max query time writer.Write(MaxQueryTime); // per-field weights FieldWeights.Serialize(writer); // comment writer.Write(Comment); // attribute overrides AttributeOverrides.Serialize(writer); // select clause writer.Write(Select); }
/** <ineritdoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteString("name", Name); writer.WriteString("address", Address); writer.WriteInt("age", Age); }
/// <summary> /// Serialize the message. /// </summary> /// <param name="cout">Cout.</param> public override void Serialize(IBinaryWriter cout) { base.Serialize(cout); cout.WriteString(Message, Encoding.ASCII); }
/// <summary> /// Write object. /// </summary> /// <param name="obj">Object.</param> /// <param name="writer">Writer.</param> public void Write(object obj, IBinaryWriter writer) { int cnt = _wActions.Count; for (int i = 0; i < cnt; i++) _wActions[i](obj, writer); }
public override void WriteAsBinary(IBinaryWriter writer) { writer.WriteIndex(Mode); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { throw new Exception("ExpectedException"); }
protected virtual void WriteTail(IBinaryWriter writer) { writer.Write(Exclude); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { var w = writer.GetRawWriter(); w.WriteInt((int) _factoryType); w.WriteString(_factoryClassName); w.WriteObject(_payload); if (_properties != null) { w.WriteInt(_properties.Count); foreach (var pair in _properties) { w.WriteString(pair.Key); w.WriteObject(pair.Value); } } else w.WriteInt(0); }
/// <summary> /// Wraps the specified <see cref="IBinaryWriter"/>, in <see cref="Stream"/>. /// </summary> /// <param name="binaryWriter">The <see cref="IBinaryWriter"/> to wrap.</param> /// <returns>The disposable wrapper created.</returns> public static Stream Wrap( IBinaryWriter binaryWriter ) { return new IBinaryWriterAsStream(binaryWriter); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { var writer0 = (BinaryWriter)writer.GetRawWriter(); writer0.WriteObjectDetached(Filter); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("TestProp", TestProperty); if (ThrowOnWrite) throw new Exception("Expected exception"); }
public override void WriteAsBinary(IBinaryWriter writer) { }
public override void WriteAsBinary(IBinaryWriter writer) { writer.WriteIndex((int)LineIndicator); writer.WriteIndex((int)DashIndicator); }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.GetRawWriter().WriteString(Msg); }
public override void WriteAsBinary(IBinaryWriter writer) { writer.WriteSizeSpecification(Width, _container.EdgeWidthSpecificationMode); }
/// <summary> /// No implementation for local compute requests /// </summary> public void WriteBinary(IBinaryWriter writer) { }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { Debug.Assert(writer != null); writer.GetRawWriter().WriteLong(_item.ToBinary()); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteDoubleArray("data", _data); }
internal abstract void Serialize(IBinaryWriter writer, long id);
/// <summary> /// Implements the Ignite IBinarizable.WriteBinary interface Ignite will call to serialize this object. /// </summary> public void WriteBinary(IBinaryWriter writer) => ToBinary(writer.GetRawWriter());
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { var writer0 = (BinaryWriter)writer.GetRawWriter(); writer0.WithDetach(w => w.WriteObject(_action)); }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { BinaryWriter writer0 = (BinaryWriter)writer.GetRawWriter(); writer0.WriteObjectDetached(_job); }
public override void WriteAsBinary(IBinaryWriter writer) { writer.WriteBool(IsVisible); }
public override void WriteAsBinary(IBinaryWriter writer) { writer.WriteInt(Min); writer.WriteInt(Max); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.GetRawWriter().WriteInt(_type); }
/// <summary> /// Serializes a value to output stream /// </summary> /// <param name="writer">The write to which value to serialize</param> /// <param name="value">The value to serialize</param> void ISerializer.Serialize(IBinaryWriter writer, object value) { this.Serialize(writer, (byte)value); }
public void WriteBinary(IBinaryWriter writer) { writer.WriteLong("calendarmonth", Calendarmonth); writer.WriteLong("atpseasn", Atpseasn); }
/** <inheritdoc /> */ public void WriteBinary(IBinaryWriter writer) { var w = writer.GetRawWriter(); w.WriteBoolean(ThrowErr); }
public void WriteBinary(IBinaryWriter writer) { writer.WriteLong("ppmonth", Ppmonth); writer.WriteLong("ppweek", Ppweek); writer.WriteLong("country", Country); writer.WriteLong("itemid", Itemid); writer.WriteLong("loadid", Loadid); writer.WriteLong("retailer_item_id", RetailerItemId); writer.WriteString("sku", Sku); writer.WriteLong("itemnumber", Itemnumber); writer.WriteLong("company", Company); writer.WriteLong("classification", Classification); writer.WriteLong("class", Class); writer.WriteLong("channel", Channel); writer.WriteLong("categorytype", Categorytype); writer.WriteLong("superchannel", Superchannel); writer.WriteLong("supercategory", Supercategory); writer.WriteLong("subclass", Subclass); writer.WriteLong("subchannel", Subchannel); writer.WriteLong("category", Category); writer.WriteLong("brandtype", Brandtype); writer.WriteLong("brandfamily", Brandfamily); writer.WriteLong("wearertype", Wearertype); writer.WriteLong("retailerregion", Retailerregion); writer.WriteLong("wearersubtype", Wearersubtype); writer.WriteLong("brand", Brand); writer.WriteLong("wearersize", Wearersize); writer.WriteLong("outlet", Outlet); writer.WriteLong("outletfamily", Outletfamily); writer.WriteLong("wearersegment", Wearersegment); writer.WriteLong("wearergender", Wearergender); writer.WriteLong("introdate", Introdate); writer.WriteLong("itemnumbersuppressednc_org", ItemnumbersuppressedncOrg); writer.WriteLong("itemnumbersuppressed_org", ItemnumbersuppressedOrg); writer.WriteLong("itemnumbersuppressed", Itemnumbersuppressed); writer.WriteLong("brandfamilysuppressed", Brandfamilysuppressed); writer.WriteLong("brandfamilysuppressed_org", BrandfamilysuppressedOrg); writer.WriteLong("brandfamilysuppressednc", Brandfamilysuppressednc); writer.WriteLong("brandfamilysuppressednc_org", BrandfamilysuppressedncOrg); writer.WriteLong("brandsuppressed", Brandsuppressed); writer.WriteLong("brandsuppressed_org", BrandsuppressedOrg); writer.WriteLong("brandsuppressednc", Brandsuppressednc); writer.WriteLong("brandsuppressednc_org", BrandsuppressedncOrg); writer.WriteLong("itemnumbersuppressednc", Itemnumbersuppressednc); writer.WriteLong("brandtypesuppressed", Brandtypesuppressed); writer.WriteLong("brandtypesuppressed_org", BrandtypesuppressedOrg); writer.WriteLong("brandtypesuppressednc", Brandtypesuppressednc); writer.WriteLong("brandtypesuppressednc_org", BrandtypesuppressedncOrg); writer.WriteLong("year", Year); writer.WriteLong("yearhalf", Yearhalf); writer.WriteLong("yearqtr", Yearqtr); writer.WriteLong("yearmonth", Yearmonth); writer.WriteLong("yearweek", Yearweek); writer.WriteLong("distributor", Distributor); writer.WriteLong("stores_in_chain", StoresInChain); writer.WriteLong("stores_selling", StoresSelling); writer.WriteLong("stores_stocking", StoresStocking); writer.WriteString("upc_code", UpcCode); writer.WriteString("upc_type", UpcType); writer.WriteDouble("raw_inventory", RawInventory); writer.WriteDouble("raw_totalvalue", RawTotalvalue); writer.WriteDouble("raw_unitssold", RawUnitssold); writer.WriteDouble("inventory", Inventory); writer.WriteDouble("totalvalue", Totalvalue); writer.WriteDouble("unitssold", Unitssold); writer.WriteDouble("trans", Trans); writer.WriteDouble("proj_inventory", ProjInventory); writer.WriteDouble("proj_totalvalue", ProjTotalvalue); writer.WriteDouble("proj_unitssold", ProjUnitssold); writer.WriteDouble("unit_price", UnitPrice); writer.WriteDouble("proj_unit_price", ProjUnitPrice); writer.WriteDouble("units_per_package", UnitsPerPackage); writer.WriteLong("outletallocation", Outletallocation); writer.WriteDouble("units_adj", UnitsAdj); writer.WriteDouble("actunts_adj", ActuntsAdj); writer.WriteString("upc_codesuppressed", UpcCodesuppressed); writer.WriteDouble("dollars_adj", DollarsAdj); writer.WriteString("itemidsuppressed", Itemidsuppressed); writer.WriteDouble("ractunts_adj", RactuntsAdj); writer.WriteString("upc_codesuppressednc", UpcCodesuppressednc); writer.WriteString("skusuppressednc", Skusuppressednc); writer.WriteDouble("rdollars_adj", RdollarsAdj); writer.WriteLong("retailer_item_idsuppressed", RetailerItemIdsuppressed); writer.WriteLong("retailer_item_idsuppressednc", RetailerItemIdsuppressednc); writer.WriteDouble("runits_adj", RunitsAdj); writer.WriteString("skusuppressed", Skusuppressed); writer.WriteString("itemidsuppressednc", Itemidsuppressednc); writer.WriteDouble("actual_units", ActualUnits); writer.WriteDouble("proj_actual_units", ProjActualUnits); writer.WriteLong("numweeks", Numweeks); writer.WriteLong("allbrandfamilysuppressed", Allbrandfamilysuppressed); writer.WriteLong("allbrandcompanysuppressed", Allbrandcompanysuppressed); writer.WriteLong("allbrandderivedsuppressed", Allbrandderivedsuppressed); writer.WriteLong("allbrandsuppressed", Allbrandsuppressed); writer.WriteLong("retcategorygroupderived", Retcategorygroupderived); writer.WriteLong("rethidsubcategoryderived", Rethidsubcategoryderived); writer.WriteLong("retsubcategoryderived", Retsubcategoryderived); writer.WriteLong("retsupercategoryderived", Retsupercategoryderived); writer.WriteLong("wearerderived", Wearerderived); writer.WriteLong("allbrandderived", Allbrandderived); writer.WriteLong("alloutlet", Alloutlet); writer.WriteLong("allcategoryderived", Allcategoryderived); writer.WriteLong("allbrandcompany", Allbrandcompany); writer.WriteLong("wearergenderderived", Wearergenderderived); writer.WriteLong("allbrand", Allbrand); writer.WriteLong("alloutletderived", Alloutletderived); writer.WriteLong("alloutletfamily", Alloutletfamily); writer.WriteLong("allbrandfamily", Allbrandfamily); writer.WriteLong("allindustry", Allindustry); writer.WriteLong("altbusiness", Altbusiness); writer.WriteLong("allsubcategoryderived", Allsubcategoryderived); writer.WriteLong("allsector", Allsector); writer.WriteLong("retcategoryderived", Retcategoryderived); writer.WriteLong("bbysubclass", Bbysubclass); writer.WriteLong("bbyvplevel", Bbyvplevel); writer.WriteLong("bbymerchantlevel", Bbymerchantlevel); writer.WriteLong("bbydepartment", Bbydepartment); writer.WriteLong("bbyclass", Bbyclass); writer.WriteLong("bbybusinessgroup", Bbybusinessgroup); writer.WriteLong("rid", Rid); writer.WriteLong("posoutlet", Posoutlet); writer.WriteLong("pos_id", PosId); writer.WriteDouble("avg_unit_price", AvgUnitPrice); writer.WriteDouble("avg_prj_unit_price", AvgPrjUnitPrice); writer.WriteDouble("avg_act_unit_price", AvgActUnitPrice); writer.WriteDouble("avg_prj_act_unit_price", AvgPrjActUnitPrice); writer.WriteDouble("avg_prj_act_unit_price_outlet", AvgPrjActUnitPriceOutlet); writer.WriteDouble("avg_act_unit_price_outlet", AvgActUnitPriceOutlet); writer.WriteDouble("avg_act_unit_price_channel", AvgActUnitPriceChannel); writer.WriteDouble("avg_prj_unit_price_channel", AvgPrjUnitPriceChannel); writer.WriteDouble("avg_prj_unit_price_outlet", AvgPrjUnitPriceOutlet); writer.WriteDouble("avg_prj_act_unit_price_channel", AvgPrjActUnitPriceChannel); writer.WriteDouble("avg_unit_price_channel", AvgUnitPriceChannel); writer.WriteDouble("avg_unit_price_outlet", AvgUnitPriceOutlet); }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { throw new BinaryObjectException("Expected"); }
/// <summary> /// Initializes a new instance of the <see cref="T:Photon.SocketServer.Rpc.Protocols.Amf3.Amf3Writer"/> class /// based on the supplied stream. /// </summary> /// <param name="stream">The ouput stream.</param> public Amf3Writer(Stream stream) { this.binaryWriter = new BigEndianBinaryWriter(stream); }
/// <summary> /// Releases any resources held by an open writer. /// </summary> /// <param name="writer">The writer of the value.</param> protected override void CloseWriter( IBinaryWriter writer ) { throw new NotSupportedException().StoreFileLine(); }
void IConfigSerializer.Write(IBinaryWriter writer, object o) { Write(writer, (Kernel.Config.FieldLayoutOfIntKey)o); }
protected override void Dispose( bool disposing ) { if( disposing ) { if( this.binaryWriter.NotNullReference() ) { this.binaryWriter.Close(); this.binaryWriter = null; } } base.Dispose(disposing); }
///<summary> ///</summary> ///<param name = "writer"></param> public BinaryPropertySerializer(IBinaryWriter writer) { if (writer == null) throw new ArgumentNullException("writer"); _writer = writer; }
private static readonly ThreadLocal<byte[]> CopyBuffer = new ThreadLocal<byte[]>(() => new byte[4 * 1024]); // the same buffer size as System.IO.Stream.CopyTo /// <summary> /// Copies the contents of one stream to another. /// </summary> /// <param name="reader">The source, to read data from.</param> /// <param name="writer">The destination, to write data to.</param> public static void CopyTo( this IBinaryReader reader, IBinaryWriter writer ) { Ensure.Debug(reader, r => r.NotNull()); Ensure.That(writer).NotNull(); int bytesRead; var buffer = CopyBuffer.Value; while( (bytesRead = reader.Read(buffer, 0, buffer.Length)) != 0 ) writer.Write(buffer, 0, bytesRead); }
public override void WriteAsBinary(IBinaryWriter writer) { writer.WriteEnum((int)Mode); }
/// <summary> /// Writes the serialization entry. /// </summary> private static void WriteEntry(IBinaryWriter writer, SerializationEntry entry) { unchecked { var type = entry.ObjectType; if (type == typeof(byte)) { writer.WriteByte(entry.Name, (byte)entry.Value); } else if (type == typeof(byte[])) { writer.WriteByteArray(entry.Name, (byte[])entry.Value); } else if (type == typeof(sbyte)) { writer.WriteByte(entry.Name, (byte)(sbyte)entry.Value); } else if (type == typeof(sbyte[])) { writer.WriteByteArray(entry.Name, (byte[])(Array)entry.Value); } else if (type == typeof(bool)) { writer.WriteBoolean(entry.Name, (bool)entry.Value); } else if (type == typeof(bool[])) { writer.WriteBooleanArray(entry.Name, (bool[])entry.Value); } else if (type == typeof(char)) { writer.WriteChar(entry.Name, (char)entry.Value); } else if (type == typeof(char[])) { writer.WriteCharArray(entry.Name, (char[])entry.Value); } else if (type == typeof(short)) { writer.WriteShort(entry.Name, (short)entry.Value); } else if (type == typeof(short[])) { writer.WriteShortArray(entry.Name, (short[])entry.Value); } else if (type == typeof(ushort)) { writer.WriteShort(entry.Name, (short)(ushort)entry.Value); } else if (type == typeof(ushort[])) { writer.WriteShortArray(entry.Name, (short[])(Array)entry.Value); } else if (type == typeof(int)) { writer.WriteInt(entry.Name, (int)entry.Value); } else if (type == typeof(int[])) { writer.WriteIntArray(entry.Name, (int[])entry.Value); } else if (type == typeof(uint)) { writer.WriteInt(entry.Name, (int)(uint)entry.Value); } else if (type == typeof(uint[])) { writer.WriteIntArray(entry.Name, (int[])(Array)entry.Value); } else if (type == typeof(long)) { writer.WriteLong(entry.Name, (long)entry.Value); } else if (type == typeof(long[])) { writer.WriteLongArray(entry.Name, (long[])entry.Value); } else if (type == typeof(ulong)) { writer.WriteLong(entry.Name, (long)(ulong)entry.Value); } else if (type == typeof(ulong[])) { writer.WriteLongArray(entry.Name, (long[])(Array)entry.Value); } else if (type == typeof(float)) { writer.WriteFloat(entry.Name, (float)entry.Value); } else if (type == typeof(float[])) { writer.WriteFloatArray(entry.Name, (float[])entry.Value); } else if (type == typeof(double)) { writer.WriteDouble(entry.Name, (double)entry.Value); } else if (type == typeof(double[])) { writer.WriteDoubleArray(entry.Name, (double[])entry.Value); } else if (type == typeof(decimal)) { writer.WriteDecimal(entry.Name, (decimal)entry.Value); } else if (type == typeof(decimal?)) { writer.WriteDecimal(entry.Name, (decimal?)entry.Value); } else if (type == typeof(decimal?[])) { writer.WriteDecimalArray(entry.Name, (decimal?[])entry.Value); } else if (type == typeof(string)) { writer.WriteString(entry.Name, (string)entry.Value); } else if (type == typeof(string[])) { writer.WriteStringArray(entry.Name, (string[])entry.Value); } else if (type == typeof(Guid)) { writer.WriteGuid(entry.Name, (Guid)entry.Value); } else if (type == typeof(Guid?)) { writer.WriteGuid(entry.Name, (Guid?)entry.Value); } else if (type == typeof(Guid?[])) { writer.WriteGuidArray(entry.Name, (Guid?[])entry.Value); } else { writer.WriteObject(entry.Name, entry.Value); } } }
/** <inheritDoc /> */ public void WriteBinary(IBinaryWriter writer) { writer.WriteInt("a", A); writer.GetRawWriter().WriteInt(B); }
public void Save(IBinaryWriter writer) { writer.Write(Size); }