Esempio n. 1
0
        private static void ChangeNotify(JToken[] list)
        {
            var notifyObjectList = new List <IdObject>();
            var notifyStringList = new List <string>();

            foreach (var item in list)
            {
                if (item.Type.Equals(JTokenType.Object))
                {
                    var idObject = item.ToIdObject();
                    if (idObject.IsNull())
                    {
                        continue;
                    }
                    if (idObject.SpaceType == SpaceType.DynamicGlobalProperties)
                    {
                        var blockNumber = (idObject as DynamicGlobalPropertiesObject).HeadBlockNumber;
                        databaseApi?.GetBlock(blockNumber).Then(block =>
                        {
                            AddBlock(blockNumber, block);
                            GetBlock(blockNumber, block);
                        });
                    }
                    AddObject(idObject);
                    notifyObjectList.Add(idObject);
                    CustomTools.Console.DebugLog("Update object:", CustomTools.Console.LogGreenColor(idObject.SpaceType), idObject.Id, '\n', CustomTools.Console.LogWhiteColor(idObject));
                }
                else
                if (item.Type.Equals(JTokenType.String))
                {
                    notifyStringList.Add(item.ToString());
                    CustomTools.Console.DebugLog("Get string:", CustomTools.Console.LogCyanColor(item));
                }
                else
                {
                    CustomTools.Console.DebugWarning("Get unexpected json type:", CustomTools.Console.LogYellowColor(item.Type), CustomTools.Console.LogCyanColor(item));
                }
            }
            foreach (var newObject in notifyObjectList)
            {
                GetObject(newObject);
            }
            notifyObjectList.Clear();
            foreach (var newString in notifyStringList)
            {
                GetString(newString);
            }
            notifyStringList.Clear();
        }