121 |
cycrow |
1 |
#include "../stdafx.h"
|
|
|
2 |
#include "DirectoryControl.h"
|
|
|
3 |
|
|
|
4 |
using namespace PluginManager;
|
|
|
5 |
|
196 |
cycrow |
6 |
DirectoryControl::DirectoryControl(CPackages *packages, Utils::WStringList *currentDirs, Utils::WStringList *removedDirs)
|
121 |
cycrow |
7 |
{
|
|
|
8 |
InitializeComponent();
|
|
|
9 |
|
|
|
10 |
this->listView1->LargeImageList = this->imageListGames;
|
|
|
11 |
this->listView1->SmallImageList = this->imageListGames;
|
|
|
12 |
this->listView2->LargeImageList = this->imageListGames;
|
|
|
13 |
this->listView2->SmallImageList = this->imageListGames;
|
|
|
14 |
|
|
|
15 |
_packages = packages;
|
196 |
cycrow |
16 |
_lDirs = new Utils::WStringList();
|
|
|
17 |
_lRemoveDirs = new Utils::WStringList();
|
|
|
18 |
_lFoundDirs = new Utils::WStringList();
|
121 |
cycrow |
19 |
|
|
|
20 |
this->getAllDirs(currentDirs, removedDirs);
|
|
|
21 |
this->UpdateGameDirs();
|
|
|
22 |
this->UpdateFoundDirs();
|
122 |
cycrow |
23 |
this->UpdateTexts();
|
121 |
cycrow |
24 |
}
|
|
|
25 |
|
|
|
26 |
DirectoryControl::~DirectoryControl()
|
|
|
27 |
{
|
|
|
28 |
if (components)
|
|
|
29 |
{
|
|
|
30 |
delete components;
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
delete _lDirs;
|
|
|
34 |
delete _lRemoveDirs;
|
|
|
35 |
delete _lFoundDirs;
|
|
|
36 |
}
|
|
|
37 |
|
196 |
cycrow |
38 |
void DirectoryControl::AddFoundDir(const Utils::WString &dir)
|
121 |
cycrow |
39 |
{
|
|
|
40 |
if (CDirIO(dir).exists())
|
|
|
41 |
{
|
197 |
cycrow |
42 |
Utils::WString gameName = _packages->GetGameExe()->gameName(dir);
|
121 |
cycrow |
43 |
if (!gameName.empty())
|
|
|
44 |
{
|
|
|
45 |
if (!_lFoundDirs->contains(dir, true) && !_lDirs->contains(dir, true) && !_lRemoveDirs->contains(dir, true))
|
|
|
46 |
{
|
197 |
cycrow |
47 |
Utils::WString exe = dir.findReplace(L"\\", L"/").findReplace(L"//", L"/");
|
|
|
48 |
_lFoundDirs->pushBack(exe, _packages->GetGameExe()->gameName(exe));
|
121 |
cycrow |
49 |
}
|
|
|
50 |
}
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
|
196 |
cycrow |
54 |
void DirectoryControl::FindAllAddons(const Utils::WString &exe, bool checkBase)
|
121 |
cycrow |
55 |
{
|
|
|
56 |
CDirIO Dir(exe);
|
|
|
57 |
|
197 |
cycrow |
58 |
if (checkBase && _packages->GetGameExe()->isAddon(exe))
|
121 |
cycrow |
59 |
{
|
197 |
cycrow |
60 |
Utils::WString base = _packages->getGameRunExe(_packages->GetGameExe()->gameDir(exe));
|
121 |
cycrow |
61 |
if (CFileIO::Exists(base))
|
|
|
62 |
{
|
|
|
63 |
AddFoundDir(base);
|
|
|
64 |
FindAllAddons(base, false);
|
|
|
65 |
return;
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
if (Dir.isFile())
|
|
|
70 |
{
|
|
|
71 |
CFileIO file(exe);
|
|
|
72 |
if (file.exists())
|
|
|
73 |
{
|
|
|
74 |
// dont include addons, only the base game
|
197 |
cycrow |
75 |
if (!_packages->GetGameExe()->isAddon(exe))
|
121 |
cycrow |
76 |
{
|
|
|
77 |
CDirIO dir(file.dir());
|
197 |
cycrow |
78 |
Utils::WStringList list;
|
121 |
cycrow |
79 |
// get all the addons from a base game
|
197 |
cycrow |
80 |
if (_packages->getGameAddons(list, _packages->GetGameExe()->properDir(exe)))
|
121 |
cycrow |
81 |
{
|
197 |
cycrow |
82 |
for (Utils::WStringNode *a_item = list.first(); a_item; a_item = list.next())
|
121 |
cycrow |
83 |
{
|
|
|
84 |
//check both the exe and the data directory exists
|
|
|
85 |
if (dir.exists(a_item->data) && dir.exists(a_item->str))
|
|
|
86 |
{
|
196 |
cycrow |
87 |
Utils::WString newFile = dir.file(a_item->str);
|
121 |
cycrow |
88 |
AddFoundDir(newFile);
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
}
|
|
|
94 |
}
|
|
|
95 |
else if (Dir.exists())
|
|
|
96 |
{
|
197 |
cycrow |
97 |
Utils::WStringList list;
|
121 |
cycrow |
98 |
// get all the addons from a base game
|
197 |
cycrow |
99 |
if (_packages->getGameAddons(list, _packages->GetGameExe()->properDir(exe)))
|
121 |
cycrow |
100 |
{
|
197 |
cycrow |
101 |
for (Utils::WStringNode *a_item = list.first(); a_item; a_item = list.next())
|
121 |
cycrow |
102 |
{
|
|
|
103 |
//check both the exe and the data directory exists
|
|
|
104 |
if (Dir.exists(a_item->data) && Dir.exists(a_item->str))
|
|
|
105 |
{
|
196 |
cycrow |
106 |
Utils::WString newFile = Dir.file(a_item->str);
|
121 |
cycrow |
107 |
AddFoundDir(newFile);
|
|
|
108 |
}
|
|
|
109 |
}
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
}
|
|
|
113 |
|
196 |
cycrow |
114 |
void DirectoryControl::getAllDirs(Utils::WStringList *currentDirs, Utils::WStringList *removedDirs)
|
121 |
cycrow |
115 |
{
|
|
|
116 |
if (currentDirs)
|
|
|
117 |
{
|
|
|
118 |
for (auto itr = currentDirs->begin(); itr != currentDirs->end(); itr++)
|
|
|
119 |
{
|
196 |
cycrow |
120 |
Utils::WString data = (*itr)->data;
|
|
|
121 |
if(data.contains(L"|"))
|
224 |
cycrow |
122 |
_lDirs->pushBack(_packages->getGameRunExe((*itr)->str), data.tokens(L"|", 2));
|
121 |
cycrow |
123 |
else
|
224 |
cycrow |
124 |
_lDirs->pushBack(_packages->getGameRunExe((*itr)->str), data);
|
121 |
cycrow |
125 |
}
|
|
|
126 |
}
|
|
|
127 |
if (removedDirs)
|
|
|
128 |
{
|
|
|
129 |
for (auto itr = removedDirs->begin(); itr != removedDirs->end(); itr++)
|
224 |
cycrow |
130 |
_lRemoveDirs->pushBack(_packages->getGameRunExe((*itr)->str), (*itr)->data);
|
121 |
cycrow |
131 |
}
|
|
|
132 |
|
|
|
133 |
// find other dirs
|
|
|
134 |
System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles);
|
222 |
cycrow |
135 |
Utils::WStringList gameDirs;
|
|
|
136 |
gameDirs.pushBack(L"HKCU\\Software\\Deepsilver\\X2 The Threat", L"INSTALL_DIR");
|
|
|
137 |
gameDirs.pushBack(L"HKCU\\Software\\Deepsilver\\X3 Reunion", L"INSTALL_DIR");
|
|
|
138 |
gameDirs.pushBack(L"HKCU\\Software\\Egosoft\\X3TC", L"INSTALL_DIR");
|
|
|
139 |
gameDirs.pushBack(L"Steam\\x2 - the threat");
|
|
|
140 |
gameDirs.pushBack(L"Steam\\x3 - reunion");
|
|
|
141 |
gameDirs.pushBack(L"Steam\\x3 terran conflict");
|
121 |
cycrow |
142 |
// some custom directories to look for
|
222 |
cycrow |
143 |
gameDirs.pushBack(L"%PROGRAMFILES%\\Egosoft\\X2 The Threat");
|
|
|
144 |
gameDirs.pushBack(L"%PROGRAMFILES%\\Egosoft\\X3 Reunion");
|
|
|
145 |
gameDirs.pushBack(L"%PROGRAMFILES%\\Egosoft\\X3 Terran Conflict");
|
|
|
146 |
gameDirs.pushBack(L"C:\\Games\\X2");
|
|
|
147 |
gameDirs.pushBack(L"C:\\Games\\X3");
|
|
|
148 |
gameDirs.pushBack(L"C:\\Games\\X3TC");
|
|
|
149 |
gameDirs.pushBack(L"D:\\Games\\X2");
|
|
|
150 |
gameDirs.pushBack(L"D:\\Games\\X3");
|
|
|
151 |
gameDirs.pushBack(L"D:\\Games\\X3TC");
|
|
|
152 |
for (Utils::WStringNode *strNode = gameDirs.first(); strNode; strNode = gameDirs.next())
|
121 |
cycrow |
153 |
{
|
222 |
cycrow |
154 |
Utils::WString sFirst = strNode->str.token(L"\\", 1);
|
|
|
155 |
Utils::WString sRest = strNode->str.tokens(L"\\", 2);
|
121 |
cycrow |
156 |
|
222 |
cycrow |
157 |
if (sFirst.Compare(L"HKCU") || sFirst.Compare(L"HKLM"))
|
121 |
cycrow |
158 |
{
|
|
|
159 |
RegistryKey ^searchKey = nullptr;
|
222 |
cycrow |
160 |
if (sFirst.Compare(L"HKCU"))
|
121 |
cycrow |
161 |
searchKey = Registry::CurrentUser->OpenSubKey(_US(sRest));
|
222 |
cycrow |
162 |
else if (sFirst.Compare(L"HKLM"))
|
121 |
cycrow |
163 |
searchKey = Registry::LocalMachine->OpenSubKey(_US(sRest));
|
|
|
164 |
|
|
|
165 |
if (searchKey)
|
|
|
166 |
{
|
|
|
167 |
System::String ^regRead = System::Convert::ToString(searchKey->GetValue(_US(strNode->data)));
|
|
|
168 |
if (regRead)
|
197 |
cycrow |
169 |
AddFoundDir(_packages->GetGameExe()->gameRunExe(_WS(regRead)));
|
121 |
cycrow |
170 |
}
|
|
|
171 |
}
|
226 |
cycrow |
172 |
else if (sFirst.Compare(L"Steam"))
|
121 |
cycrow |
173 |
{
|
|
|
174 |
RegistryKey ^steamKey = Registry::CurrentUser->OpenSubKey("Software\\Valve\\Steam");
|
|
|
175 |
if (steamKey)
|
|
|
176 |
{
|
|
|
177 |
System::String ^regRead = System::Convert::ToString(steamKey->GetValue("SteamPath"));
|
|
|
178 |
if (regRead)
|
|
|
179 |
{
|
197 |
cycrow |
180 |
Utils::WString steamDir = _WS(regRead);
|
121 |
cycrow |
181 |
if (!steamDir.empty())
|
|
|
182 |
{
|
222 |
cycrow |
183 |
Utils::WString dir = steamDir + L"\\steamapps\\common\\" + sRest;
|
197 |
cycrow |
184 |
AddFoundDir(_packages->GetGameExe()->gameRunExe(dir.findReplace(L"\\", L"/").findReplace(L"//", L"/")));
|
121 |
cycrow |
185 |
}
|
|
|
186 |
}
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
else
|
|
|
190 |
{
|
197 |
cycrow |
191 |
Utils::WString dir = strNode->str;
|
|
|
192 |
dir = dir.findReplace(L"\\", L"/").findReplace(L"//", L"/");
|
|
|
193 |
dir = dir.findReplace(L"%PROGRAMFILES%", _WS(progfile));
|
|
|
194 |
AddFoundDir(_packages->GetGameExe()->gameRunExe(dir));
|
121 |
cycrow |
195 |
}
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
// now add all addons for already added dirs
|
|
|
199 |
for(int i = _lFoundDirs->size() - 1; i >= 0; --i)
|
|
|
200 |
FindAllAddons(_lFoundDirs->get(i)->str, true);
|
|
|
201 |
for (auto itr = _lRemoveDirs->begin(); itr != _lRemoveDirs->end(); ++itr)
|
|
|
202 |
FindAllAddons((*itr)->str, true);
|
|
|
203 |
for (auto itr = _lDirs->begin(); itr != _lDirs->end(); ++itr)
|
|
|
204 |
FindAllAddons((*itr)->str, true);
|
|
|
205 |
}
|
|
|
206 |
|
|
|
207 |
void DirectoryControl::UpdateGameDirs()
|
|
|
208 |
{
|
|
|
209 |
this->listView1->Items->Clear();
|
196 |
cycrow |
210 |
for (Utils::WStringNode *s_item = _lDirs->first(); s_item; s_item = _lDirs->next()) {
|
197 |
cycrow |
211 |
Utils::WString dir = _packages->GetGameExe()->properDir(s_item->str);
|
121 |
cycrow |
212 |
ListViewItem ^item = gcnew ListViewItem(_US(dir));
|
|
|
213 |
|
197 |
cycrow |
214 |
int iGame = _packages->GetGameExe()->getGameType(s_item->str);
|
121 |
cycrow |
215 |
item->ImageIndex = iGame;
|
|
|
216 |
|
|
|
217 |
item->SubItems->Add(_US(s_item->data));
|
|
|
218 |
if (CFileIO::Exists(s_item->str))
|
|
|
219 |
{
|
224 |
cycrow |
220 |
ListViewItem::ListViewSubItem ^i = _packages->isCurrentDir(dir) ? item->SubItems->Add("Active") : item->SubItems->Add("OK");
|
121 |
cycrow |
221 |
i->ForeColor = Color::Green;
|
224 |
cycrow |
222 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->getGameLanguage(CFileIO(s_item->str).dir()))));
|
121 |
cycrow |
223 |
}
|
|
|
224 |
else
|
|
|
225 |
{
|
|
|
226 |
ListViewItem::ListViewSubItem ^i = item->SubItems->Add("Not Found");
|
|
|
227 |
i->ForeColor = Color::Red;
|
|
|
228 |
item->SubItems->Add("-");
|
|
|
229 |
}
|
|
|
230 |
|
226 |
cycrow |
231 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? L"Yes" : L"No"));
|
121 |
cycrow |
232 |
item->SubItems->Add(_US(s_item->str));
|
|
|
233 |
this->listView1->Items->Add(item);
|
|
|
234 |
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
|
|
|
238 |
this->ColumnStatus->Width = 100;
|
|
|
239 |
this->ColumnDirectory->Width += 50;
|
|
|
240 |
this->ColumnID->Width = 0;
|
|
|
241 |
|
|
|
242 |
this->removeButton->Enabled = (this->listView1->SelectedItems->Count) ? true : false;
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
void DirectoryControl::UpdateFoundDirs()
|
|
|
246 |
{
|
|
|
247 |
this->listView2->Items->Clear();
|
196 |
cycrow |
248 |
for (Utils::WStringNode *s_item = _lRemoveDirs->first(); s_item; s_item = _lRemoveDirs->next()) {
|
121 |
cycrow |
249 |
if (CFileIO::Exists(s_item->str)) {
|
197 |
cycrow |
250 |
ListViewItem ^item = gcnew ListViewItem(_US(_packages->GetGameExe()->properDir(s_item->str)));
|
|
|
251 |
int iGame = _packages->GetGameExe()->getGameType(s_item->str);
|
121 |
cycrow |
252 |
item->ImageIndex = iGame;
|
|
|
253 |
item->SubItems->Add(_US(s_item->data));
|
224 |
cycrow |
254 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->getGameLanguage(CFileIO(s_item->str).dir()))));
|
226 |
cycrow |
255 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? L"Yes" : L"No"));
|
121 |
cycrow |
256 |
item->SubItems->Add(_US(s_item->str));
|
|
|
257 |
this->listView2->Items->Add(item);
|
|
|
258 |
}
|
|
|
259 |
}
|
|
|
260 |
|
196 |
cycrow |
261 |
for (Utils::WStringNode *s_item = _lFoundDirs->first(); s_item; s_item = _lFoundDirs->next()) {
|
121 |
cycrow |
262 |
if (CFileIO::Exists(s_item->str)) {
|
197 |
cycrow |
263 |
ListViewItem ^item = gcnew ListViewItem(_US(_packages->GetGameExe()->properDir(s_item->str)));
|
|
|
264 |
int iGame = _packages->GetGameExe()->getGameType(s_item->str);
|
121 |
cycrow |
265 |
item->ImageIndex = iGame;
|
197 |
cycrow |
266 |
item->SubItems->Add(_US(_packages->GetGameExe()->gameName(s_item->str)));
|
224 |
cycrow |
267 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->getGameLanguage(CFileIO(s_item->str).dir()))));
|
226 |
cycrow |
268 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? L"Yes" : L"No"));
|
121 |
cycrow |
269 |
item->SubItems->Add(_US(s_item->str));
|
|
|
270 |
this->listView2->Items->Add(item);
|
|
|
271 |
}
|
|
|
272 |
}
|
|
|
273 |
|
|
|
274 |
this->listView2->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
|
|
|
275 |
this->ColumnDir2->Width += 50;
|
|
|
276 |
this->ColumnID2->Width = 0;
|
|
|
277 |
|
|
|
278 |
this->ButtonAddFound->Enabled = (this->listView2->SelectedItems->Count) ? true : false;
|
|
|
279 |
}
|
|
|
280 |
|
122 |
cycrow |
281 |
void DirectoryControl::UpdateTexts()
|
|
|
282 |
{
|
|
|
283 |
CLanguages *texts = CLanguages::Instance();
|
|
|
284 |
this->Text = _US(texts->findText(LS_DIRECTORY, LANGDIR_TITLE));
|
|
|
285 |
}
|
|
|
286 |
|
121 |
cycrow |
287 |
System::Void DirectoryControl::button1_Click(System::Object^ sender, System::EventArgs^ e)
|
|
|
288 |
{
|
|
|
289 |
OpenFileDialog ^ofd = gcnew OpenFileDialog();
|
|
|
290 |
ofd->Filter = "X-Universe Executable|";
|
|
|
291 |
String ^games = "";
|
197 |
cycrow |
292 |
for (int i = 0; i < _packages->GetGameExe()->numGames(); i++)
|
121 |
cycrow |
293 |
{
|
197 |
cycrow |
294 |
SGameExe *exe = _packages->GetGameExe()->game(i);
|
121 |
cycrow |
295 |
if (i) ofd->Filter += ";";
|
|
|
296 |
ofd->Filter += _US(exe->sExe);
|
|
|
297 |
games += "|" + _US(exe->sName) + "|" + _US(exe->sExe);
|
|
|
298 |
}
|
|
|
299 |
ofd->Filter += games;
|
|
|
300 |
ofd->FilterIndex = 1;
|
|
|
301 |
ofd->RestoreDirectory = true;
|
|
|
302 |
if (ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK)
|
|
|
303 |
{
|
197 |
cycrow |
304 |
Utils::WString file = _WS(ofd->FileName);
|
|
|
305 |
Utils::WString dir = _WS(IO::FileInfo(ofd->FileName).DirectoryName);
|
121 |
cycrow |
306 |
// check its a valid directory
|
|
|
307 |
if (!dir.empty())
|
|
|
308 |
{
|
197 |
cycrow |
309 |
Utils::WString gameName = _packages->getGameName(file);
|
121 |
cycrow |
310 |
if (gameName.empty())
|
|
|
311 |
MessageBox::Show(this, "No X-Universe game found in folder:\n" + _US(dir), "Add Directory Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
|
|
312 |
else
|
|
|
313 |
{
|
|
|
314 |
// lets check if theres an old folder
|
212 |
cycrow |
315 |
if (_packages->isOldDir(dir))
|
121 |
cycrow |
316 |
{
|
|
|
317 |
if (MessageBox::Show(this, "Game directory: " + _US(dir) + "\nIs currently being controled by the old plugin manager\nIf you continue, you will be unable to use the old version again\nDo you wish to continue?", "Update Game Directory", MessageBoxButtons::YesNo, MessageBoxIcon::Question) != System::Windows::Forms::DialogResult::Yes)
|
|
|
318 |
return;
|
|
|
319 |
}
|
197 |
cycrow |
320 |
Utils::WString properDir = _packages->getProperDir(file);
|
121 |
cycrow |
321 |
_lRemoveDirs->remove(properDir, true);
|
226 |
cycrow |
322 |
_lDirs->pushBack(file.findReplace(L"\\", L"/").findReplace(L"//", L"/"), gameName);
|
121 |
cycrow |
323 |
|
|
|
324 |
// now add any connected dirs
|
|
|
325 |
if (_packages->GetGameExe()->isAddon(file))
|
|
|
326 |
{
|
197 |
cycrow |
327 |
Utils::WString baseExe = _packages->getGameRunExe(_packages->GetGameExe()->gameDir(file));
|
121 |
cycrow |
328 |
if (CFileIO::Exists(baseExe))
|
|
|
329 |
{
|
|
|
330 |
this->AddFoundDir(baseExe);
|
|
|
331 |
this->FindAllAddons(baseExe, false);
|
|
|
332 |
}
|
|
|
333 |
}
|
|
|
334 |
else
|
|
|
335 |
this->FindAllAddons(file, false);
|
|
|
336 |
|
|
|
337 |
UpdateGameDirs();
|
|
|
338 |
UpdateFoundDirs();
|
|
|
339 |
}
|
|
|
340 |
}
|
|
|
341 |
}
|
|
|
342 |
}
|
|
|
343 |
|
|
|
344 |
System::Void DirectoryControl::listView1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
|
|
|
345 |
{
|
|
|
346 |
this->removeButton->Enabled = (this->listView1->SelectedItems->Count) ? true : false;
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
System::Void DirectoryControl::removeButton_Click(System::Object^ sender, System::EventArgs^ e)
|
|
|
350 |
{
|
|
|
351 |
bool anyDone = false;
|
|
|
352 |
for (int i = 0; i < this->listView1->SelectedItems->Count; ++i)
|
|
|
353 |
{
|
|
|
354 |
String ^s = this->listView1->SelectedItems[i]->SubItems[this->listView1->SelectedItems[i]->SubItems->Count - 1]->Text;
|
|
|
355 |
|
197 |
cycrow |
356 |
Utils::WString dir = _packages->getProperDir(_WS(s));
|
224 |
cycrow |
357 |
if (_packages->isCurrentDir(dir))
|
121 |
cycrow |
358 |
{
|
|
|
359 |
if (MessageBox::Show(this, "The game directory: " + _US(dir) + "\nIs currently the active game directory, are you sure you want to remove it?", "Remove Game Directory", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == Windows::Forms::DialogResult::No)
|
|
|
360 |
continue;
|
|
|
361 |
}
|
|
|
362 |
anyDone = true;
|
224 |
cycrow |
363 |
_lRemoveDirs->pushBack(_WS(s), _lDirs->findString(_WS(s)));
|
|
|
364 |
_lDirs->remove(_WS(s), false);
|
121 |
cycrow |
365 |
}
|
|
|
366 |
|
|
|
367 |
if (anyDone)
|
|
|
368 |
{
|
|
|
369 |
UpdateGameDirs();
|
|
|
370 |
UpdateFoundDirs();
|
|
|
371 |
}
|
|
|
372 |
}
|
|
|
373 |
|
|
|
374 |
System::Void DirectoryControl::listView2_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e)
|
|
|
375 |
{
|
|
|
376 |
this->ButtonAddFound->Enabled = (this->listView2->SelectedItems->Count) ? true : false;
|
|
|
377 |
}
|
|
|
378 |
|
|
|
379 |
System::Void DirectoryControl::ButtonAddFound_Click(System::Object^ sender, System::EventArgs^ e)
|
|
|
380 |
{
|
|
|
381 |
for (int i = 0; i < this->listView2->SelectedItems->Count; ++i)
|
|
|
382 |
{
|
|
|
383 |
String ^s = this->listView2->SelectedItems[i]->SubItems[this->listView2->SelectedItems[i]->SubItems->Count - 1]->Text;
|
197 |
cycrow |
384 |
_lDirs->pushBack(_WS(s), _packages->GetGameExe()->gameName(_WS(s)));
|
|
|
385 |
_lFoundDirs->remove(_WS(s), false);
|
|
|
386 |
_lRemoveDirs->remove(_WS(s), false);
|
121 |
cycrow |
387 |
}
|
|
|
388 |
|
|
|
389 |
UpdateGameDirs();
|
|
|
390 |
UpdateFoundDirs();
|
|
|
391 |
}
|
|
|
392 |
|
|
|
393 |
System::Void DirectoryControl::listView1_DoubleClick(System::Object^ sender, System::EventArgs^ e)
|
|
|
394 |
{
|
|
|
395 |
String ^s = this->listView1->SelectedItems[0]->SubItems[this->listView1->SelectedItems[0]->SubItems->Count - 1]->Text;
|
|
|
396 |
if (s && s->Length > 0)
|
|
|
397 |
{
|
|
|
398 |
}
|
|
|
399 |
}
|
|
|
400 |
|
|
|
401 |
System::Void DirectoryControl::listView2_DoubleClick(System::Object^ sender, System::EventArgs^ e)
|
|
|
402 |
{
|
|
|
403 |
String ^s = this->listView2->SelectedItems[0]->SubItems[this->listView2->SelectedItems[0]->SubItems->Count - 1]->Text;
|
|
|
404 |
if (s && s->Length > 0)
|
|
|
405 |
{
|
224 |
cycrow |
406 |
_lDirs->pushBack(_WS(s), _packages->GetGameExe()->gameName(_WS(s)));
|
197 |
cycrow |
407 |
_lFoundDirs->remove(_WS(s), false);
|
|
|
408 |
_lRemoveDirs->remove(_WS(s), false);
|
121 |
cycrow |
409 |
|
|
|
410 |
UpdateGameDirs();
|
|
|
411 |
UpdateFoundDirs();
|
|
|
412 |
}
|
|
|
413 |
}
|
|
|
414 |
|
196 |
cycrow |
415 |
Utils::WStringList *DirectoryControl::directories()
|
121 |
cycrow |
416 |
{
|
|
|
417 |
return _lDirs;
|
|
|
418 |
}
|
196 |
cycrow |
419 |
Utils::WStringList *DirectoryControl::removeDirectories()
|
121 |
cycrow |
420 |
{
|
|
|
421 |
return _lRemoveDirs;
|
|
|
422 |
}
|
|
|
423 |
|