public ChatRoom GetRoom(uint project, RoomKind kind) { ChatRoom room = null; if (RoomMap.TryGetValue(GetRoomID(project, kind), out room)) { return(room); } return(null); }
public OpBuddy AddBuddy(string name, byte[] key) { ulong id = Utilities.KeytoID(key); OpBuddy buddy; if (BuddyList.TryGetValue(id, out buddy)) { return(buddy); } buddy = new OpBuddy() { ID = id, Name = name, Key = key }; BuddyList.SafeAdd(id, buddy); Core.IndexName(id, name); // always associate this buddy with name SaveList = true; Core.RunInGuiThread(GuiUpdate); Core.Locations.Research(id); return(buddy); }
/// <summary> /// Removes tasks, that are done and not marked for rerun (Oneitis) /// </summary> public void Cleanup() { var keys = Data.KeysArray; if (keys.IsNullOrEmpty()) { return; } foreach (string key in keys) { lock (locker) { var task = Data.TryGetValue(key, null); if (task == null || (!task.Oneitis && !task.IsRunning)) { Data.Remove(key); } } } }