using MySql.Data.MySqlClient;
using StackExchange.Redis;

 
   public class Config
    {

        public const bool GameOnline = true;  

        public ConfigurationOptions redis;

        public MySqlConnectionStringBuilder mysql;
        /// <summary>
        /// 结束倒计时
        /// </summary>
        public int CountDownTimes => GameOnline ? 10 * 60 : 2 * 60;

        /// <summary>
        /// 结算地址
        /// </summary>
        public string SettleUrl
        {
            get
            {
                var host = "192.168.10.87";
                if (GameOnline)
                {
                    host = "115.159.121.129";
                }
                return $"http://{host}/ylsj2019/Gameserver/Amfphp/service_call/InquireApi/WorldBosSettle.php";
            }
        }

        private Config() { }

        static private Config _ins;
        public static Config Ins
        {
            get
            {

                if (null == _ins)
                {
                    if (GameOnline)
                    {
                        var host = "127.0.0.1";
                        var port = 6379;
                        var pwd = "wanggang1985";
                        _ins = new Config()
                        {
                            redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
                            mysql = new MySqlConnectionStringBuilder
                            {
                                Server = "127.0.0.1",
                                UserID = "gwang",
                                Password = "wanggang1985",
                                Port = 3306,
                                Database = "ylsj2019_pay",
                                CharacterSet = "utf8"
                            }
                        };
                    }
                    else
                    {
                        var host = "192.168.10.16";
                        var port = 6004;
                        var pwd = "wanggang1985";
                        _ins = new Config()
                        {
                            redis = ConfigurationOptions.Parse($"{host}:{port},password={pwd},connectTimeout=2000"),
                            mysql = new MySqlConnectionStringBuilder
                            {
                                Server = "192.168.10.16",
                                UserID = "gwang",
                                Password = "wanggang1985",
                                Port = 3306,
                                Database = "ylsj2019_pay",
                                CharacterSet = "utf8"
                            }
                        };
                    }
                }
                return _ins;
            }
        }

    }
 