Esempio n. 1
0
 protected GameServer(GameServerConfig config)
 {
     this.m_config = config;
     //if (GameServer.log.IsDebugEnabled)
     //{
     GameServer.log.Debug("Current directory is: " + Directory.GetCurrentDirectory());
     GameServer.log.Debug("Gameserver root directory is: " + this.Config.RootDirectory);
     GameServer.log.Debug("Changing directory to root directory");
     //}
     Directory.SetCurrentDirectory(this.Config.RootDirectory);
 }
Esempio n. 2
0
        /// <summary>
        /// 游戏服务器
        /// </summary>
        /// <param name="config"></param>
        protected GameServer(GameServerConfig config)
        {
            m_config = config;

            if (log.IsDebugEnabled)
            {
                log.Debug("Current directory is: " + Directory.GetCurrentDirectory());
                log.Debug("Gameserver root directory is: " + Configuration.RootDirectory);
                log.Debug("Changing directory to root directory");
            }

            Directory.SetCurrentDirectory(Configuration.RootDirectory);
        }
Esempio n. 3
0
        /// <summary>
        /// 游戏服务器
        /// </summary>
        /// <param name="config"></param>
        protected GameServer(GameServerConfig config)
        {
            m_config = config;

            if (log.IsDebugEnabled)
            {
                log.Debug("Current directory is: " + Directory.GetCurrentDirectory());
                log.Debug("Gameserver root directory is: " + Configuration.RootDirectory);
                log.Debug("Changing directory to root directory");
            }

            Directory.SetCurrentDirectory(Configuration.RootDirectory);
        }
Esempio n. 4
0
        public static void CreateInstance(GameServerConfig config)
        {
            //Only one intance
            if (m_instance != null)
                return;

            // 加载配置文件
            FileInfo logConfig = new FileInfo(config.LogConfigFile);
            if (!logConfig.Exists)
            {
                ResourceUtil.ExtractResource(logConfig.Name, logConfig.FullName,Assembly.GetAssembly(typeof(GameServer)));
            }
            
            //设置日志的配置
            XmlConfigurator.ConfigureAndWatch(logConfig);
   
            m_instance = new GameServer(config);
        }
Esempio n. 5
0
        public static void CreateInstance(GameServerConfig config)
        {
            //Only one intance
            if (m_instance != null)
            {
                return;
            }

            // 加载配置文件
            FileInfo logConfig = new FileInfo(config.LogConfigFile);

            if (!logConfig.Exists)
            {
                ResourceUtil.ExtractResource(logConfig.Name, logConfig.FullName, Assembly.GetAssembly(typeof(GameServer)));
            }

            //设置日志的配置
            XmlConfigurator.ConfigureAndWatch(logConfig);

            m_instance = new GameServer(config);
        }
Esempio n. 6
0
        private static bool StartServer()
        {
            //TODO parse args for -config parameter!
            FileInfo dolserver = new FileInfo(Assembly.GetExecutingAssembly().Location);
            Directory.SetCurrentDirectory(dolserver.DirectoryName);
            FileInfo configFile = new FileInfo("./config/serverconfig.xml");
            GameServerConfig config = new GameServerConfig();
            //if (configFile.Exists)
            //{
            //    config.LoadFromXMLFile(configFile);
            //}
            //else
            //{
            //    if (!configFile.Directory.Exists)
            //        configFile.Directory.Create();
            //    config.SaveToXMLFile(configFile);
            //}

            GameServer.CreateInstance(config);

            return GameServer.Instance.Start();
        }