protected void Session_End(object sender, EventArgs e) { Application.Lock(); Application["count"] = (int)Application["count"] - 1; Application.UnLock(); if (Session["user"] != null) { u = Session["user"] as Dollers.model.User; if (Application[u.room_ID.ToString()] != null) { Application.Lock(); r = Application[u.room_ID.ToString()] as Dollers.model.Room; r.addNewMessage(new Dollers.model.Message(false, "断开连接", u)); r.count--; if (r.count <= 0) { List<string> list = Application["room_list"] as List<string>; list.Remove(r.name); Application["room_list"] = list; Application[u.room_ID.ToString()] = null; Application[u.room_ID.ToString() + "_flag"] = null; } else { Application[u.room_ID.ToString()] = r; Application[u.room_ID.ToString() + "_flag"] = DateTime.Now; } Application.UnLock(); } } }
public Room createRoom(string name, int max_count) { Room m = new Room(maxIDInc(maxRoomID), name, max_count); roomsList.Add(m.ID, m); return m; }