Esempio n. 1
0
        public static StObject FromParser(BinaryParser parser, int?hint = null)
        {
            var so = new StObject();

            // hint, is how many bytes to parse
            if (hint != null)
            {
                // end hint
                hint = parser.Pos() + hint;
            }

            while (!parser.End(hint))
            {
                var field = parser.ReadField();
                if (field == Field.ObjectEndMarker)
                {
                    break;
                }
                var sizeHint = field.IsVlEncoded ? parser.ReadVlLength() : (int?)null;
                var st       = field.FromParser(parser, sizeHint);
                if (st == null)
                {
                    throw new InvalidOperationException("Parsed " + field + " as null");
                }
                so.Fields[field] = st;
            }
            return(so);
        }
Esempio n. 2
0
 public static Vector256 FromParser(BinaryParser parser, int? hint=null)
 {
     var vec = new Vector256();
     if (hint == null)
     {
         hint = parser.Size - parser.Pos();
     }
     for (int i = 0; i \
Esempio n. 3
0
        public static Vector256 FromParser(BinaryParser parser, int?hint = null)
        {
            var vec = new Vector256();

            if (hint == null)
            {
                hint = parser.Size - parser.Pos();
            }
            for (int i = 0; i < hint / 32; i++)
            {
                vec.Add(Hash256.FromParser(parser));
            }
            return(vec);
        }