Ejemplo n.º 1
0
 public void RemoveMapItem()
 {
     // take the data from list to remove it without having enumeration problems (ToList)
     try
     {
         List <MapItem> dropsToRemove = DroppedList.Where(dl => dl.CreatedDate.AddMinutes(3) < DateTime.Now);
         Parallel.ForEach(dropsToRemove, drop =>
         {
             Broadcast(StaticPacketHelper.Out(UserType.Object, drop.TransportId));
             DroppedList.Remove(drop.TransportId);
         });
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Ejemplo n.º 2
0
        private void RemoveMapItem()
        {
            // take the data from list to remove it without having enumeration problems (ToList)
            try
            {
                IEnumerable <KeyValuePair <long, MapItem> > dropsToRemove = DroppedList.Where(dl => dl.Value.CreateDate.AddMinutes(3) < DateTime.Now).ToList();

                foreach (KeyValuePair <long, MapItem> drop in dropsToRemove)
                {
                    Broadcast(drop.Value.GenerateOut(drop.Key));
                    MapItem mapItem;
                    DroppedList.TryRemove(drop.Key, out mapItem);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }