Exemplo n.º 1
0
 private void OnPowerHistory()
 {
     try
     {
         ConnectAPI.GetPowerHistory().ForEach(history =>
         {
             if (history.Type == Network.PowerType.FULL_ENTITY)
             {
                 var fullEnt   = (Network.HistFullEntity)history;
                 var newEntity = new Entity();
                 newEntity.InitRealTimeValues(fullEnt.Entity);
                 Logger.AppendLine($"OnPowerHistory - HistFullEntity:{newEntity}");
                 foreach (var tag in fullEnt.Entity.Tags)
                 {
                     Logger.AppendLine($"    {Tags.DebugTag(tag.Name, tag.Value)}");
                 }
                 if (IsRecordableCard(newEntity))
                 {
                     _cardIdsReceived.Enqueue(fullEnt.Entity.CardID);
                 }
             }
             else if (history.Type == Network.PowerType.SHOW_ENTITY)
             {
                 var showEnt   = (Network.HistShowEntity)history;
                 var newEntity = new Entity();
                 newEntity.InitRealTimeValues(showEnt.Entity);
                 Logger.AppendLine($"OnPowerHistory - HistShowEntity:{newEntity}");
                 foreach (var tag in showEnt.Entity.Tags)
                 {
                     Logger.AppendLine($"    {Tags.DebugTag(tag.Name, tag.Value)}");
                 }
                 if (IsRecordableCard(newEntity))
                 {
                     _cardIdsReceived.Enqueue(showEnt.Entity.CardID);
                 }
             }
         });
     }
     catch (Exception e)
     {
         Logger.AppendLine(e.Message);
         Logger.AppendLine(Environment.NewLine);
         Logger.AppendLine(e.StackTrace);
         Logger.AppendLine(Environment.NewLine);
     }
 }