コード例 #1
0
//C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
//  WalletSerializerV2(ITransfersObserver transfersObserver, Crypto::PublicKey viewPublicKey, Crypto::SecretKey viewSecretKey, ref ulong actualBalance, ref ulong pendingBalance, WalletsContainer walletsContainer, TransfersSyncronizer synchronizer, UnlockTransactionJobs unlockTransactions, WalletTransactions transactions, WalletTransfers transfers, UncommitedTransactions uncommitedTransactions, string extra, uint transactionSoftLockTime);

        public void load(Common.IInputStream source, byte version)
        {
            CryptoNote.BinaryInputStreamSerializer s = new CryptoNote.BinaryInputStreamSerializer(source);

            byte saveLevelValue;

            s.functorMethod(saveLevelValue, "saveLevel");
            WalletSaveLevel saveLevel = (WalletSaveLevel)saveLevelValue;

            loadKeyListAndBalances(s.functorMethod, saveLevel == WalletSaveLevel.SAVE_ALL);

            if (saveLevel == WalletSaveLevel.SAVE_KEYS_AND_TRANSACTIONS || saveLevel == WalletSaveLevel.SAVE_ALL)
            {
                loadTransactions(s.functorMethod);
                loadTransfers(s.functorMethod);
            }

            if (saveLevel == WalletSaveLevel.SAVE_ALL)
            {
                loadTransfersSynchronizer(s.functorMethod);
                loadUnlockTransactionsJobs(s.functorMethod);
                s.functorMethod(m_uncommitedTransactions, "uncommitedTransactions");
            }

            s.functorMethod(m_extra, "extra");
        }
コード例 #2
0
        public void load(std::istream in)
        {
            StdInputStream stream = new StdInputStream(in);

            CryptoNote.BinaryInputStreamSerializer s = new CryptoNote.BinaryInputStreamSerializer(stream);
            CryptoNote.GlobalMembers.serialize(s.functorMethod, "state");
        }
コード例 #3
0
        public override void load(std::istream @is)
        {
            m_sync.load(@is);

            StdInputStream inputStream = new StdInputStream(@is);

            CryptoNote.BinaryInputStreamSerializer s = new CryptoNote.BinaryInputStreamSerializer(inputStream);
            uint version = 0;

            s.functorMethod(version, "version");

            if (version > GlobalMembers.TRANSFERS_STORAGE_ARCHIVE_VERSION)
            {
                throw new System.Exception("TransfersSyncronizer version mismatch");
            }


//C++ TO C# CONVERTER TODO TASK: C# does not allow declaring types within methods:
//	struct ConsumerState
//	{
//	  PublicKey viewKey;
//	  string state;
//	  ClassicVector<System.Tuple<AccountPublicAddress, string>> subscriptionStates;
//	};

            List <ConsumerState> updatedStates = new List <ConsumerState>();

            try
            {
                ulong subscriptionCount = 0;
                s.beginArray(ref subscriptionCount, "consumers");

                while (subscriptionCount-- != 0)
                {
                    s.beginObject("");
                    PublicKey viewKey = new PublicKey();
                    s.functorMethod(viewKey, "view_key");

                    string blob;
                    s.functorMethod(blob, "state");

                    var subIter = m_consumers.find(viewKey);
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
                    if (subIter != m_consumers.end())
                    {
//C++ TO C# CONVERTER TODO TASK: Iterators are only converted within the context of 'while' and 'for' loops:
                        var consumerState = m_sync.getConsumerState(subIter.second.get());
                        Debug.Assert(consumerState);

                        {
                            // store previous state
                            var prevConsumerState = GlobalMembers.getObjectState(*consumerState);
                            // load consumer state
                            GlobalMembers.setObjectState(*consumerState, blob);
                            updatedStates.Add(ConsumerState({ viewKey, std::move(prevConsumerState) }));
                        }