コード例 #1
0
ファイル: RoomDatabase.cs プロジェクト: DamienJolly/Alias
        public static RoomData RoomData(int Id)
        {
            RoomData result = null;

            using (DatabaseConnection dbClient = Alias.Server.DatabaseManager.GetConnection())
            {
                dbClient.AddParameter("id", Id);
                using (MySqlDataReader Reader = dbClient.DataReader("SELECT * FROM `room_data` WHERE `id` = @id LIMIT 1"))
                {
                    while (Reader.Read())
                    {
                        result = new RoomData
                        {
                            Id          = Id,
                            Name        = Reader.GetString("name"),
                            Group       = Alias.Server.GroupManager.GetGroup(Reader.GetInt32("group_id")),
                            OwnerId     = Reader.GetInt32("owner"),
                            OwnerName   = "",
                            DoorState   = (RoomDoorState)Reader.GetInt32("door"),
                            MaxUsers    = Reader.GetInt32("max_users"),
                            Description = Reader.GetString("description"),
                            TradeState  = (RoomTradeState)Reader.GetInt32("trade"),
                            Likes       = RoomDatabase.ReadLikes(Id),
                            Rankings    = Reader.GetInt32("ranking"),
                            Category    = Reader.GetInt32("category"),
                            Tags        = RoomDatabase.ReadTags(Id),
                            Image       = Reader.GetString("image"),
                            Password    = Reader.GetString("password"),
                            ModelName   = Reader.GetString("model"),
                            Settings    = RoomDatabase.ReadSettings(Id)
                        };
                    }
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: Room.cs プロジェクト: DamienJolly/Alias
 public void Dispose()
 {
     RoomItemDatabase.SaveFurniture(this.ItemManager.Items);
     RoomDatabase.SaveRoom(this.RoomData);
     this.EntityManager.Dispose();
 }