Пример #1
0
        public static PathPaymentStrictReceiveResult Decode(XdrDataInputStream stream)
        {
            PathPaymentStrictReceiveResult     decodedPathPaymentStrictReceiveResult = new PathPaymentStrictReceiveResult();
            PathPaymentStrictReceiveResultCode discriminant = PathPaymentStrictReceiveResultCode.Decode(stream);

            decodedPathPaymentStrictReceiveResult.Discriminant = discriminant;
            switch (decodedPathPaymentStrictReceiveResult.Discriminant.InnerValue)
            {
            case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum
                .PATH_PAYMENT_STRICT_RECEIVE_SUCCESS:
                decodedPathPaymentStrictReceiveResult.Success =
                    PathPaymentStrictReceiveResultSuccess.Decode(stream);
                break;

            case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum
                .PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER:
                decodedPathPaymentStrictReceiveResult.NoIssuer = Asset.Decode(stream);
                break;

            default:
                break;
            }

            return(decodedPathPaymentStrictReceiveResult);
        }
Пример #2
0
            public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResultSuccess encodedPathPaymentStrictReceiveResultSuccess)
            {
                int offerssize = encodedPathPaymentStrictReceiveResultSuccess.Offers.Length;

                stream.WriteInt(offerssize);
                for (int i = 0; i < offerssize; i++)
                {
                    ClaimOfferAtom.Encode(stream, encodedPathPaymentStrictReceiveResultSuccess.Offers[i]);
                }
                SimplePaymentResult.Encode(stream, encodedPathPaymentStrictReceiveResultSuccess.Last);
            }
Пример #3
0
            public static PathPaymentStrictReceiveResultSuccess Decode(XdrDataInputStream stream)
            {
                PathPaymentStrictReceiveResultSuccess decodedPathPaymentStrictReceiveResultSuccess = new PathPaymentStrictReceiveResultSuccess();
                int offerssize = stream.ReadInt();

                decodedPathPaymentStrictReceiveResultSuccess.Offers = new ClaimOfferAtom[offerssize];
                for (int i = 0; i < offerssize; i++)
                {
                    decodedPathPaymentStrictReceiveResultSuccess.Offers[i] = ClaimOfferAtom.Decode(stream);
                }
                decodedPathPaymentStrictReceiveResultSuccess.Last = SimplePaymentResult.Decode(stream);
                return(decodedPathPaymentStrictReceiveResultSuccess);
            }
Пример #4
0
        public static void Encode(XdrDataOutputStream stream, PathPaymentStrictReceiveResult encodedPathPaymentStrictReceiveResult)
        {
            stream.WriteInt((int)encodedPathPaymentStrictReceiveResult.Discriminant.InnerValue);
            switch (encodedPathPaymentStrictReceiveResult.Discriminant.InnerValue)
            {
            case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_SUCCESS:
                PathPaymentStrictReceiveResultSuccess.Encode(stream, encodedPathPaymentStrictReceiveResult.Success);
                break;

            case PathPaymentStrictReceiveResultCode.PathPaymentStrictReceiveResultCodeEnum.PATH_PAYMENT_STRICT_RECEIVE_NO_ISSUER:
                Asset.Encode(stream, encodedPathPaymentStrictReceiveResult.NoIssuer);
                break;

            default:
                break;
            }
        }