Beispiel #1
0
        public static bool Init(EPlatform ePlatform, bool isUseNetModule, ILPNetMessageHandler netMessageHandler)
        {
            bool bResult = false;

            bResult = _InitConfig(ePlatform);
            if (LPError.PTF_ERROR(bResult))
            {
                goto Exit0;
            }

            bResult = _InitLogger();
            if (LPError.PTF_ERROR(bResult))
            {
                goto Exit0;
            }

            if (isUseNetModule)
            {
                bResult = _InitNet(netMessageHandler);
                if (LPError.LOG_ERROR(bResult))
                {
                    goto Exit0;
                }
            }

            return(true);

Exit0:
            return(false);
        }
Beispiel #2
0
        private static bool _InitLogger()
        {
            #if DEBUG
            m_Logger = LPLogger.CreateLogger(ELogType.File, m_sLogDir, m_sProgramName, ELogMode.DayDivide,
                                             (int)(EOutputType.File | EOutputType.Debug | EOutputType.Console), null, (int)(ELogLevel.All), false);
            #else
            m_Logger = LPLogger.CreateLogger(ELogType.File, m_sLogDir, m_sProgramName, ELogMode.DayDivide,
                                             (int)(EOutputType.File | EOutputType.Console), null, (int)(ELogLevel.All), false);
            #endif

            if (LPError.PTF_ERROR(m_Logger != null))
            {
                goto Exit0;
            }

            #if DEBUG
            LP.Logger.IMP("{0}", "debug mode...");
            #else
            LP.Logger.IMP("{0}", "release mode...");
            #endif

            return(true);

Exit0:
            return(false);
        }
Beispiel #3
0
        public static bool UnInit()
        {
            if (m_Logger != null)
            {
                LPError.PTF_ERROR(m_Logger.UnInit());
                m_Logger = null;
            }

            if (m_NetModule != null)
            {
                LPError.PTF_ERROR(m_NetModule.UnInit());
                m_NetModule = null;
            }

            return(true);
        }
Beispiel #4
0
        private static bool _InitConfig(EPlatform ePlatform)
        {
            switch (ePlatform)
            {
            case EPlatform.Pc:
            {
                m_sLogDir      = "log_pc";
                m_sDumpDir     = m_sLogDir + "/dump_pc";
                m_sConfigDir   = "config_pc";
                m_sProgramName = LPG.GetExeProcessName() + "_pc";
            }
            break;

            case EPlatform.Ios:
            {
                m_sLogDir      = "log_ios";
                m_sDumpDir     = m_sLogDir + "/dump_ios";
                m_sConfigDir   = "config_ios";
                m_sProgramName = LPG.GetExeProcessName() + "_ios";
            }
            break;

            case EPlatform.Android:
            {
                m_sLogDir      = "log_android";
                m_sDumpDir     = m_sLogDir + "/dump_android";
                m_sConfigDir   = "config_android";
                m_sProgramName = LPG.GetExeProcessName() + "_android";
            }
            break;

            default:
                if (LPError.PTF_ERROR(false))
                {
                    goto Exit0;
                }
                break;
            }

            return(true);

Exit0:
            return(false);
        }
Beispiel #5
0
        private static bool _InitNet(ILPNetMessageHandler netMessageHandler)
        {
            bool bResult = false;

            m_NetModule = new LPNet();
            if (LPError.LOG_ERROR(m_NetModule != null))
            {
                goto Exit0;
            }

            bResult = m_NetModule.Init(netMessageHandler);
            if (LPError.LOG_ERROR(bResult))
            {
                goto Exit0;
            }

            return(true);

Exit0:
            return(false);
        }