Пример #1
0
        public static PathSet FromParser(BinaryParser parser, int?hint = null)
        {
            var  pathSet = new PathSet();
            Path path    = null;

            while (!parser.End())
            {
                byte type = parser.ReadOne();
                if (type == PathsetEndByte)
                {
                    break;
                }
                if (path == null)
                {
                    path = new Path();
                    pathSet.Add(path);
                }
                if (type == PathSeparatorByte)
                {
                    path = null;
                    continue;
                }

                AccountId account  = null;
                AccountId issuer   = null;
                Currency  currency = null;

                if ((type & PathHop.TypeAccount) != 0)
                {
                    account = AccountId.FromParser(parser);
                }
                if ((type & PathHop.TypeCurrency) != 0)
                {
                    currency = Currency.FromParser(parser);
                }
                if ((type & PathHop.TypeIssuer) != 0)
                {
                    issuer = AccountId.FromParser(parser);
                }
                var hop = new PathHop(account, issuer, currency);
                path.Add(hop);
            }
            return(pathSet);
        }
Пример #2
0
 public PathSet ReadPathSet()
 {
     return(PathSet.FromParser(_parser));
 }