コード例 #1
0
ファイル: RoomData.cs プロジェクト: aromaa/Skylight
        public RoomData(DataRow dataRow)
        {
            if (dataRow != null)
            {
                this.ID          = (uint)dataRow["id"];
                this.Name        = (string)dataRow["name"];
                this.Description = (string)dataRow["description"];
                this.OwnerID     = (uint)dataRow["ownerid"];
                this.Type        = (string)dataRow["type"];
                this.Model       = (string)dataRow["model"];
                this.State       = (string)dataRow["state"] == "password" ? RoomStateType.PASSWORD : (string)dataRow["state"] == "locked" ? RoomStateType.LOCKED : RoomStateType.OPEN;
                this.Category    = (int)dataRow["category"];
                this.UsersNow    = (int)dataRow["users_now"]; //maybe we need this sometimes :3
                this.UsersMax    = (int)dataRow["users_max"];
                this.PublicCCTs  = (string)dataRow["public_ccts"];
                this.Score       = (int)dataRow["score"];
                string tags = (string)dataRow["tags"];
                if (!string.IsNullOrEmpty(tags))
                {
                    this.Tags = tags.Split(',').ToList();
                }
                else
                {
                    this.Tags = new List <string>();
                }
                this.RoomIcon         = new RoomIcon((int)dataRow["icon_bg"], (int)dataRow["icon_fg"], (string)dataRow["icon_items"]);
                this.Password         = (string)dataRow["password"];
                this.Wallpaper        = (string)dataRow["wallpaper"];
                this.Floor            = (string)dataRow["floor"];
                this.Landscape        = (string)dataRow["landscape"];
                this.AllowPets        = TextUtilies.StringToBool((string)dataRow["allow_pets"]);
                this.AllowPetsEat     = TextUtilies.StringToBool((string)dataRow["allow_pets_eat"]);
                this.AllowWalkthrough = TextUtilies.StringToBool((string)dataRow["allow_walkthrough"]);
                this.Hidewalls        = TextUtilies.StringToBool((string)dataRow["hidewalls"]);
                this.Wallthick        = (int)dataRow["wallthick"];
                this.Floorthick       = (int)dataRow["floorthick"];
                this.AllowTrade       = (RoomAllowTradeType)int.Parse((string)dataRow["trade"]);
                this.MuteOption       = (RoomWhoCanType)int.Parse((string)dataRow["mute_option"]);
                this.KickOption       = (RoomWhoCanType)int.Parse((string)dataRow["kick_option"]);
                this.BanOption        = (RoomWhoCanType)int.Parse((string)dataRow["ban_option"]);
                this.ChatMode         = (RoomChatModeType)int.Parse((string)dataRow["chat_mode"]);
                this.ChatWeight       = (RoomChatWeightType)int.Parse((string)dataRow["chat_weight"]);
                this.ChatSpeed        = (RoomChatSpeedType)int.Parse((string)dataRow["chat_speed"]);
                this.ChatProtection   = (RoomChatProtectionType)int.Parse((string)dataRow["chat_protection"]);

                string data = (string)dataRow["data"];
                if (!string.IsNullOrEmpty(data))
                {
                    this.ExtraData = JsonConvert.DeserializeObject <RoomExtraData>(data);
                }
                else
                {
                    this.ExtraData = new RoomExtraData();
                }
            }
            else
            {
                this.NullValues();
            }
        }
コード例 #2
0
ファイル: RoomData.cs プロジェクト: aromaa/Skylight
 public void NullValues()
 {
     this.ID               = 0;
     this.Name             = "";
     this.Description      = "";
     this.OwnerID          = 0;
     this.Type             = "private";
     this.Model            = "";
     this.State            = RoomStateType.OPEN;
     this.Category         = 0;
     this.UsersNow         = 0;
     this.UsersMax         = 25;
     this.PublicCCTs       = "";
     this.Score            = 0;
     this.Tags             = new List <string>();
     this.RoomIcon         = new RoomIcon(1, 0, "");
     this.Password         = "";
     this.Wallpaper        = "0.0";
     this.Floor            = "0.0";
     this.Landscape        = "0.0";
     this.AllowPets        = true;
     this.AllowPetsEat     = false;
     this.AllowWalkthrough = false;
     this.Hidewalls        = false;
     this.Wallthick        = 0;
     this.Floorthick       = 0;
     this.ExtraData        = new RoomExtraData();
 }