Ejemplo n.º 1
0
        public static AccountEntry Decode(IByteReader stream)
        {
            AccountEntry decodedAccountEntry = new AccountEntry();

            decodedAccountEntry.AccountID     = AccountID.Decode(stream);
            decodedAccountEntry.Balance       = Int64.Decode(stream);
            decodedAccountEntry.SeqNum        = SequenceNumber.Decode(stream);
            decodedAccountEntry.NumSubEntries = Uint32.Decode(stream);
            int inflationDestPresent = XdrEncoding.DecodeInt32(stream);

            if (inflationDestPresent != 0)
            {
                decodedAccountEntry.InflationDest = AccountID.Decode(stream);
            }
            decodedAccountEntry.Flags      = Uint32.Decode(stream);
            decodedAccountEntry.HomeDomain = String32.Decode(stream);
            decodedAccountEntry.Thresholds = Thresholds.Decode(stream);
            int signerssize = XdrEncoding.DecodeInt32(stream);

            decodedAccountEntry.Signers = new Signer[signerssize];
            for (int i = 0; i < signerssize; i++)
            {
                decodedAccountEntry.Signers[i] = Signer.Decode(stream);
            }
            decodedAccountEntry.Ext = AccountEntryExt.Decode(stream);
            return(decodedAccountEntry);
        }
Ejemplo n.º 2
0
        public static AccountEntry Decode(XdrDataInputStream stream)
        {
            var decodedAccountEntry = new AccountEntry();

            decodedAccountEntry.AccountID     = AccountID.Decode(stream);
            decodedAccountEntry.Balance       = Int64.Decode(stream);
            decodedAccountEntry.SeqNum        = SequenceNumber.Decode(stream);
            decodedAccountEntry.NumSubEntries = Uint32.Decode(stream);
            var InflationDestPresent = stream.ReadInt();

            if (InflationDestPresent != 0)
            {
                decodedAccountEntry.InflationDest = AccountID.Decode(stream);
            }
            decodedAccountEntry.Flags      = Uint32.Decode(stream);
            decodedAccountEntry.HomeDomain = String32.Decode(stream);
            decodedAccountEntry.Thresholds = Thresholds.Decode(stream);
            var signerssize = stream.ReadInt();

            decodedAccountEntry.Signers = new Signer[signerssize];
            for (var i = 0; i < signerssize; i++)
            {
                decodedAccountEntry.Signers[i] = Signer.Decode(stream);
            }
            decodedAccountEntry.Ext = AccountEntryExt.Decode(stream);
            return(decodedAccountEntry);
        }
Ejemplo n.º 3
0
        public static SetOptionsOp Decode(IByteReader stream)
        {
            SetOptionsOp decodedSetOptionsOp  = new SetOptionsOp();
            int          inflationDestPresent = XdrEncoding.DecodeInt32(stream);

            if (inflationDestPresent != 0)
            {
                decodedSetOptionsOp.InflationDest = AccountID.Decode(stream);
            }
            int clearFlagsPresent = XdrEncoding.DecodeInt32(stream);

            if (clearFlagsPresent != 0)
            {
                decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream);
            }
            int setFlagsPresent = XdrEncoding.DecodeInt32(stream);

            if (setFlagsPresent != 0)
            {
                decodedSetOptionsOp.SetFlags = Uint32.Decode(stream);
            }
            int masterWeightPresent = XdrEncoding.DecodeInt32(stream);

            if (masterWeightPresent != 0)
            {
                decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream);
            }
            int lowThresholdPresent = XdrEncoding.DecodeInt32(stream);

            if (lowThresholdPresent != 0)
            {
                decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream);
            }
            int medThresholdPresent = XdrEncoding.DecodeInt32(stream);

            if (medThresholdPresent != 0)
            {
                decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream);
            }
            int highThresholdPresent = XdrEncoding.DecodeInt32(stream);

            if (highThresholdPresent != 0)
            {
                decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream);
            }
            int homeDomainPresent = XdrEncoding.DecodeInt32(stream);

            if (homeDomainPresent != 0)
            {
                decodedSetOptionsOp.HomeDomain = String32.Decode(stream);
            }
            int signerPresent = XdrEncoding.DecodeInt32(stream);

            if (signerPresent != 0)
            {
                decodedSetOptionsOp.Signer = Signer.Decode(stream);
            }
            return(decodedSetOptionsOp);
        }
Ejemplo n.º 4
0
        public static SetOptionsOp Decode(XdrDataInputStream stream)
        {
            var decodedSetOptionsOp  = new SetOptionsOp();
            var InflationDestPresent = stream.ReadInt();

            if (InflationDestPresent != 0)
            {
                decodedSetOptionsOp.InflationDest = AccountID.Decode(stream);
            }
            var ClearFlagsPresent = stream.ReadInt();

            if (ClearFlagsPresent != 0)
            {
                decodedSetOptionsOp.ClearFlags = Uint32.Decode(stream);
            }
            var SetFlagsPresent = stream.ReadInt();

            if (SetFlagsPresent != 0)
            {
                decodedSetOptionsOp.SetFlags = Uint32.Decode(stream);
            }
            var MasterWeightPresent = stream.ReadInt();

            if (MasterWeightPresent != 0)
            {
                decodedSetOptionsOp.MasterWeight = Uint32.Decode(stream);
            }
            var LowThresholdPresent = stream.ReadInt();

            if (LowThresholdPresent != 0)
            {
                decodedSetOptionsOp.LowThreshold = Uint32.Decode(stream);
            }
            var MedThresholdPresent = stream.ReadInt();

            if (MedThresholdPresent != 0)
            {
                decodedSetOptionsOp.MedThreshold = Uint32.Decode(stream);
            }
            var HighThresholdPresent = stream.ReadInt();

            if (HighThresholdPresent != 0)
            {
                decodedSetOptionsOp.HighThreshold = Uint32.Decode(stream);
            }
            var HomeDomainPresent = stream.ReadInt();

            if (HomeDomainPresent != 0)
            {
                decodedSetOptionsOp.HomeDomain = String32.Decode(stream);
            }
            var SignerPresent = stream.ReadInt();

            if (SignerPresent != 0)
            {
                decodedSetOptionsOp.Signer = Signer.Decode(stream);
            }
            return(decodedSetOptionsOp);
        }
Ejemplo n.º 5
0
        public void TestString()
        {
            byte[] bytes = { 0, 0, 0, 2, (byte)'a', (byte)'b', 1, 0 };

            try
            {
                String32.Decode(new XdrDataInputStream(bytes));
            }
            catch (IOException expectedException)
            {
                Assert.AreEqual("non-zero padding", expectedException.Message);
                throw;
            }
        }