Esempio n. 1
0
 public static bool Init()
 {
     bool result = false;
     try
     {
         m_rsa = new RSACryptoServiceProvider();
         m_rsa.FromXmlString(GameServer.Instance.Configuration.PrivateKey);
         m_players.Clear();
         using (ServiceBussiness db = new ServiceBussiness())
         {
             ServerInfo info = db.GetServiceSingle(GameServer.Instance.Configuration.ServerID);
             if (info != null)
             {
                 _marryScene = new Scene(info);
                 result = true;
             }                    
         }                
     }
     catch (Exception e)
     {
         log.Error("WordMgr Init", e);                
     }
     return result;
 }
Esempio n. 2
0
        protected override void Load(Type type)
        {
            if (Assembly.GetEntryAssembly() != null)
                RootDirectory = new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName;
            else
                RootDirectory = new FileInfo(Assembly.GetAssembly(typeof(GameServer)).Location).DirectoryName;

            //load app.config
            base.Load(type);

            //load server config in db
            using (ServiceBussiness sb = new ServiceBussiness())
            {
                ServerInfo info = sb.GetServiceSingle(ServerID);
                if (info == null)
                {
                    log.ErrorFormat("Can't find server config,server id {0}", ServerID);
                }
                else
                {
                    ServerName = info.Name;
                    MaxRoomCount = info.Room;
                    MaxPlayerCount = info.Total;
                }
            }
        }