| Line 453... |
Line 453... |
| 453 |
void ExportPackage(String ^file)
|
453 |
void ExportPackage(String ^file)
|
| 454 |
{
|
454 |
{
|
| 455 |
Utils::WString sFile = _WS(file);
|
455 |
Utils::WString sFile = _WS(file);
|
| 456 |
int error = 0;
|
456 |
int error = 0;
|
| 457 |
|
457 |
|
| 458 |
CBaseFile *p = m_pPackages->openPackage(sFile.toString(), &error, 0, SPKREAD_NODATA);
|
458 |
CBaseFile *p = m_pPackages->openPackage(sFile, &error, 0, SPKREAD_NODATA);
|
| 459 |
if ( !p ) {
|
459 |
if ( !p ) {
|
| 460 |
MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
460 |
MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
| 461 |
}
|
461 |
}
|
| 462 |
else {
|
462 |
else {
|
| 463 |
String ^to = IO::FileInfo(file).DirectoryName;
|
463 |
String ^to = IO::FileInfo(file).DirectoryName;
|
| Line 477... |
Line 477... |
| 477 |
if ( to && to->Length ) {
|
477 |
if ( to && to->Length ) {
|
| 478 |
Utils::WString exportFilename = CFileIO(sFile).changeFileExtension(L"zip");
|
478 |
Utils::WString exportFilename = CFileIO(sFile).changeFileExtension(L"zip");
|
| 479 |
if ( game ) {
|
479 |
if ( game ) {
|
| 480 |
exportFilename = CFileIO(exportFilename).dir() + L"/" + CFileIO(exportFilename).baseName() + L"_" + CBaseFile::ConvertGameToString(game) + L".zip";
|
480 |
exportFilename = CFileIO(exportFilename).dir() + L"/" + CFileIO(exportFilename).baseName() + L"_" + CBaseFile::ConvertGameToString(game) + L".zip";
|
| 481 |
}
|
481 |
}
|
| 482 |
if ( p->saveToArchive(exportFilename.toString(), game, m_pPackages->GetGameExe())) {
|
482 |
if ( p->saveToArchive(exportFilename, game, m_pPackages->GetGameExe())) {
|
| 483 |
String ^message = "Export: " + file + "\nTo: " + _US(CFileIO(exportFilename).filename());
|
483 |
String ^message = "Export: " + file + "\nTo: " + _US(CFileIO(exportFilename).filename());
|
| 484 |
if ( game ) {
|
484 |
if ( game ) {
|
| 485 |
message += "\nGame: " + _US(m_pPackages->GetGameExe()->game(game - 1)->sName);
|
485 |
message += "\nGame: " + _US(m_pPackages->GetGameExe()->game(game - 1)->sName);
|
| 486 |
}
|
486 |
}
|
| 487 |
MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
|
487 |
MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
|
| Line 495... |
Line 495... |
| 495 |
void ExtractPackage(String ^file, bool here)
|
495 |
void ExtractPackage(String ^file, bool here)
|
| 496 |
{
|
496 |
{
|
| 497 |
Utils::WString sFile = _WS(file);
|
497 |
Utils::WString sFile = _WS(file);
|
| 498 |
int error = 0;
|
498 |
int error = 0;
|
| 499 |
|
499 |
|
| 500 |
CBaseFile *p = m_pPackages->openPackage(sFile.toString(), &error, 0, SPKREAD_NODATA);
|
500 |
CBaseFile *p = m_pPackages->openPackage(sFile, &error, 0, SPKREAD_NODATA);
|
| 501 |
if ( !p ) {
|
501 |
if ( !p ) {
|
| 502 |
MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
502 |
MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
|
| 503 |
}
|
503 |
}
|
| 504 |
else {
|
504 |
else {
|
| 505 |
String ^to = nullptr;
|
505 |
String ^to = nullptr;
|
| Line 1166... |
Line 1166... |
| 1166 |
|
1166 |
|
| 1167 |
void LoadData()
|
1167 |
void LoadData()
|
| 1168 |
{
|
1168 |
{
|
| 1169 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
1169 |
System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
|
| 1170 |
CFileIO Config;
|
1170 |
CFileIO Config;
|
| 1171 |
if ( Config.open(_S(mydoc) + "/Egosoft/creator.dat") )
|
1171 |
if ( Config.open(_WS(mydoc) + L"/Egosoft/creator.dat") )
|
| 1172 |
{
|
1172 |
{
|
| 1173 |
std::vector<Utils::String> *lines = Config.readLines();
|
1173 |
std::vector<Utils::WString> lines;
|
| 1174 |
if ( lines )
|
1174 |
if(Config.readLines(lines))
|
| 1175 |
{
|
1175 |
{
|
| 1176 |
for ( int i = 0; i < (int)lines->size(); i++ )
|
1176 |
for (size_t i = 0; i < (int)lines.size(); i++ )
|
| 1177 |
{
|
1177 |
{
|
| 1178 |
Utils::String line(lines->at(i));
|
1178 |
Utils::WString line(lines.at(i));
|
| 1179 |
Utils::String start = line.token(":", 1).toLower();
|
1179 |
Utils::WString start = line.token(L":", 1).toLower();
|
| 1180 |
Utils::String rest = line.tokens(":", 2).removeFirstSpace();
|
1180 |
Utils::WString rest = line.tokens(L":", 2).removeFirstSpace();
|
| 1181 |
if ( start.Compare("CreatorSize") )
|
1181 |
if ( start.Compare(L"CreatorSize") )
|
| 1182 |
this->Size = System::Drawing::Size(rest.token(" ", 1).toInt(), rest.token(" ", 2).toInt());
|
1182 |
this->Size = System::Drawing::Size(rest.token(L" ", 1).toInt(), rest.token(L" ", 2).toInt());
|
| 1183 |
else if ( start.Compare("CreatorPos") )
|
1183 |
else if ( start.Compare(L"CreatorPos") )
|
| 1184 |
{
|
1184 |
{
|
| 1185 |
m_iLocX = rest.token(" ", 1).toInt();
|
1185 |
m_iLocX = rest.token(L" ", 1).toInt();
|
| 1186 |
m_iLocY = rest.token(" ", 2).toInt();
|
1186 |
m_iLocY = rest.token(L" ", 2).toInt();
|
| 1187 |
}
|
1187 |
}
|
| 1188 |
else if ( start.Compare("Loaded") )
|
1188 |
else if ( start.Compare(L"Loaded") )
|
| 1189 |
m_pLoadedList->pushBack(rest);
|
1189 |
m_pLoadedList->pushBack(rest);
|
| 1190 |
else if ( start.Compare("CreatorMax") )
|
1190 |
else if ( start.Compare(L"CreatorMax") )
|
| 1191 |
this->WindowState = FormWindowState::Maximized;
|
1191 |
this->WindowState = FormWindowState::Maximized;
|
| 1192 |
else if ( start.Compare("GenerateUpdate") )
|
1192 |
else if ( start.Compare(L"GenerateUpdate") )
|
| 1193 |
m_settings->bGenerateUpdate = true;
|
1193 |
m_settings->bGenerateUpdate = true;
|
| 1194 |
else if ( start.Compare("GameDir") )
|
1194 |
else if ( start.Compare(L"GameDir") )
|
| 1195 |
_pGameDir->parse(rest, m_pPackages);
|
1195 |
_pGameDir->parse(rest, m_pPackages);
|
| 1196 |
}
|
1196 |
}
|
| 1197 |
|
- |
|
| 1198 |
delete lines;
|
- |
|
| 1199 |
}
|
1197 |
}
|
| 1200 |
}
|
1198 |
}
|
| 1201 |
}
|
1199 |
}
|
| 1202 |
|
1200 |
|
| 1203 |
void LoadText(bool center, bool reload, CVirtualFileSystem *vfs)
|
1201 |
void LoadText(bool center, bool reload, CVirtualFileSystem *vfs)
|