Пример #1
0
 public RoomInfo(uint Id, RoomType Type, uint OwnerId, string Name, string Description, List<string> Tags,
     RoomAccessType AccessType, string Password, RoomIcon Icon, int CategoryId, int MaxUsers, string Swfs,
     int Score, string ModelName, bool AllowPets, bool AllowPetEating, bool DisableBlocking, bool HideWalls,
     string PubInternalName, int WallThickness, int FloorThickness, Dictionary<string, string> Decorations)
 {
     mId = Id;
     mType = Type;
     mOwnerId = OwnerId;
     mName = Name;
     mDescription = Description;
     mTags = Tags;
     mAccessType = AccessType;
     mPassword = Password;
     mIcon = Icon;
     mCategoryId = CategoryId;
     mMaxUsers = MaxUsers;
     mSwfs = Swfs;
     mCacheAge = UnixTimestamp.GetCurrent();
     mScore = Score;
     mModelName = ModelName;
     mAllowPets = AllowPets;
     mAllowPetEating = AllowPetEating;
     mDisableRoomBlocking = DisableBlocking;
     mHideWalls = HideWalls;
     mPubInternalName = PubInternalName;
     mWallThickness = WallThickness;
     mFloorThickness = FloorThickness;
     mDecorations = Decorations;
     mSyncRoot = new object();
 }
Пример #2
0
        public static RoomInfo GenerateRoomInfoFromRow(DataRow Row)
        {
            List<string> Tags = new List<string>();

            foreach (string Tag in Row["tags"].ToString().Split(','))
            {
                Tags.Add(Tag);
            }

            RoomAccessType AccessType = RoomAccessType.Open;

            switch (Row["access_type"].ToString())
            {
                case "doorbell":

                    AccessType = RoomAccessType.Locked;
                    break;

                case "password":

                    AccessType = RoomAccessType.PasswordProtected;
                    break;
            }

            string RawIconData = (string)Row["icon"];
            RoomIcon Icon = new RoomIcon();

            if (RawIconData.Length > 0)
            {
                Icon.Deserialize((string)Row["icon"]);
            }

            Dictionary<string, string> Decorations = new Dictionary<string, string>();

            string[] DecorationBits = Row["decorations"].ToString().Split('|');

            foreach (string DecoBit in DecorationBits)
            {
                string[] Sub = DecoBit.Split('=');

                if (Sub.Length == 2)
                {
                    Decorations.Add(Sub[0], Sub[1]);
                }
            }

            return new RoomInfo((uint)Row["id"], (Row["type"].ToString() == "public" ? RoomType.Public : RoomType.Flat),
                (uint)Row["owner_id"], (string)Row["name"], (string)Row["description"], Tags, AccessType, (string)Row["password"],
                Icon, (int)Row["category"], (int)Row["max_users"], (string)Row["swfs"], (int)Row["score"], (string)Row["model"],
                (Row["allow_pets"].ToString() == "1"), (Row["allow_pet_eating"].ToString() == "1"),
                (Row["disable_blocking"].ToString() == "1"), (Row["hide_walls"].ToString() == "1"),
                (string)Row["pub_internal_name"], (int)Row["thickness_wall"], (int)Row["thickness_floor"], Decorations);
        }
Пример #3
0
        public void UpdateIcon(int Background, int Foreground, Dictionary<int, int> Objects)
        {
            lock (mSyncRoot)
            {
                mIcon = new RoomIcon(Background, Foreground, Objects);

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    MySqlClient.SetParameter("id", mId);
                    MySqlClient.SetParameter("icon", mIcon.Serialize());
                    MySqlClient.ExecuteNonQuery("UPDATE rooms SET icon = @icon WHERE id = @id LIMIT 1");
                }
            }
        }