Exemple #1
0
        private bool InitLogServer()
        {
            try
            {
                Global.logLevel  = (EnumLogLevel)Enum.Parse(typeof(EnumLogLevel), IniHelper.GetINIValue(iniPath, "main", "loglevel"));
                Global.logServer = new LogHelper((int)Global.logLevel);
                Global.logServer.Run();
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }
Exemple #2
0
        private bool InitDatabase()
        {
            try
            {
                DBInfo info = new DBInfo();

                info.type     = IniHelper.GetINIValue(iniPath, "database", "type");
                info.ip       = IniHelper.GetINIValue(iniPath, "database", "ip");
                info.dbname   = IniHelper.GetINIValue(iniPath, "database", "name");
                info.username = IniHelper.GetINIValue(iniPath, "database", "username");
                info.password = IniHelper.GetINIValue(iniPath, "database", "password");
                info.port     = int.Parse(IniHelper.GetINIValue(iniPath, "database", "port"));
                Global.logServer.Add(new LogInfo("Debug", "main->InitDatabase param value" +
                                                 iniPath + " " + info.type + " " + info.ip + " " + info.dbname + " " + info.username + " " + info.password, (int)EnumLogLevel.DEBUG));
                Global.mysqlHelper = new MysqlHelper(info);
            }
            catch (System.Exception ex)
            {
                Global.logServer.Add(new LogInfo("Error", "Main:InitDatabase 初始化数据库失败:" + ex.Message, (int)EnumLogLevel.ERROR));
                return(false);
            }
            return(true);
        }
Exemple #3
0
 public bool InitSocket()
 {
     Global.socketPort   = int.Parse(IniHelper.GetINIValue(iniPath, "main", "socketport"));
     Global.socketHelper = new SocketHelper("127.0.0.1", Global.socketPort);
     return(Global.socketHelper.Run());
 }