123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using System.IO;
- using MySql.Data.MySqlClient;
- using StackExchange.Redis;
-
- public class Config
- {
-
- public const bool GameOnline = true;
-
- public ConfigurationOptions redis;
- public MySqlConnectionStringBuilder mysql;
- public string mongo => GameOnline ? "mongodb://localhost:27017" : "mongodb://localhost:27017";
- /// <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";
- }
- }
- public string OutDir
- {
- get
- {
- var dir = "/data/stat_out/";
- VerifyFolder(dir);
- return dir;
- }
- }
- /// <summary>
- /// 确保路径存在
- /// </summary>
- /// <param name="dir"></param>
- internal static void VerifyFolder(string dir)
- {
- if (!Directory.Exists(dir))
- {
- Directory.CreateDirectory(dir);
- }
- }
- 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;
- }
- }
- }
|