public static void Encode(IByteWriter stream, PathPaymentResultSuccess encodedPathPaymentResultSuccess) {
   int offerssize = encodedPathPaymentResultSuccess.Offers.Length;
   XdrEncoding.EncodeInt32(offerssize, stream);
   for (int i = 0; i < offerssize; i++) {
     ClaimOfferAtom.Encode(stream, encodedPathPaymentResultSuccess.Offers[i]);
   }
   SimplePaymentResult.Encode(stream, encodedPathPaymentResultSuccess.Last);
 }
 public static PathPaymentResultSuccess Decode(IByteReader stream) {
   PathPaymentResultSuccess decodedPathPaymentResultSuccess = new PathPaymentResultSuccess();
   int offerssize = XdrEncoding.DecodeInt32(stream);
   decodedPathPaymentResultSuccess.Offers = new ClaimOfferAtom[offerssize];
   for (int i = 0; i < offerssize; i++) {
     decodedPathPaymentResultSuccess.Offers[i] = ClaimOfferAtom.Decode(stream);
   }
   decodedPathPaymentResultSuccess.Last = SimplePaymentResult.Decode(stream);
   return decodedPathPaymentResultSuccess;
 }
            public static void Encode(XdrDataOutputStream stream, PathPaymentResultSuccess encodedPathPaymentResultSuccess)
            {
                int offerssize = encodedPathPaymentResultSuccess.Offers.Length;

                stream.WriteInt(offerssize);
                for (int i = 0; i < offerssize; i++)
                {
                    ClaimOfferAtom.Encode(stream, encodedPathPaymentResultSuccess.Offers[i]);
                }
                SimplePaymentResult.Encode(stream, encodedPathPaymentResultSuccess.Last);
            }
            public static void Encode(IByteWriter stream, PathPaymentResultSuccess encodedPathPaymentResultSuccess)
            {
                int offerssize = encodedPathPaymentResultSuccess.Offers.Length;

                XdrEncoding.EncodeInt32(offerssize, stream);
                for (int i = 0; i < offerssize; i++)
                {
                    ClaimOfferAtom.Encode(stream, encodedPathPaymentResultSuccess.Offers[i]);
                }
                SimplePaymentResult.Encode(stream, encodedPathPaymentResultSuccess.Last);
            }
            public static PathPaymentResultSuccess Decode(XdrDataInputStream stream)
            {
                PathPaymentResultSuccess decodedPathPaymentResultSuccess = new PathPaymentResultSuccess();
                int offerssize = stream.ReadInt();

                decodedPathPaymentResultSuccess.Offers = new ClaimOfferAtom[offerssize];
                for (int i = 0; i < offerssize; i++)
                {
                    decodedPathPaymentResultSuccess.Offers[i] = ClaimOfferAtom.Decode(stream);
                }
                decodedPathPaymentResultSuccess.Last = SimplePaymentResult.Decode(stream);
                return(decodedPathPaymentResultSuccess);
            }
            public static PathPaymentResultSuccess Decode(IByteReader stream)
            {
                PathPaymentResultSuccess decodedPathPaymentResultSuccess = new PathPaymentResultSuccess();
                int offerssize = XdrEncoding.DecodeInt32(stream);

                decodedPathPaymentResultSuccess.Offers = new ClaimOfferAtom[offerssize];
                for (int i = 0; i < offerssize; i++)
                {
                    decodedPathPaymentResultSuccess.Offers[i] = ClaimOfferAtom.Decode(stream);
                }
                decodedPathPaymentResultSuccess.Last = SimplePaymentResult.Decode(stream);
                return(decodedPathPaymentResultSuccess);
            }
Пример #7
0
        public static void Encode(XdrDataOutputStream stream, PathPaymentResult encodedPathPaymentResult)
        {
            stream.WriteInt((int)encodedPathPaymentResult.Discriminant.InnerValue);

            switch (encodedPathPaymentResult.Discriminant.InnerValue)
            {
            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_SUCCESS:
                PathPaymentResultSuccess.Encode(stream, encodedPathPaymentResult.Success);
                break;

            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_NO_ISSUER:
                Asset.Encode(stream, encodedPathPaymentResult.NoIssuer);
                break;
            }
        }
        public static void Encode(IByteWriter stream, PathPaymentResult encodedPathPaymentResult)
        {
            XdrEncoding.EncodeInt32((int)encodedPathPaymentResult.Discriminant.InnerValue, stream);
            switch (encodedPathPaymentResult.Discriminant.InnerValue)
            {
            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_SUCCESS:
                PathPaymentResultSuccess.Encode(stream, encodedPathPaymentResult.Success);
                break;

            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_NO_ISSUER:
                Asset.Encode(stream, encodedPathPaymentResult.NoIssuer);
                break;

            default:
                break;
            }
        }
Пример #9
0
        public static PathPaymentResult Decode(XdrDataInputStream stream)
        {
            PathPaymentResult     decodedPathPaymentResult = new PathPaymentResult();
            PathPaymentResultCode discriminant             = PathPaymentResultCode.Decode(stream);

            decodedPathPaymentResult.Discriminant = discriminant;

            switch (decodedPathPaymentResult.Discriminant.InnerValue)
            {
            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_SUCCESS:
                decodedPathPaymentResult.Success = PathPaymentResultSuccess.Decode(stream);
                break;

            case PathPaymentResultCode.PathPaymentResultCodeEnum.PATH_PAYMENT_NO_ISSUER:
                decodedPathPaymentResult.NoIssuer = Asset.Decode(stream);
                break;
            }

            return(decodedPathPaymentResult);
        }