Line 473... |
Line 473... |
473 |
else if ( p->IsAnyGameInPackage() ) {
|
473 |
else if ( p->IsAnyGameInPackage() ) {
|
474 |
game = p->FindFirstGameInPackage();
|
474 |
game = p->FindFirstGameInPackage();
|
475 |
}
|
475 |
}
|
476 |
|
476 |
|
477 |
if ( to && to->Length ) {
|
477 |
if ( to && to->Length ) {
|
478 |
Utils::String exportFilename = CFileIO(sFile).changeFileExtension("zip");
|
478 |
Utils::WString exportFilename = CFileIO(sFile).changeFileExtension(L"zip");
|
479 |
if ( game ) {
|
479 |
if ( game ) {
|
480 |
exportFilename = CFileIO(exportFilename).dir() + "/" + CFileIO(exportFilename).baseName() + "_" + CBaseFile::ConvertGameToString(game) + ".zip";
|
480 |
exportFilename = CFileIO(exportFilename).dir() + L"/" + CFileIO(exportFilename).baseName() + L"_" + CBaseFile::ConvertGameToString(game).toWString() + L".zip";
|
481 |
}
|
481 |
}
|
482 |
if ( p->saveToArchive(exportFilename, game, m_pPackages->GetGameExe()) ) {
|
482 |
if ( p->saveToArchive(exportFilename.toString(), 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()->GetGame(game - 1)->sName);
|
485 |
message += "\nGame: " + _US(m_pPackages->GetGameExe()->GetGame(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 544... |
Line 544... |
544 |
}
|
544 |
}
|
545 |
}
|
545 |
}
|
546 |
|
546 |
|
547 |
void SavePackagerScript(String ^file)
|
547 |
void SavePackagerScript(String ^file)
|
548 |
{
|
548 |
{
|
549 |
Utils::String sFile = _S(file);
|
549 |
Utils::WString sFile = _WS(file);
|
550 |
Utils::CStringList malformed, unknown;
|
550 |
Utils::CStringList malformed, unknown;
|
551 |
CBaseFile *package = m_pPackages->LoadPackagerScript(sFile, -1, NULL, &malformed, &unknown);
|
551 |
CBaseFile *package = m_pPackages->LoadPackagerScript(sFile.toString(), -1, NULL, &malformed, &unknown);
|
552 |
if ( package )
|
552 |
if ( package )
|
553 |
{
|
553 |
{
|
554 |
Utils::String saveto = package->filename();
|
554 |
Utils::WString saveto = package->filename();
|
555 |
saveto = saveto.findReplace("$DEFAULTDIR", CFileIO(sFile).dir() + "/");
|
555 |
saveto = saveto.findReplace(L"$DEFAULTDIR", CFileIO(sFile).dir() + L"/");
|
556 |
saveto = saveto.findReplace("$PATH", CFileIO(sFile).dir());
|
556 |
saveto = saveto.findReplace(L"$PATH", CFileIO(sFile).dir());
|
557 |
saveto = saveto.asFilename();
|
557 |
saveto = saveto.asFilename();
|
558 |
|
558 |
|
559 |
if ( !saveto.right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
|
559 |
if ( !saveto.right(4).Compare(L".spk") && package->GetType() != TYPE_XSP )
|
560 |
saveto += ".spk";
|
560 |
saveto += L".spk";
|
561 |
else if ( !saveto.right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
|
561 |
else if ( !saveto.right(4).Compare(L".xsp") && package->GetType() == TYPE_XSP )
|
562 |
saveto += ".xsp";
|
562 |
saveto += L".xsp";
|
563 |
// write script
|
563 |
// write script
|
564 |
if ( package->writeFile(saveto) ) {
|
564 |
if ( package->writeFile(saveto.toString()) ) {
|
565 |
String ^message = "Package: " + _US(saveto) + " has been created\n";
|
565 |
String ^message = "Package: " + _US(saveto) + " has been created\n";
|
566 |
if ( package->AutoGenerateUpdateFile() )
|
566 |
if ( package->AutoGenerateUpdateFile() )
|
567 |
package->createUpdateFile(CFileIO(saveto).dir());
|
567 |
package->createUpdateFile(CFileIO(saveto).dir());
|
568 |
Utils::String exportto = package->exportFilename();
|
568 |
Utils::WString exportto = package->exportFilename();
|
569 |
if ( !exportto.empty() ) {
|
569 |
if ( !exportto.empty() ) {
|
570 |
exportto = exportto.findReplace("$DEFAULTDIR", CFileIO(sFile).dir() + "/");
|
570 |
exportto = exportto.findReplace(L"$DEFAULTDIR", CFileIO(sFile).dir() + L"/");
|
571 |
exportto = exportto.findReplace("$PATH", CFileIO(sFile).dir());
|
571 |
exportto = exportto.findReplace(L"$PATH", CFileIO(sFile).dir());
|
572 |
exportto = exportto.asFilename();
|
572 |
exportto = exportto.asFilename();
|
573 |
if ( package->saveToArchive(exportto, 0, m_pPackages->GetGameExe()) ) {
|
573 |
if ( package->saveToArchive(exportto.toString(), 0, m_pPackages->GetGameExe())) {
|
574 |
message += "\nExported to:\n" + _US(exportto) + "\n";
|
574 |
message += "\nExported to:\n" + _US(exportto) + "\n";
|
575 |
if ( package->IsAnyGameInPackage() ) {
|
575 |
if ( package->IsAnyGameInPackage() ) {
|
576 |
for ( int i = 0; i < m_pPackages->GetGameExe()->GetNumGames(); i++ ) {
|
576 |
for ( int i = 0; i < m_pPackages->GetGameExe()->GetNumGames(); i++ ) {
|
577 |
if ( package->IsGameInPackage(i + 1) ) {
|
577 |
if ( package->IsGameInPackage(i + 1) ) {
|
578 |
Utils::String exportFile = CFileIO(saveto).dir() + "/" + CFileIO(saveto).baseName() + "_" + CBaseFile::ConvertGameToString(i + 1) + "." + CFileIO(exportto).extension();
|
578 |
Utils::WString exportFile = CFileIO(saveto).dir() + L"/" + CFileIO(saveto).baseName() + L"_" + CBaseFile::ConvertGameToString(i + 1).toWString() + L"." + CFileIO(exportto).extension();
|
579 |
if ( package->saveToArchive(exportFile, i + 1, m_pPackages->GetGameExe()) ) {
|
579 |
if ( package->saveToArchive(exportFile.toString(), i + 1, m_pPackages->GetGameExe())) {
|
580 |
message += _US(CFileIO(exportFile).filename()) + "\n";
|
580 |
message += _US(CFileIO(exportFile).filename()) + "\n";
|
581 |
}
|
581 |
}
|
582 |
}
|
582 |
}
|
583 |
}
|
583 |
}
|
584 |
}
|
584 |
}
|
Line 645... |
Line 645... |
645 |
if ( this->imageList1->Images->IndexOfKey(file) == -1 )
|
645 |
if ( this->imageList1->Images->IndexOfKey(file) == -1 )
|
646 |
{
|
646 |
{
|
647 |
if ( package->icon() )
|
647 |
if ( package->icon() )
|
648 |
{
|
648 |
{
|
649 |
package->ReadIconFileToMemory();
|
649 |
package->ReadIconFileToMemory();
|
650 |
Utils::String sIconFile = _S(IO::Path::GetTempPath()) + "\\" + CFileIO(sFile).baseName() + "." + package->iconExt();
|
650 |
Utils::WString sIconFile = _WS(IO::Path::GetTempPath()) + L"\\" + CFileIO(sFile).baseName() + L"." + package->iconExt().toWString();
|
651 |
if ( package->extractFile(package->icon(), CFileIO(sIconFile).fullFilename(), false) )
|
651 |
if ( package->extractFile(package->icon(), CFileIO(sIconFile).fullFilename().toString(), false))
|
652 |
{
|
652 |
{
|
653 |
String ^iconFile = _US(sIconFile);
|
653 |
String ^iconFile = _US(sIconFile);
|
654 |
if ( IO::File::Exists(iconFile) )
|
654 |
if ( IO::File::Exists(iconFile) )
|
655 |
{
|
655 |
{
|
656 |
String ^ext = System::IO::FileInfo(iconFile).Extension;
|
656 |
String ^ext = System::IO::FileInfo(iconFile).Extension;
|
Line 722... |
Line 722... |
722 |
int error = 0;
|
722 |
int error = 0;
|
723 |
CBaseFile *p = m_pPackages->openPackage(file, &error, 0, SPKREAD_NODATA);
|
723 |
CBaseFile *p = m_pPackages->openPackage(file, &error, 0, SPKREAD_NODATA);
|
724 |
if ( !p )
|
724 |
if ( !p )
|
725 |
continue;
|
725 |
continue;
|
726 |
|
726 |
|
727 |
Utils::String ufile = p->createUpdateFile(_S(fbd->SelectedPath));
|
727 |
Utils::WString ufile = p->createUpdateFile(_WS(fbd->SelectedPath));
|
728 |
if ( !ufile.empty() )
|
728 |
if ( !ufile.empty() )
|
729 |
++count;
|
729 |
++count;
|
730 |
delete p;
|
730 |
delete p;
|
731 |
}
|
731 |
}
|
732 |
}
|
732 |
}
|