public void ToBytesSink(IBytesSink to) { UInt64 man = Mantissa(); if (IsNative) { if (!IsNegative) { man = man.Or(BinaryFlagIsNonNegativeNative); } to.Add(man.ToByteArray()); } else { int offset = Offset; UInt64 packed; if (IsZero) { packed = BinaryFlagIsIou; } else if (IsNegative) { packed = man.Or(new UInt64(((long)512 + 0 + 97 + offset)).ShiftLeft(64 - 10)); } else { packed = man.Or(new UInt64(((long)512 + 256 + 97 + offset)).ShiftLeft(64 - 10)); } to.Add(packed.ToByteArray()); to.Add(_currency.Bytes); to.Add(_issuer.Bytes); } }
public void ToBytesSink(IBytesSink to) { int n = 0; foreach (var path in this) { if (n++ != 0) { to.Add(PathSeparatorByte); } foreach (var hop in path) { int type = hop.Type; to.Add((byte)type); if (hop.Account != null) { to.Add(hop.Account.Bytes); } if (hop.Currency != null) { to.Add(hop.Currency.Bytes); } if (hop.Issuer != null) { to.Add(hop.Issuer.Bytes); } } } to.Add(PathsetEndByte); }
public void Add(byte[] n) { _sink.Add(n); }
public override void ToBytesSink(T obj, IBytesSink to) { to.Add(obj.ToByteArray()); }
public void ToBytesSink(IBytesSink to) { to.Add(Bytes); }
public override void ToBytesSink(VariableLength obj, IBytesSink to) { to.Add(obj._buffer); }
public override void ToBytesSink(T obj, IBytesSink to) { to.Add(obj.HashBytes); }