Ejemplo n.º 1
0
 public void ToBytes(IBytesSink sink)
 {
     foreach (var so in this)
     {
         so.ToBytes(sink);
     }
 }
        public void ToBytes(IBytesSink sink)
        {
            var ser = new BinarySerializer(sink);

            ser.AddLengthEncoded(Tx);
            ser.AddLengthEncoded(Meta);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public void ToBytes(IBytesSink buffer)
        {
            var n = 0;

            foreach (var path in this)
            {
                if (n++ != 0)
                {
                    buffer.Put(PathSeparatorByte);
                }
                foreach (var hop in path)
                {
                    buffer.Put((byte)hop.Type);
                    if (hop.HasAccount())
                    {
                        buffer.Put(hop.Account.Buffer);
                    }
                    if (hop.HasCurrency())
                    {
                        buffer.Put(hop.Currency.Buffer);
                    }
                    if (hop.HasIssuer())
                    {
                        buffer.Put(hop.Issuer.Buffer);
                    }
                }
            }
            buffer.Put(PathsetEndByte);
        }
Ejemplo n.º 5
0
 public void ToBytes(IBytesSink sink)
 {
     foreach (var hash in this)
     {
         hash.ToBytes(sink);
     }
 }
Ejemplo n.º 6
0
 public void ToBytesSink(IBytesSink to)
 {
     foreach (var hash256 in this)
     {
         hash256.ToBytesSink(to);
     }
 }
Ejemplo n.º 7
0
 public void ToBytesSink(IBytesSink to)
 {
     foreach (var stObject in this)
     {
         stObject.ToBytesSink(to);
     }
 }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
 public void ToBytes(IBytesSink sink)
 {
     sink.Put(Value.ToBytes());
     if (!IsNative)
     {
         Currency.ToBytes(sink);
         Issuer.ToBytes(sink);
     }
 }
Ejemplo n.º 10
0
 public void ToBytes(IBytesSink sink)
 {
     sink.Put(Value.ToBytes());
     if (!IsNative)
     {
         Currency.ToBytes(sink);
         Issuer.ToBytes(sink);
     }
 }
Ejemplo n.º 11
0
        public void ToBytes(IBytesSink to, Func \ \ p)
        {
            var serializer = new BinarySerializer(to);

            foreach (var pair in Fields.Where(pair = \ > \ pair.Key.IsSerialised &&
                                                     (p == null || p(pair.Key))))
            {
                serializer.Add(pair.Key, pair.Value);
            }
        }
Ejemplo n.º 12
0
 private void ToBytes(IBytesSink sink)
 {
     LedgerIndex.ToBytes(sink);
     TotalDrops.ToBytes(sink);
     ParentHash.ToBytes(sink);
     TransactionHash.ToBytes(sink);
     StateHash.ToBytes(sink);
     ParentCloseTime.ToBytes(sink);
     CloseTime.ToBytes(sink);
     CloseResolution.ToBytes(sink);
     CloseFlags.ToBytes(sink);
 }
Ejemplo n.º 13
0
 private void ToBytes(IBytesSink sink)
 {
     LedgerIndex.ToBytes(sink);
     TotalDrops.ToBytes(sink);
     ParentHash.ToBytes(sink);
     TransactionHash.ToBytes(sink);
     StateHash.ToBytes(sink);
     ParentCloseTime.ToBytes(sink);
     CloseTime.ToBytes(sink);
     CloseResolution.ToBytes(sink);
     CloseFlags.ToBytes(sink);
 }
Ejemplo n.º 14
0
        public void ToBytesSink(IBytesSink to, IFieldFilter p)
        {
            var serializer = new BinarySerializer(to);

            foreach (var field in this)
            {
                if (p.Evaluate(field))
                {
                    var value = fields[field];
                    serializer.Add(field, value);
                }
            }
        }
Ejemplo n.º 15
0
 public override void ToBytesSink(IBytesSink sink)
 {
     foreach (var branch in Branches)
     {
         if (branch != null)
         {
             branch.Hash().ToBytes(sink);
         }
         else
         {
             Hash256.Zero.ToBytes(sink);
         }
     }
 }
 public void ToBytes(IBytesSink sink)
 {
     sink.Put(Bytes);
 }
Ejemplo n.º 17
0
 public void ToBytesSink(IBytesSink to)
 {
     ToBytesSink(to, new IsSerializedFieldFilter());
 }
Ejemplo n.º 18
0
 public override void ToBytesSink(VariableLength obj, IBytesSink to)
 {
     to.Add(obj._buffer);
 }
Ejemplo n.º 19
0
 public void ToBytes(IBytesSink sink) = \ > \ sink.Put(ToBytes());
Ejemplo n.º 20
0
 public abstract void ToBytesSink(IBytesSink sink);
Ejemplo n.º 21
0
 public void ToBytes(IBytesSink sink)
 {
     Entry.ToBytes(sink);
 }
Ejemplo n.º 22
0
 public override void ToBytesSink(T obj, IBytesSink to)
 {
     to.Add(obj.ToByteArray());
 }
Ejemplo n.º 23
0
 public virtual void ToBytesSink(TIn obj, IBytesSink to)
 {
     obj.ToBytesSink(to);
 }
Ejemplo n.º 24
0
 public void ToBytes(IBytesSink to)
 {
     ToBytes(to, null);
 }
Ejemplo n.º 25
0
 public BinarySerializer(IBytesSink sink)
 {
     _sink = sink;
 }
Ejemplo n.º 26
0
 public override void ToBytesSink(T obj, IBytesSink to)
 {
     to.Add(obj.HashBytes);
 }
Ejemplo n.º 27
0
 public void ToBytes(IBytesSink to, Func<Field, bool> p)
 {
     var serializer = new BinarySerializer(to);
     foreach (var pair in Fields.Where(pair => pair.Key.IsSerialised &&
                                             (p == null || p(pair.Key))))
     {
         serializer.Add(pair.Key, pair.Value);
     }
 }
Ejemplo n.º 28
0
 public override void ToBytesSink(IBytesSink sink)
 {
     Item.ToBytes(sink);
     Index.ToBytes(sink);
 }
Ejemplo n.º 29
0
 public void ToBytes(IBytesSink sink)
 {
     sink.Put(Buffer);
 }
Ejemplo n.º 30
0
 public void ToBytes(IBytesSink to)
 {
     ToBytes(to, null);
 }
Ejemplo n.º 31
0
 public BinarySerializer(IBytesSink sink)
 {
     _sink = sink;
 }
Ejemplo n.º 32
0
 public override void ToBytesSink(IBytesSink sink)
 {
     foreach (var branch in Branches)
     {
         if (branch != null)
         {
             branch.Hash().ToBytes(sink);
         }
         else
         {
             Hash256.Zero.ToBytes(sink);
         }
     }
 }
Ejemplo n.º 33
0
 public abstract void ToBytesSink(IBytesSink sink);
Ejemplo n.º 34
0
 public override void ToBytesSink(IBytesSink sink)
 {
     Item.ToBytes(sink);
     Index.ToBytes(sink);
 }
Ejemplo n.º 35
0
 public override void ToBytesSink(IBytesSink to)
 {
     InTranslate.ToBytesSink(this, to);
 }
Ejemplo n.º 36
0
 public void ToBytes(IBytesSink sink)
 {
     sink.Put(Buffer);
 }
Ejemplo n.º 37
0
 public void ToBytesSink(IBytesSink to)
 {
     to.Add(Bytes);
 }
Ejemplo n.º 38
0
 public abstract void ToBytesSink(IBytesSink to);