private void Finallize() { LastScan?.Clear(); CachedEnemyMinionsWithAction?.Clear(); CachedAllyMinionsWithAction?.Clear(); CachedCombinedMinionsWithAction?.Clear(); CachedCombinedAttackableMinionsWithAction?.Clear(); CachedMinionsWithAction?.Clear(); CachedMonstersWithAction?.Clear(); }
public List <string[]> ToArrayList() { var result = new List <string[]> { new[] { "Created:", CreatedDate.ToString(CultureInfo.CurrentCulture) }, new[] { "Modified:", ModifiedDate.ToString(CultureInfo.CurrentCulture) }, new[] { "Last update:", LastUpdate.ToString(CultureInfo.CurrentCulture) }, new[] { "Last lookup:", LastLookup.ToString(CultureInfo.CurrentCulture) }, new[] { "Last scan:", LastScan.ToString(CultureInfo.CurrentCulture) }, new[] { "Last seek:", LastSeek.ToString(CultureInfo.CurrentCulture) }, }; return(result); }
private void GetLastReadAndShow() { if (InvokeRequired) { Invoke(new MethodInvoker( delegate { GetLastReadAndShow(); } )); } else { LastScan _lastRead = RT.REST.Footprints_getLastScan(); if ((_lastRead == null) || string.IsNullOrEmpty(_lastRead.post_id)) { s_logger.Trace("GetLastReadAndShow.getLastScan: null"); ShowAllTimeline(m_showTimelineIndexType); } else { s_logger.Info("GetLastReadAndShow.getLastScan:" + _lastRead.post_id); RT.SetCurrentGroupLastRead(_lastRead); if (IsLastReadPostInCacheData(_lastRead.post_id)) { ShowAllTimeline(m_showTimelineIndexType); } else { s_logger.Trace("GetLastReadAndShow: Get more posts"); timerReloadAllData.Enabled = true; } } } }
internal IEnumerable <Obj_AI_Minion> GetMinions(CachedEntityType type) { if (type < CachedEntityType.EnemyMinion) { throw new Exception($"Invalid type passed. {type} is not supported by Obj_AI_Minion."); } switch (type) { case CachedEntityType.EnemyMinion: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.EnemyMinions); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (Game.Time * 1000 - LastScan[type] < RefreshRate) { return(CachedEnemyMinions); } CachedEnemyMinions = EntityManager.MinionsAndMonsters.EnemyMinions; LastScan[type] = Game.Time * 1000; } else { CachedEnemyMinions = EntityManager.MinionsAndMonsters.EnemyMinions; LastScan[type] = Game.Time * 1000; } return(CachedEnemyMinions); } case CachedEntityType.AllyMinion: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.AlliedMinions); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (Game.Time * 1000 - LastScan[type] < RefreshRate) { return(CachedAllyMinions); } CachedAllyMinions = EntityManager.MinionsAndMonsters.AlliedMinions; LastScan[type] = Game.Time * 1000; } else { CachedAllyMinions = EntityManager.MinionsAndMonsters.AlliedMinions; LastScan[type] = Game.Time * 1000; } return(CachedAllyMinions); } case CachedEntityType.Minions: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.Minions); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (Game.Time * 1000 - LastScan[type] < RefreshRate) { return(CachedMinions); } CachedMinions = EntityManager.MinionsAndMonsters.Minions; LastScan[type] = Game.Time * 1000; } else { CachedMinions = EntityManager.MinionsAndMonsters.Minions; LastScan[type] = Game.Time * 1000; } return(CachedMinions); } case CachedEntityType.CombinedAttackableMinions: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.CombinedAttackable); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (Game.Time * 1000 - LastScan[type] < RefreshRate) { return(CachedCombinedAttackableMinions); } CachedCombinedAttackableMinions = EntityManager.MinionsAndMonsters.CombinedAttackable; LastScan[type] = Game.Time * 1000; } else { CachedCombinedAttackableMinions = EntityManager.MinionsAndMonsters.CombinedAttackable; LastScan[type] = Game.Time * 1000; } return(CachedCombinedAttackableMinions); } case CachedEntityType.CombinedMinions: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.Combined); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (Game.Time * 1000 - LastScan[type] < RefreshRate) { return(CachedCombinedMinions); } CachedCombinedMinions = EntityManager.MinionsAndMonsters.Combined; LastScan[type] = Game.Time * 1000; } else { CachedCombinedMinions = EntityManager.MinionsAndMonsters.Combined; LastScan[type] = Game.Time * 1000; } return(CachedCombinedMinions); } case CachedEntityType.Monsters: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.Monsters); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (Game.Time * 1000 - LastScan[type] < RefreshRate) { return(CachedMonsters); } CachedMonsters = EntityManager.MinionsAndMonsters.Monsters; LastScan[type] = Game.Time * 1000; } else { CachedMonsters = EntityManager.MinionsAndMonsters.Monsters; LastScan[type] = Game.Time * 1000; } return(CachedMonsters); } } return(null); }
internal IEnumerable <Obj_AI_Minion> GetMinions(CachedEntityType type, Func <Obj_AI_Minion, bool> predicate) { if (type < CachedEntityType.EnemyMinion) { throw new Exception($"Invalid type passed. {type} is not supported by Obj_AI_Minion."); } switch (type) { case CachedEntityType.EnemyMinion: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.EnemyMinions.Where(predicate)); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (CachedEnemyMinionsWithAction == null) { CachedEnemyMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } if (Game.Time * 1000 - LastScan[type] < RefreshRate) { IEnumerable <Obj_AI_Minion> output; if (CachedEnemyMinionsWithAction.TryGetValue(predicate, out output)) { return(CachedEnemyMinionsWithAction[predicate]); } } CachedEnemyMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } else { if (CachedEnemyMinionsWithAction == null) { CachedEnemyMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } CachedEnemyMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } return(CachedEnemyMinionsWithAction[predicate]); } case CachedEntityType.AllyMinion: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.AlliedMinions.Where(predicate)); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (CachedAllyMinionsWithAction == null) { CachedAllyMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } if (Game.Time * 1000 - LastScan[type] < RefreshRate) { IEnumerable <Obj_AI_Minion> output; if (CachedAllyMinionsWithAction.TryGetValue(predicate, out output)) { return(CachedAllyMinionsWithAction[predicate]); } } CachedAllyMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } else { if (CachedAllyMinionsWithAction == null) { CachedAllyMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } CachedAllyMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } return(CachedAllyMinionsWithAction[predicate]); } case CachedEntityType.Minions: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.Minions.Where(predicate)); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (CachedMinionsWithAction == null) { CachedMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } if (Game.Time * 1000 - LastScan[type] < RefreshRate) { IEnumerable <Obj_AI_Minion> output; if (CachedMinionsWithAction.TryGetValue(predicate, out output)) { return(CachedMinionsWithAction[predicate]); } } CachedMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } else { if (CachedMinionsWithAction == null) { CachedMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } CachedMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } return(CachedMinionsWithAction[predicate]); } case CachedEntityType.CombinedAttackableMinions: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.CombinedAttackable.Where(predicate)); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (CachedCombinedAttackableMinionsWithAction == null) { CachedCombinedAttackableMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } if (Game.Time * 1000 - LastScan[type] < RefreshRate) { IEnumerable <Obj_AI_Minion> output; if (CachedCombinedAttackableMinionsWithAction.TryGetValue(predicate, out output)) { return(CachedCombinedAttackableMinionsWithAction[predicate]); } } CachedCombinedAttackableMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } else { if (CachedCombinedAttackableMinionsWithAction == null) { CachedCombinedAttackableMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } CachedCombinedAttackableMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } return(CachedCombinedAttackableMinionsWithAction[predicate]); } case CachedEntityType.CombinedMinions: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.Combined.Where(predicate)); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (CachedCombinedMinionsWithAction == null) { CachedCombinedMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } if (Game.Time * 1000 - LastScan[type] < RefreshRate) { IEnumerable <Obj_AI_Minion> output; if (CachedCombinedMinionsWithAction.TryGetValue(predicate, out output)) { return(CachedCombinedMinionsWithAction[predicate]); } } CachedCombinedMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } else { if (CachedCombinedMinionsWithAction == null) { CachedCombinedMinionsWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } CachedCombinedMinionsWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } return(CachedCombinedMinionsWithAction[predicate]); } case CachedEntityType.Monsters: { if (IsDisposing) { return(EntityManager.MinionsAndMonsters.Monsters.Where(predicate)); } float lastScan; if (LastScan.TryGetValue(type, out lastScan)) { if (CachedMonstersWithAction == null) { CachedMonstersWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } if (Game.Time * 1000 - LastScan[type] < RefreshRate) { IEnumerable <Obj_AI_Minion> output; if (CachedMonstersWithAction.TryGetValue(predicate, out output)) { return(CachedMonstersWithAction[predicate]); } } CachedMonstersWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } else { if (CachedMonstersWithAction == null) { CachedMonstersWithAction = new Dictionary <Func <Obj_AI_Minion, bool>, IEnumerable <Obj_AI_Minion> >(); } CachedMonstersWithAction[predicate] = GetMinions(type).Where(predicate); LastScan[type] = Game.Time * 1000; } return(CachedMonstersWithAction[predicate]); } } return(null); }
public void SetCurrentGroupLastRead(LastScan lastScan) { CurrentGroupLastReadID = lastScan.post_id; }