Beispiel #1
0
        public BaseConfig(Variant config)
        {
            this.BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;

            this.Platform = config.GetStringOrDefault("Platform", Sinan.Entity.Platform.Tencent);
            this.DirConfig = Path.Combine(this.BaseDirectory, fixPath(config.GetStringOrDefault("DirConfig", "Config")));

            this.Crossdomain = Path.Combine(DirConfig, fixPath(config.GetStringOrDefault("Crossdomain", "crossdomain.txt")));
            this.DirBase = Path.Combine(DirConfig, fixPath(config.GetStringOrDefault("DirBase", "base")));
            this.DirGame = Path.Combine(DirConfig, fixPath(config.GetStringOrDefault("DirGame", "game")));
            this.DirDB = Path.Combine(DirConfig, fixPath(config.GetStringOrDefault("DirDB", "db")));

            this.Language = config.GetStringOrDefault("Language");
            if (!string.IsNullOrWhiteSpace(Language))
            {
                string path = Path.Combine(DirConfig, fixPath(Language));
                if (Directory.Exists(path))
                {
                    this.DirBase = path;
                }
            }

            this.DirPlugin = Path.Combine(BaseDirectory, fixPath(config.GetStringOrDefault("DirPlugin", "Plugins")));
            this.Log4Config = Path.Combine(BaseDirectory, fixPath(config.GetStringOrDefault("Log4Config", "log4net.config")));

            this.DbBase = config.GetStringOrDefault("DbBase");
            this.DbLog = config.GetStringOrDefault("DbLog");
            this.DbPlayer = config.GetStringOrDefault("DbPlayer");

            string epGame = config.GetStringOrDefault("EpGame");
            this.EpGame = CreateEndPoint(epGame);

            string epGM = config.GetStringOrDefault("EpGM");
            this.EpGM = CreateEndPoint(epGM);

            string epGMM = config.GetStringOrDefault("EpGMM");
            this.EpGMM = CreateEndPoint(epGMM);

            string epShip = config.GetStringOrDefault("EpShip");
            this.EpShip = CreateEndPoint(epShip);

            this.MaxClient = config.GetIntOrDefault("MaxClient", 500);
            this.SendQueueSize = config.GetIntOrDefault("SendQueueSize", 100);
            this.MaxLevel = config.GetIntOrDefault("MaxLevel", 100);
            this.MaxNameLen = config.GetIntOrDefault("MaxNameLen", 16);

            this.Zoneid = config.GetIntOrDefault("Zoneid");
            this.ZoneEpoch = config.GetUtcTimeOrDefault("ZoneEpoch");

            this.DesKey = config.GetStringOrDefault("DESKey");
            this.LoginKey = config.GetStringOrDefault("LoginKey") ?? config.GetStringOrDefault("MD5Key");
            this.RechargeKey = config.GetStringOrDefault("RechargeKey");
            this.GMKey = config.GetStringOrEmpty("GMKey");
            this.ReportSIP = config.GetStringOrDefault("ReportSIP");

            this.WebAddress = config.GetStringOrDefault("WebAddress");

            this.FreeCoin = config.GetBooleanOrDefault("FreeCoin", false);
        }