Пример #1
0
        public RoomAdapter CastAdapter(int RoomId)
        {
            RoomAdapter Adapter;

            if (!Adapters.TryGetValue(RoomId, out Adapter))
            {
                Adapter = new RoomAdapter(GetRoom(RoomId));
                Adapters.Add(Adapter.Information.Id, Adapter);

                if (WeakSQLCache.ContainsKey(RoomId))
                {
                    WeakSQLCache.Remove(RoomId);
                }
            }

            return Adapter;
        }
Пример #2
0
        /// <summary>
        /// Returns the current room of characterId, and auth him.
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <param name="Adapter"></param>
        /// <returns></returns>
        public bool GetCurrentRoom(int CharacterId, out RoomAdapter Adapter)
        {
            Adapter = null;

            Session Session;

            if (GetStatus(CharacterId, out Session) == CharacterStatus.Online)
            {
                if (Session.Character.ConnectedRoom > 0)
                {
                    Adapter = System.HabboSystem.RoomManager.CastAdapter(Session.Character.ConnectedRoom);
                }
            }

            return Adapter != null;
        }
Пример #3
0
        public void DisposeAdapter(RoomAdapter Adapter)
        {
            if (!WeakSQLCache.ContainsKey(Adapter.Information.Id))
            {
                WeakSQLCache.Add(Adapter.Information.Id, Adapter.Information);
            }
            else WeakSQLCache[Adapter.Information.Id] = Adapter.Information;

            Adapters.Remove(Adapter.Information.Id);

            Adapter.Dispose();
        }