Subversion Repositories spk

Rev

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

Rev 191 Rev 197
Line 33... Line 33...
33
			str += " (RC " + (0 - beta) + ")";
33
			str += " (RC " + (0 - beta) + ")";
34
		return str;
34
		return str;
35
	}
35
	}
36
	void DisplayListIcon(CBaseFile *p, ListView ^list, ListViewItem ^item)
36
	void DisplayListIcon(CBaseFile *p, ListView ^list, ListViewItem ^item)
37
	{
37
	{
38
		Utils::String file = p->icon()->filePointer();
38
		Utils::WString file = p->icon()->filePointer();
39
		if (!file.empty())
39
		if (!file.empty())
40
		{
40
		{
41
			file = file.findReplace("/", "\\").findReplace("\\\\", "\\");
41
			file = file.findReplace(L"/", L"\\").findReplace(L"\\\\", L"\\");
42
			bool doIcon = false;
42
			bool doIcon = false;
43
			System::String ^sFile = _US(file);
43
			System::String ^sFile = _US(file);
44
			int index = list->SmallImageList->Images->IndexOfKey(sFile);
44
			int index = list->SmallImageList->Images->IndexOfKey(sFile);
45
			if ( index != -1 )
45
			if ( index != -1 )
46
			{
46
			{
Line 49... Line 49...
49
			}
49
			}
50
 
50
 
51
			if ( System::IO::File::Exists(sFile) )
51
			if ( System::IO::File::Exists(sFile) )
52
			{
52
			{
53
				doIcon = true;
53
				doIcon = true;
54
				if ( p->iconExt().Compare("bmp") )
54
				if ( p->iconExt().Compare(L"bmp") )
55
				{
55
				{
56
					list->SmallImageList->Images->Add(Bitmap::FromFile(sFile));
56
					list->SmallImageList->Images->Add(Bitmap::FromFile(sFile));
57
					if ( list->SmallImageList != list->LargeImageList )
57
					if ( list->SmallImageList != list->LargeImageList )
58
						list->LargeImageList->Images->Add(Bitmap::FromFile(sFile));
58
						list->LargeImageList->Images->Add(Bitmap::FromFile(sFile));
59
				}
59
				}
60
				else if ( p->iconExt().Compare("ico") )
60
				else if ( p->iconExt().Compare(L"ico") )
61
				{
61
				{
62
					list->SmallImageList->Images->Add(gcnew System::Drawing::Icon(sFile));
62
					list->SmallImageList->Images->Add(gcnew System::Drawing::Icon(sFile));
63
					if ( list->SmallImageList != list->LargeImageList )
63
					if ( list->SmallImageList != list->LargeImageList )
64
						list->LargeImageList->Images->Add(gcnew System::Drawing::Icon(sFile));
64
						list->LargeImageList->Images->Add(gcnew System::Drawing::Icon(sFile));
65
				}
65
				}
Line 93... Line 93...
93
		}
93
		}
94
	}
94
	}
95
 
95
 
96
	void DisplayContextIcon(CBaseFile *p, ToolStripMenuItem ^item, ImageList ^list)
96
	void DisplayContextIcon(CBaseFile *p, ToolStripMenuItem ^item, ImageList ^list)
97
	{
97
	{
98
		Utils::String file = p->icon()->filePointer();
98
		Utils::WString file = p->icon()->filePointer();
99
		if (!file.empty())
99
		if (!file.empty())
100
		{
100
		{
101
			file = file.findReplace("/", "\\").findReplace("\\\\", "\\");
101
			file = file.findReplace(L"/", L"\\").findReplace(L"\\\\", L"\\");
102
			PluginManager::DisplayContextIcon(_US(file), item, list);
102
			PluginManager::DisplayContextIcon(_US(file), item, list);
103
		}
103
		}
104
	}
104
	}
105
 
105
 
106
	void DisplayContextIcon(System::String ^filename, ToolStripMenuItem ^item, ImageList ^list)
106
	void DisplayContextIcon(System::String ^filename, ToolStripMenuItem ^item, ImageList ^list)
Line 132... Line 132...
132
				}
132
				}
133
			}
133
			}
134
		}
134
		}
135
	}
135
	}
136
 
136
 
137
	bool WriteRegistryValue(CyString rKey, CyString rValue)
137
	bool WriteRegistryValue(const Utils::WString &a_rKey, const Utils::WString &rValue)
138
	{
138
	{
139
		Utils::WString first = rKey.GetToken("/", 1, 1).ToString();
139
		Utils::WString first = a_rKey.token(L"/", 1);
140
		rKey = rKey.GetToken("/", 2);
140
		Utils::WString rKey = a_rKey.tokens(L"/", 2);
141
 
141
 
142
		RegistryKey ^startKey = nullptr;
142
		RegistryKey ^startKey = nullptr;
143
		if ( first.Compare("HKCU") )
143
		if ( first.Compare(L"HKCU") )
144
			startKey = Registry::CurrentUser;
144
			startKey = Registry::CurrentUser;
145
		else if ( first.Compare("HKLM") )
145
		else if ( first.Compare(L"HKLM") )
146
			startKey = Registry::LocalMachine;
146
			startKey = Registry::LocalMachine;
147
 
147
 
148
		if ( startKey )
148
		if ( startKey )
149
		{
149
		{
150
			Utils::WString value = rKey.GetToken("/", rKey.NumToken("/")).ToString();
150
			Utils::WString value = rKey.token(L"/", rKey.countToken(L"/"));
151
			rKey = rKey.GetToken("/", 1, rKey.NumToken("/") - 1);
151
			rKey = rKey.tokens(L"/", 1, rKey.countToken(L"/") - 1);
152
			RegistryKey ^writeKey = startKey->OpenSubKey(_US(rKey.FindReplace("/", "\\").ToString()), true);
152
			RegistryKey ^writeKey = startKey->OpenSubKey(_US(rKey.findReplace(L"/", L"\\")), true);
153
			if ( writeKey )
153
			if ( writeKey )
154
			{
154
			{
155
				writeKey->SetValue(_US(value), _US(rValue.ToString()));
155
				writeKey->SetValue(_US(value), _US(rValue));
156
				return true;
156
				return true;
157
			}
157
			}
158
		}
158
		}
159
 
159
 
160
		return false;
160
		return false;
161
	}
161
	}
162
 
162
 
163
	System::String ^ReadRegistryValue(CyString rKey)
163
	System::String ^ReadRegistryValue(const Utils::WString &a_rKey)
164
	{
164
	{
165
		Utils::WString first = rKey.GetToken("/", 1, 1).ToString();
165
		Utils::WString first = a_rKey.token(L"/", 1);
166
		rKey = rKey.GetToken("/", 2);
166
		Utils::WString rKey = a_rKey.tokens(L"/", 2);
167
 
167
 
168
		System::String ^strKey;
168
		System::String ^strKey;
169
 
169
 
170
		RegistryKey ^startKey = nullptr;
170
		RegistryKey ^startKey = nullptr;
171
		if ( first.Compare("HKCU") )
171
		if ( first.Compare("HKCU") )
Line 173... Line 173...
173
		else if ( first.Compare("HKLM") )
173
		else if ( first.Compare("HKLM") )
174
			startKey = Registry::LocalMachine;
174
			startKey = Registry::LocalMachine;
175
 
175
 
176
		if ( startKey )
176
		if ( startKey )
177
		{
177
		{
178
			Utils::WString value = rKey.GetToken("/", rKey.NumToken("/")).ToString();
178
			Utils::WString value = rKey.token(L"/", rKey.countToken(L"/"));
179
			rKey = rKey.GetToken("/", 1, rKey.NumToken("/") - 1);
179
			rKey = rKey.tokens(L"/", 1, rKey.countToken(L"/") - 1);
180
			RegistryKey ^readKey = startKey->OpenSubKey(_US(rKey.FindReplace("/", "\\").ToString()), true);
180
			RegistryKey ^readKey = startKey->OpenSubKey(_US(rKey.findReplace(L"/", L"\\")), true);
181
			if ( readKey )
181
			if ( readKey )
182
				strKey = System::Convert::ToString(readKey->GetValue(_US(value)));
182
				strKey = System::Convert::ToString(readKey->GetValue(_US(value)));
183
		}
183
		}
184
 
184
 
185
		return strKey;
185
		return strKey;