Ejemplo n.º 1
0
            public static AllowTrustOpAsset Decode(XdrDataInputStream stream)
            {
                AllowTrustOpAsset decodedAllowTrustOpAsset = new AllowTrustOpAsset();
                AssetType         discriminant             = AssetType.Decode(stream);

                decodedAllowTrustOpAsset.Discriminant = discriminant;
                switch (decodedAllowTrustOpAsset.Discriminant.InnerValue)
                {
                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                    decodedAllowTrustOpAsset.AssetCode4 = AssetCode4.Decode(stream);
                    break;

                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                    decodedAllowTrustOpAsset.AssetCode12 = AssetCode12.Decode(stream);
                    break;
                }
                return(decodedAllowTrustOpAsset);
            }
Ejemplo n.º 2
0
            public static AllowTrustOpAsset Decode(IByteReader stream)
            {
                AllowTrustOpAsset decodedAllowTrustOpAsset = new AllowTrustOpAsset();

                decodedAllowTrustOpAsset.Discriminant = AssetType.Decode(stream);
                switch (decodedAllowTrustOpAsset.Discriminant.InnerValue)
                {
                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                    int assetCode4size = 4;
                    decodedAllowTrustOpAsset.AssetCode4 = XdrEncoding.ReadFixOpaque(stream, (uint)assetCode4size);
                    break;

                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                    int assetCode12size = 12;
                    decodedAllowTrustOpAsset.AssetCode12 = XdrEncoding.ReadFixOpaque(stream, (uint)assetCode12size);
                    break;
                }
                return(decodedAllowTrustOpAsset);
            }
Ejemplo n.º 3
0
        public static Asset Decode(IByteReader stream)
        {
            Asset decodedAsset = new Asset();

            decodedAsset.Discriminant = AssetType.Decode(stream);
            switch (decodedAsset.Discriminant.InnerValue)
            {
            case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE:
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                decodedAsset.AlphaNum4 = AssetAlphaNum4.Decode(stream);
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                decodedAsset.AlphaNum12 = AssetAlphaNum12.Decode(stream);
                break;
            }
            return(decodedAsset);
        }
Ejemplo n.º 4
0
        public static Asset Decode(XdrDataInputStream stream)
        {
            var decodedAsset = new Asset();
            var discriminant = AssetType.Decode(stream);

            decodedAsset.Discriminant = discriminant;
            switch (decodedAsset.Discriminant.InnerValue)
            {
            case AssetType.AssetTypeEnum.ASSET_TYPE_NATIVE:
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                decodedAsset.AlphaNum4 = AssetAlphaNum4.Decode(stream);
                break;

            case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                decodedAsset.AlphaNum12 = AssetAlphaNum12.Decode(stream);
                break;
            }
            return(decodedAsset);
        }
Ejemplo n.º 5
0
            public static AllowTrustOpAsset Decode(XdrDataInputStream stream)
            {
                var decodedAllowTrustOpAsset = new AllowTrustOpAsset();
                var discriminant             = AssetType.Decode(stream);

                decodedAllowTrustOpAsset.Discriminant = discriminant;
                switch (decodedAllowTrustOpAsset.Discriminant.InnerValue)
                {
                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM4:
                    var assetCode4size = 4;
                    decodedAllowTrustOpAsset.AssetCode4 = new byte[assetCode4size];
                    stream.Read(decodedAllowTrustOpAsset.AssetCode4, 0, assetCode4size);
                    break;

                case AssetType.AssetTypeEnum.ASSET_TYPE_CREDIT_ALPHANUM12:
                    var assetCode12size = 12;
                    decodedAllowTrustOpAsset.AssetCode12 = new byte[assetCode12size];
                    stream.Read(decodedAllowTrustOpAsset.AssetCode12, 0, assetCode12size);
                    break;
                }
                return(decodedAllowTrustOpAsset);
            }