public static CreateExceptionFromCoreLib ( ) : |
||
리턴 |
/// <summary> /// Destroy llbc library. /// </summary> public static void Destroy() { if (LLBCNative.csllbc_Cleanup() != 0) { throw ExceptionUtil.CreateExceptionFromCoreLib(); } }
/// <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(); } }
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(); } }
/// <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); }
/// <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"); } }