public PathSet ReadPathSet() { var paths = new System.Collections.Generic.List <Path>(); var path = new System.Collections.Generic.List <PathElement>(); while (true) { var type = data[ConsumedBytes++]; if (type == 0x00 || type == 0xFF) { paths.Add(new Path(path)); path.Clear(); if (type == 0x00) { break; } } else if (type == 0x01) { var account = new AccountId(data.Slice(ConsumedBytes, 20)); path.Add(PathElement.FromAccount(account)); ConsumedBytes += 20; } else if (type == 0x10) { var currency = new CurrencyCode(data.Slice(ConsumedBytes, 20)); path.Add(PathElement.FromCurrency(currency)); ConsumedBytes += 20; } else if (type == 0x20) { var issuer = new AccountId(data.Slice(ConsumedBytes, 20)); path.Add(PathElement.FromIssuer(issuer)); ConsumedBytes += 20; } else if (type == 0x30) { var currency = new CurrencyCode(data.Slice(ConsumedBytes, 20)); var issuer = new AccountId(data.Slice(ConsumedBytes + 20, 20)); path.Add(PathElement.FromIssuedCurrency(issuer, currency)); ConsumedBytes += 40; } else { throw new RippleException(string.Format("Bad path element {0} in pathset", type)); } } return(new PathSet(paths)); }