public static void CanCommandWithoutGuest(bool p_Value) { using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("cmdguest"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "cmdguest", Value = p_Value.ToString() }; s_Db.Insert(s_Setting); } else { s_Setting.Value = p_Value.ToString(); s_Db.Update(s_Setting); } } m_CanCommandWithoutGuest = p_Value; }
public static char CommandPrefix() { if (m_CommandPrefix.HasValue) return m_CommandPrefix.Value; using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("cmdprefix"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "cmdprefix", Value = "!" }; s_Db.Insert(s_Setting); } m_CommandPrefix = Char.Parse(s_Setting.Value); } return m_CommandPrefix.Value; }
public static bool CanCommandWithoutGuest() { if (m_CanCommandWithoutGuest.HasValue) return m_CanCommandWithoutGuest.Value; using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("cmdguest"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "cmdguest", Value = true.ToString() }; s_Db.Insert(s_Setting); } m_CanCommandWithoutGuest = Boolean.Parse(s_Setting.Value); } return m_CanCommandWithoutGuest.Value; }
public static void CommandPrefix(char p_Prefix) { if (Char.IsLetterOrDigit(p_Prefix)) return; using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("cmdprefix"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "cmdprefix", Value = p_Prefix.ToString() }; s_Db.Insert(s_Setting); } else { s_Setting.Value = p_Prefix.ToString(); s_Db.Update(s_Setting); } } m_CommandPrefix = p_Prefix; }
public static void SongVoteThreshold(int p_Threshold) { if (p_Threshold > 0) return; using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("votethreshold"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "votethreshold", Value = p_Threshold.ToString() }; s_Db.Insert(s_Setting); } else { s_Setting.Value = p_Threshold.ToString(); s_Db.Update(s_Setting); } } m_SongVoteThreshold = p_Threshold; }
public static int SongVoteThreshold() { if (m_SongVoteThreshold.HasValue) return m_SongVoteThreshold.Value; using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("votethreshold"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "votethreshold", Value = "0" }; s_Db.Insert(s_Setting); } m_SongVoteThreshold = Int32.Parse(s_Setting.Value); } return m_SongVoteThreshold.Value; }
public static void MaxHistorySongs(int p_Songs) { using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("history"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "history", Value = p_Songs.ToString() }; s_Db.Insert(s_Setting); } else { s_Setting.Value = p_Songs.ToString(); s_Db.Update(s_Setting); } } m_MaxHistorySongs = p_Songs; }
public static int MaxHistorySongs() { if (m_MaxHistorySongs.HasValue) return m_MaxHistorySongs.Value; using (var s_Db = Database.GetConnection()) { var s_Setting = s_Db.SingleById<CoreSetting>("history"); if (s_Setting == null) { s_Setting = new CoreSetting() { Key = "history", Value = "1" }; s_Db.Insert(s_Setting); } m_MaxHistorySongs = Int32.Parse(s_Setting.Value); } return m_MaxHistorySongs.Value; }