Subversion Repositories spk

Rev

Rev 170 | Rev 191 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 170 Rev 187
Line 1... Line 1...
1
#include <spk.h>
1
#include <spk.h>
-
 
2
#include "Utils/WString.h"
2
 
3
 
3
using namespace System;
4
using namespace System;
4
using namespace Runtime::InteropServices;
5
using namespace Runtime::InteropServices;
5
using namespace System::Drawing;
6
using namespace System::Drawing;
6
 
7
 
7
#define CONNECTERROR_UNKNOWN	-1
8
#define CONNECTERROR_UNKNOWN	-1
8
enum {CONNECTERROR_NONE, CONNECTERROR_TIMEOUT, CONNECTERROR_NOFILE, CONNECTERROR_FAILED};
9
enum {CONNECTERROR_NONE, CONNECTERROR_TIMEOUT, CONNECTERROR_NOFILE, CONNECTERROR_FAILED};
9
 
10
 
10
inline Utils::String _S(System::String ^str)
11
inline Utils::String _S(System::String^ str)
11
{
12
{
12
	if ( !str || !str->Length )
13
	if (!str || !str->Length)
13
		return "";
14
		return "";
14
	const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
15
	const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
15
	std::string s = chars;
16
	std::string s = chars;
16
	Marshal::FreeHGlobal(IntPtr((void*)chars));
17
	Marshal::FreeHGlobal(IntPtr((void*)chars));
17
	return s;
18
	return s;
18
}
19
}
-
 
20
inline Utils::WString _WS(System::String^ str)
-
 
21
{
-
 
22
	if (!str || !str->Length)
-
 
23
		return L"";
-
 
24
	const wchar_t* chars = (const wchar_t*)(Marshal::StringToHGlobalUni(str)).ToPointer();
-
 
25
	std::wstring s = chars;
-
 
26
	Marshal::FreeHGlobal(IntPtr((void*)chars));
-
 
27
	return s;
-
 
28
}
19
inline CyString CyStringFromSystemString( System::String ^str)
29
inline CyString CyStringFromSystemString( System::String ^str)
20
{
30
{
21
	if ( !str || !str->Length )
31
	if ( !str || !str->Length )
22
		return NullString;
32
		return NullString;
23
	const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
33
	const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(str)).ToPointer();
Line 98... Line 108...
98
inline System::String ^SystemStringFromCyString ( CyString str )
108
inline System::String ^SystemStringFromCyString ( CyString str )
99
{
109
{
100
	System::String ^Str = gcnew System::String(str.c_str());
110
	System::String ^Str = gcnew System::String(str.c_str());
101
	return Str;
111
	return Str;
102
}
112
}
-
 
113
 
103
inline System::String ^_US(const Utils::String &str)
114
inline System::String^ _US(const Utils::WString& str)
104
{
115
{
105
	System::String ^Str = gcnew System::String(str.c_str());
116
	System::String^ Str = gcnew System::String(str.c_str());
106
	return Str;
117
	return Str;
107
}
118
}
108
 
119
 
109
inline System::Drawing::Bitmap ^LoadIcon(CBaseFile *p)
120
inline System::Drawing::Bitmap ^LoadIcon(CBaseFile *p)
110
{
121
{