Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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;
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
        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;
        }