CreateExceptionFromCoreLib() 공개 정적인 메소드

Create exception from llbc core library.
public static CreateExceptionFromCoreLib ( ) : LLBCException
리턴 LLBCException
예제 #1
0
 /// <summary>
 /// Destroy llbc library.
 /// </summary>
 public static void Destroy()
 {
     if (LLBCNative.csllbc_Cleanup() != 0)
     {
         throw ExceptionUtil.CreateExceptionFromCoreLib();
     }
 }
예제 #2
0
        /// <summary>
        /// Schedule timer.
        /// </summary>
        /// <param name="dueTime">dueTime, in seconds</param>
        /// <param name="period">period, in seconds, default is 0.0, means same with dueTime</param>
        public void Schedule(double dueTime, double period = 0.0)
        {
            int ret = LLBCNative.csllbc_Timer_Schedule(
                _nativeTimer, (ulong)(dueTime * 1000), (ulong)(period * 1000));

            if (ret != LLBCNative.LLBC_OK)
            {
                throw ExceptionUtil.CreateExceptionFromCoreLib();
            }
        }
예제 #3
0
파일: Logger.cs 프로젝트: ericyonng/llbc
        public Logger(string loggerName)
        {
            _loggerName = loggerName;
            IntPtr nativeLoggerName = LibUtil.CreateNativeStr(_loggerName);

            _nativeLogger = LLBCNative.csllbc_Log_GetLogger(nativeLoggerName);
            System.Runtime.InteropServices.Marshal.FreeHGlobal(nativeLoggerName);

            if (_nativeLogger == IntPtr.Zero)
            {
                throw ExceptionUtil.CreateExceptionFromCoreLib();
            }
        }
예제 #4
0
        /// <summary>
        /// Init llbc library.
        /// </summary>
        public static void Init(Assembly loaderAssembly)
        {
            if (loaderAssembly == null)
            {
                throw new LLBCException("Loader assembly could not be null");
            }
            else if (LLBCNative.csllbc_Startup() != 0)
            {
                throw ExceptionUtil.CreateExceptionFromCoreLib();
            }

            _loaderAssembly = loaderAssembly;
            RegHolderCollector.Collect(loaderAssembly, false);
        }
예제 #5
0
파일: LoggerMgr.cs 프로젝트: zhouyanlt/llbc
        /// <summary>
        /// Initialize Log.
        /// </summary>
        /// <param name="logCfgFile">log config file</param>
        public static void Init(string logCfgFile)
        {
            if (string.IsNullOrEmpty(logCfgFile))
            {
                throw new LLBCException("please specific log config file");
            }

            lock (_lock)
            {
                IntPtr nativeStr = LibUtil.CreateNativeStr(logCfgFile);
                int    ret       = LLBCNative.csllbc_Log_Init(nativeStr);
                System.Runtime.InteropServices.Marshal.FreeHGlobal(nativeStr);

                if (ret != LLBCNative.LLBC_OK)
                {
                    throw ExceptionUtil.CreateExceptionFromCoreLib();
                }

                _rootLogger = Get("root");
            }
        }