| Line 55... |
Line 55... |
| 55 |
{
|
55 |
{
|
| 56 |
CDirIO Dir(exe);
|
56 |
CDirIO Dir(exe);
|
| 57 |
|
57 |
|
| 58 |
if (checkBase && _packages->GetGameExe()->isAddon(exe))
|
58 |
if (checkBase && _packages->GetGameExe()->isAddon(exe))
|
| 59 |
{
|
59 |
{
|
| 60 |
Utils::String base = _packages->GetGameRunExe(_packages->GetGameExe()->GetGameDir(exe));
|
60 |
Utils::String base = _packages->getGameRunExe(_packages->GetGameExe()->GetGameDir(exe));
|
| 61 |
if (CFileIO::Exists(base))
|
61 |
if (CFileIO::Exists(base))
|
| 62 |
{
|
62 |
{
|
| 63 |
AddFoundDir(base);
|
63 |
AddFoundDir(base);
|
| 64 |
FindAllAddons(base, false);
|
64 |
FindAllAddons(base, false);
|
| 65 |
return;
|
65 |
return;
|
| Line 75... |
Line 75... |
| 75 |
if (!_packages->GetGameExe()->isAddon(exe))
|
75 |
if (!_packages->GetGameExe()->isAddon(exe))
|
| 76 |
{
|
76 |
{
|
| 77 |
CDirIO dir(file.dir());
|
77 |
CDirIO dir(file.dir());
|
| 78 |
Utils::CStringList list;
|
78 |
Utils::CStringList list;
|
| 79 |
// get all the addons from a base game
|
79 |
// get all the addons from a base game
|
| 80 |
if (_packages->GetGameAddons(list, _packages->GetGameExe()->GetProperDir(exe)))
|
80 |
if (_packages->getGameAddons(list, _packages->GetGameExe()->GetProperDir(exe)))
|
| 81 |
{
|
81 |
{
|
| 82 |
for (Utils::SStringList *a_item = list.first(); a_item; a_item = list.next())
|
82 |
for (Utils::SStringList *a_item = list.first(); a_item; a_item = list.next())
|
| 83 |
{
|
83 |
{
|
| 84 |
//check both the exe and the data directory exists
|
84 |
//check both the exe and the data directory exists
|
| 85 |
if (dir.exists(a_item->data) && dir.exists(a_item->str))
|
85 |
if (dir.exists(a_item->data) && dir.exists(a_item->str))
|
| Line 94... |
Line 94... |
| 94 |
}
|
94 |
}
|
| 95 |
else if (Dir.exists())
|
95 |
else if (Dir.exists())
|
| 96 |
{
|
96 |
{
|
| 97 |
Utils::CStringList list;
|
97 |
Utils::CStringList list;
|
| 98 |
// get all the addons from a base game
|
98 |
// get all the addons from a base game
|
| 99 |
if (_packages->GetGameAddons(list, _packages->GetGameExe()->GetProperDir(exe)))
|
99 |
if (_packages->getGameAddons(list, _packages->GetGameExe()->GetProperDir(exe)))
|
| 100 |
{
|
100 |
{
|
| 101 |
for (Utils::SStringList *a_item = list.first(); a_item; a_item = list.next())
|
101 |
for (Utils::SStringList *a_item = list.first(); a_item; a_item = list.next())
|
| 102 |
{
|
102 |
{
|
| 103 |
//check both the exe and the data directory exists
|
103 |
//check both the exe and the data directory exists
|
| 104 |
if (Dir.exists(a_item->data) && Dir.exists(a_item->str))
|
104 |
if (Dir.exists(a_item->data) && Dir.exists(a_item->str))
|
| Line 117... |
Line 117... |
| 117 |
{
|
117 |
{
|
| 118 |
for (auto itr = currentDirs->begin(); itr != currentDirs->end(); itr++)
|
118 |
for (auto itr = currentDirs->begin(); itr != currentDirs->end(); itr++)
|
| 119 |
{
|
119 |
{
|
| 120 |
Utils::String data = (*itr)->data;
|
120 |
Utils::String data = (*itr)->data;
|
| 121 |
if(data.isin("|"))
|
121 |
if(data.isin("|"))
|
| 122 |
_lDirs->pushBack(_packages->GetGameRunExe((*itr)->str), data.tokens("|", 2));
|
122 |
_lDirs->pushBack(_packages->getGameRunExe((*itr)->str), data.tokens("|", 2));
|
| 123 |
else
|
123 |
else
|
| 124 |
_lDirs->pushBack(_packages->GetGameRunExe((*itr)->str), data);
|
124 |
_lDirs->pushBack(_packages->getGameRunExe((*itr)->str), data);
|
| 125 |
}
|
125 |
}
|
| 126 |
}
|
126 |
}
|
| 127 |
if (removedDirs)
|
127 |
if (removedDirs)
|
| 128 |
{
|
128 |
{
|
| 129 |
for (auto itr = removedDirs->begin(); itr != removedDirs->end(); itr++)
|
129 |
for (auto itr = removedDirs->begin(); itr != removedDirs->end(); itr++)
|
| 130 |
_lRemoveDirs->pushBack(_packages->GetGameRunExe((*itr)->str), (*itr)->data);
|
130 |
_lRemoveDirs->pushBack(_packages->getGameRunExe((*itr)->str), (*itr)->data);
|
| 131 |
}
|
131 |
}
|
| 132 |
|
132 |
|
| 133 |
// find other dirs
|
133 |
// find other dirs
|
| 134 |
System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles);
|
134 |
System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles);
|
| 135 |
Utils::CStringList gameDirs;
|
135 |
Utils::CStringList gameDirs;
|
| Line 217... |
Line 217... |
| 217 |
item->SubItems->Add(_US(s_item->data));
|
217 |
item->SubItems->Add(_US(s_item->data));
|
| 218 |
if (CFileIO::Exists(s_item->str))
|
218 |
if (CFileIO::Exists(s_item->str))
|
| 219 |
{
|
219 |
{
|
| 220 |
ListViewItem::ListViewSubItem ^i = _packages->isCurrentDir(dir) ? item->SubItems->Add("Active") : item->SubItems->Add("OK");
|
220 |
ListViewItem::ListViewSubItem ^i = _packages->isCurrentDir(dir) ? item->SubItems->Add("Active") : item->SubItems->Add("OK");
|
| 221 |
i->ForeColor = Color::Green;
|
221 |
i->ForeColor = Color::Green;
|
| 222 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->GetGameLanguage(CFileIO(s_item->str).dir()))));
|
222 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->getGameLanguage(CFileIO(s_item->str).dir()))));
|
| 223 |
}
|
223 |
}
|
| 224 |
else
|
224 |
else
|
| 225 |
{
|
225 |
{
|
| 226 |
ListViewItem::ListViewSubItem ^i = item->SubItems->Add("Not Found");
|
226 |
ListViewItem::ListViewSubItem ^i = item->SubItems->Add("Not Found");
|
| 227 |
i->ForeColor = Color::Red;
|
227 |
i->ForeColor = Color::Red;
|
| Line 249... |
Line 249... |
| 249 |
if (CFileIO::Exists(s_item->str)) {
|
249 |
if (CFileIO::Exists(s_item->str)) {
|
| 250 |
ListViewItem ^item = gcnew ListViewItem(_US(_packages->GetGameExe()->GetProperDir(s_item->str)));
|
250 |
ListViewItem ^item = gcnew ListViewItem(_US(_packages->GetGameExe()->GetProperDir(s_item->str)));
|
| 251 |
int iGame = _packages->GetGameExe()->GetGameType(s_item->str);
|
251 |
int iGame = _packages->GetGameExe()->GetGameType(s_item->str);
|
| 252 |
item->ImageIndex = iGame;
|
252 |
item->ImageIndex = iGame;
|
| 253 |
item->SubItems->Add(_US(s_item->data));
|
253 |
item->SubItems->Add(_US(s_item->data));
|
| 254 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->GetGameLanguage(CFileIO(s_item->str).dir()))));
|
254 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->getGameLanguage(CFileIO(s_item->str).dir()))));
|
| 255 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? "Yes" : "No"));
|
255 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? "Yes" : "No"));
|
| 256 |
item->SubItems->Add(_US(s_item->str));
|
256 |
item->SubItems->Add(_US(s_item->str));
|
| 257 |
this->listView2->Items->Add(item);
|
257 |
this->listView2->Items->Add(item);
|
| 258 |
}
|
258 |
}
|
| 259 |
}
|
259 |
}
|
| Line 262... |
Line 262... |
| 262 |
if (CFileIO::Exists(s_item->str)) {
|
262 |
if (CFileIO::Exists(s_item->str)) {
|
| 263 |
ListViewItem ^item = gcnew ListViewItem(_US(_packages->GetGameExe()->GetProperDir(s_item->str)));
|
263 |
ListViewItem ^item = gcnew ListViewItem(_US(_packages->GetGameExe()->GetProperDir(s_item->str)));
|
| 264 |
int iGame = _packages->GetGameExe()->GetGameType(s_item->str);
|
264 |
int iGame = _packages->GetGameExe()->GetGameType(s_item->str);
|
| 265 |
item->ImageIndex = iGame;
|
265 |
item->ImageIndex = iGame;
|
| 266 |
item->SubItems->Add(_US(_packages->GetGameExe()->GetGameName(s_item->str)));
|
266 |
item->SubItems->Add(_US(_packages->GetGameExe()->GetGameName(s_item->str)));
|
| 267 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->GetGameLanguage(CFileIO(s_item->str).dir()))));
|
267 |
item->SubItems->Add(_US(_packages->ConvertLanguage(_packages->getGameLanguage(CFileIO(s_item->str).dir()))));
|
| 268 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? "Yes" : "No"));
|
268 |
item->SubItems->Add(_US(_packages->GetGameExe()->isAddon(s_item->str) ? "Yes" : "No"));
|
| 269 |
item->SubItems->Add(_US(s_item->str));
|
269 |
item->SubItems->Add(_US(s_item->str));
|
| 270 |
this->listView2->Items->Add(item);
|
270 |
this->listView2->Items->Add(item);
|
| 271 |
}
|
271 |
}
|
| 272 |
}
|
272 |
}
|
| Line 304... |
Line 304... |
| 304 |
Utils::String file = _S(ofd->FileName);
|
304 |
Utils::String file = _S(ofd->FileName);
|
| 305 |
Utils::String dir = _S(IO::FileInfo(ofd->FileName).DirectoryName);
|
305 |
Utils::String dir = _S(IO::FileInfo(ofd->FileName).DirectoryName);
|
| 306 |
// check its a valid directory
|
306 |
// check its a valid directory
|
| 307 |
if (!dir.empty())
|
307 |
if (!dir.empty())
|
| 308 |
{
|
308 |
{
|
| 309 |
Utils::String gameName = _packages->GetGameName(file).ToString();
|
309 |
Utils::String gameName = _packages->getGameName(file);
|
| 310 |
if (gameName.empty())
|
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);
|
311 |
MessageBox::Show(this, "No X-Universe game found in folder:\n" + _US(dir), "Add Directory Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
| 312 |
else
|
312 |
else
|
| 313 |
{
|
313 |
{
|
| 314 |
// lets check if theres an old folder
|
314 |
// lets check if theres an old folder
|
| 315 |
if (_packages->isOldDir(dir))
|
315 |
if (_packages->isOldDir(dir))
|
| 316 |
{
|
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)
|
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;
|
318 |
return;
|
| 319 |
}
|
319 |
}
|
| 320 |
Utils::String properDir = _packages->GetProperDir(file).ToString();
|
320 |
Utils::String properDir = _packages->getProperDir(file);
|
| 321 |
_lRemoveDirs->remove(properDir, true);
|
321 |
_lRemoveDirs->remove(properDir, true);
|
| 322 |
_lDirs->pushBack(file.findReplace("\\", "/").findReplace("//", "/"), gameName);
|
322 |
_lDirs->pushBack(file.findReplace("\\", "/").findReplace("//", "/"), gameName);
|
| 323 |
|
323 |
|
| 324 |
// now add any connected dirs
|
324 |
// now add any connected dirs
|
| 325 |
if (_packages->GetGameExe()->isAddon(file))
|
325 |
if (_packages->GetGameExe()->isAddon(file))
|
| 326 |
{
|
326 |
{
|
| 327 |
Utils::String baseExe = _packages->GetGameRunExe(_packages->GetGameExe()->GetGameDir(file));
|
327 |
Utils::String baseExe = _packages->getGameRunExe(_packages->GetGameExe()->GetGameDir(file));
|
| 328 |
if (CFileIO::Exists(baseExe))
|
328 |
if (CFileIO::Exists(baseExe))
|
| 329 |
{
|
329 |
{
|
| 330 |
this->AddFoundDir(baseExe);
|
330 |
this->AddFoundDir(baseExe);
|
| 331 |
this->FindAllAddons(baseExe, false);
|
331 |
this->FindAllAddons(baseExe, false);
|
| 332 |
}
|
332 |
}
|