Beispiel #1
0
        public void save(Common.IOutputStream destination, WalletSaveLevel saveLevel)
        {
            CryptoNote.BinaryOutputStreamSerializer s = new CryptoNote.BinaryOutputStreamSerializer(destination);

            byte saveLevelValue = (byte)saveLevel;

            s.functorMethod(saveLevelValue, "saveLevel");

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

            if (saveLevel == WalletSaveLevel.SAVE_KEYS_AND_TRANSACTIONS || saveLevel == WalletSaveLevel.SAVE_ALL)
            {
                saveTransactions(s.functorMethod);
                saveTransfers(s.functorMethod);
            }

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

            s.functorMethod(m_extra, "extra");
        }
Beispiel #2
0
        // IStreamSerializable
        public void save(std::ostream os)
        {
            StdOutputStream stream = new StdOutputStream(os);

            CryptoNote.BinaryOutputStreamSerializer s = new CryptoNote.BinaryOutputStreamSerializer(stream);
            CryptoNote.GlobalMembers.serialize(s.functorMethod, "state");
        }
Beispiel #3
0
        // IStreamSerializable
        public override void save(std::ostream os)
        {
            m_sync.save(os);

            StdOutputStream stream = new StdOutputStream(os);

            CryptoNote.BinaryOutputStreamSerializer s = new CryptoNote.BinaryOutputStreamSerializer(stream);
//C++ TO C# CONVERTER TODO TASK: There is no equivalent to 'const_cast' in C#:
            s.functorMethod(const_cast <uint&>(GlobalMembers.TRANSFERS_STORAGE_ARCHIVE_VERSION), "version");

            ulong subscriptionCount = m_consumers.Count;

            s.beginArray(ref subscriptionCount, "consumers");

            foreach (var consumer in m_consumers)
            {
                s.beginObject("");
//C++ TO C# CONVERTER TODO TASK: There is no equivalent to 'const_cast' in C#:
                s.functorMethod(const_cast <PublicKey&>(consumer.first), "view_key");

                std::stringstream consumerState = new std::stringstream();
                // synchronization state
                m_sync.getConsumerState(consumer.second.get()).save(consumerState);

                string blob = consumerState.str();
                s.functorMethod(blob, "state");

                List <AccountPublicAddress> subscriptions = new List <AccountPublicAddress>();
                consumer.second.getSubscriptions(subscriptions);
                ulong subCount = subscriptions.Count;

                s.beginArray(ref subCount, "subscriptions");

                foreach (var addr in subscriptions)
                {
                    var sub = consumer.second.getSubscription(addr);
                    if (sub != null)
                    {
                        s.beginObject("");

                        std::stringstream subState = new std::stringstream();
                        Debug.Assert(sub);
                        sub.getContainer().save(subState);
                        // store data block
                        string blob = subState.str();
                        s.functorMethod(addr, "address");
                        s.functorMethod(blob, "state");

                        s.EndObject();
                    }
                }

                s.EndArray();
                s.EndObject();
            }
        }