Ejemplo n.º 1
0
        /// <summary>
        /// Calls the back account change.
        /// </summary>
        /// <param name="subscriptionId">The subscription identifier.</param>
        /// <param name="storageChangeSet">The storage change set.</param>
        public virtual void CallBackAccountChange(string subscriptionId, StorageChangeSet storageChangeSet)
        {
            if (storageChangeSet.Changes == null ||
                storageChangeSet.Changes.Length == 0 ||
                storageChangeSet.Changes[0].Length < 2)
            {
                Logger.Warn("Couldn't update account informations. Please check 'CallBackAccountChange'");
                return;
            }

            var accountInfoStr = storageChangeSet.Changes[0][1];

            if (string.IsNullOrEmpty(accountInfoStr))
            {
                Logger.Warn("Couldn't update account informations. Account doesn't exists, please check 'CallBackAccountChange'");
                return;
            }

            var accountInfo = new AccountInfo();

            accountInfo.Create(accountInfoStr);
            AccountInfo = accountInfo;

            AccountInfoUpdated?.Invoke(this, AccountInfo);
        }
        public void AdvancedJsonConverter1()
        {
            string state_storage_response =
                "{\r\n\"block\":\"0x30712fe96155dcce61b9e3e41844f13e7a6f642f27a745e44a483b0009191c77\",\r\n\"changes\":[\r\n[\r\n\"0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9438d5c56935253cd6d9ea70f2bf95d60137f0ffc8904f42aaabf63d4ec80862f5087a8b059260c191401e03c03836767\",\r\nnull\r\n]\r\n]\r\n}";
            StorageChangeSet storageChangeSet = JsonConvert.DeserializeObject <StorageChangeSet>(state_storage_response);

            Assert.AreEqual("0x30712FE96155DCCE61B9E3E41844F13E7A6F642F27A745E44A483B0009191C77", storageChangeSet.Block.Value);

            //NewStorageChangeSet newStorageChangeSet = JsonConvert.DeserializeObject<NewStorageChangeSet>(state_storage_response);
            //Assert.AreEqual("0x30712FE96155DCCE61B9E3E41844F13E7A6F642F27A745E44A483B0009191C77", newStorageChangeSet.Block.Value);
        }
Ejemplo n.º 3
0
 public void StateStorage(string subscription, StorageChangeSet result)
 {
     GenericCallBack(subscription, result);
 }