コード例 #1
0
ファイル: DiscordGuild.cs プロジェクト: XtremeOwnage/WarBot
        public IGuildSetting this[Setting_Key Key]
        {
            get
            {
                //If it doesn't exist, create it.
                if (Settings.FirstOrDefault(o => o.Key == Key).IsNotNull(out var setting))
                {
                    return(setting);
                }

                this[Key] = new GuildSetting(Key);

                return(Settings.FirstOrDefault(o => o.Key == Key));
            }
            set
            {
                if (value is GuildSetting gs) //its a new value.
                {
                    Settings.Add(gs);
                }
                else
                {
                    throw new Exception("Non GuildSetting IGuildSetting detected??");
                }
            }
        }
コード例 #2
0
ファイル: GuildSetting.cs プロジェクト: XtremeOwnage/WarBot
 public GuildSetting(Setting_Key Key)
 {
     this.Key = Key;
 }