namespace TK
{
public enum class LogLevel { Kernel, Fatal, Error, Warning, Infomation, Debug};
public ref class LogHelper
{
public:
static bool Open(String^ filename);
static void Close();
static bool Write(LogLevel level,String^ format,
array<Object^>^ args);
static bool WriteLine(LogLevel level,String^ format,
array<Object^>^ args);
static void SetLevel(LogLevel level);
};
}
static void MarshalString(String^ net, CString& os) {
LPCTSTR chars = (LPCTSTR)(Marshal::StringToHGlobalUni(net)).ToPointer();
os = chars;
Marshal::FreeHGlobal(IntPtr((
void*)chars));
}
#pragma unmanaged
static CStringA CStrW2CStrA(
const CStringW &cstrSrcW)
{
int len = WideCharToMultiByte(CP_UTF8, 0, LPCWSTR(cstrSrcW), -1, NULL, 0, NULL, NULL);
char *str =
new char[len];
memset(str, 0, len);
WideCharToMultiByte(CP_UTF8, 0, LPCWSTR(cstrSrcW), -1, str, len, NULL, NULL);
CStringA cstrDestA = str;
delete[] str;
return cstrDestA;
}
#pragma managed