| Line 477... |
Line 477... |
| 477 |
if ( to && to->Length ) {
|
477 |
if ( to && to->Length ) {
|
| 478 |
Utils::String exportFilename = CFileIO(sFile).changeFileExtension("zip");
|
478 |
Utils::String exportFilename = CFileIO(sFile).changeFileExtension("zip");
|
| 479 |
if ( game ) {
|
479 |
if ( game ) {
|
| 480 |
exportFilename = CFileIO(exportFilename).dir() + "/" + CFileIO(exportFilename).baseName() + "_" + CBaseFile::ConvertGameToString(game) + ".zip";
|
480 |
exportFilename = CFileIO(exportFilename).dir() + "/" + CFileIO(exportFilename).baseName() + "_" + CBaseFile::ConvertGameToString(game) + ".zip";
|
| 481 |
}
|
481 |
}
|
| 482 |
if ( p->SaveToArchive(exportFilename, 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: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(game - 1)->sName);
|
485 |
message += "\nGame: " + SystemStringFromCyString(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 559... |
Line 559... |
| 559 |
if ( !saveto.right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
|
559 |
if ( !saveto.right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
|
| 560 |
saveto += ".spk";
|
560 |
saveto += ".spk";
|
| 561 |
else if ( !saveto.right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
|
561 |
else if ( !saveto.right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
|
| 562 |
saveto += ".xsp";
|
562 |
saveto += ".xsp";
|
| 563 |
// write script
|
563 |
// write script
|
| 564 |
if ( package->WriteFile(saveto) ) {
|
564 |
if ( package->writeFile(saveto) ) {
|
| 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::String exportto = package->exportFilename();
|
| 569 |
if ( !exportto.empty() ) {
|
569 |
if ( !exportto.empty() ) {
|
| 570 |
exportto = exportto.findReplace("$DEFAULTDIR", CFileIO(sFile).dir() + "/");
|
570 |
exportto = exportto.findReplace("$DEFAULTDIR", CFileIO(sFile).dir() + "/");
|
| 571 |
exportto = exportto.findReplace("$PATH", CFileIO(sFile).dir());
|
571 |
exportto = exportto.findReplace("$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, 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::String exportFile = CFileIO(saveto).dir() + "/" + CFileIO(saveto).baseName() + "_" + CBaseFile::ConvertGameToString(i + 1) + "." + CFileIO(exportto).extension();
|
| 579 |
if ( package->SaveToArchive(exportFile, i + 1, m_pPackages->GetGameExe()) ) {
|
579 |
if ( package->saveToArchive(exportFile, 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 646... |
Line 646... |
| 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::String sIconFile = _S(IO::Path::GetTempPath()) + "\\" + CFileIO(sFile).baseName() + "." + package->iconExt();
|
| 651 |
if ( package->ExtractFile(package->icon(), CFileIO(sIconFile).fullFilename(), false) )
|
651 |
if ( package->extractFile(package->icon(), CFileIO(sIconFile).fullFilename(), 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 811... |
Line 811... |
| 811 |
OpenPackagerScript(file);
|
811 |
OpenPackagerScript(file);
|
| 812 |
return;
|
812 |
return;
|
| 813 |
}
|
813 |
}
|
| 814 |
|
814 |
|
| 815 |
float fVersion;
|
815 |
float fVersion;
|
| 816 |
CyString sFile = CyStringFromSystemString(file);
|
816 |
Utils::String sFile = _S(file);
|
| 817 |
int fileType = CSpkFile::CheckFile(sFile, &fVersion);
|
817 |
int fileType = CSpkFile::CheckFile(sFile, &fVersion);
|
| 818 |
|
818 |
|
| 819 |
if ( fVersion > (float)FILEVERSION )
|
819 |
if ( fVersion > (float)FILEVERSION )
|
| 820 |
{
|
820 |
{
|
| 821 |
if ( display )
|
821 |
if ( display )
|
| Line 888... |
Line 888... |
| 888 |
}
|
888 |
}
|
| 889 |
|
889 |
|
| 890 |
if ( loaded )
|
890 |
if ( loaded )
|
| 891 |
{
|
891 |
{
|
| 892 |
// adjust the loaded list
|
892 |
// adjust the loaded list
|
| 893 |
sFile.FindReplace("/", "\\");
|
893 |
sFile = sFile.findReplace("/", "\\").remove(9).remove('\r').remove('\n');
|
| 894 |
sFile.RemoveChar(9);
|
- |
|
| 895 |
sFile.RemoveChar('\r');
|
- |
|
| 896 |
sFile.RemoveChar('\n');
|
- |
|
| 897 |
m_pLoadedList->Remove(sFile, true);
|
894 |
m_pLoadedList->Remove(sFile, true);
|
| 898 |
m_pLoadedList->PushFront(sFile);
|
895 |
m_pLoadedList->PushFront(CyString(sFile));
|
| 899 |
|
896 |
|
| 900 |
while ( m_pLoadedList->Count() > 15 )
|
897 |
while ( m_pLoadedList->Count() > 15 )
|
| 901 |
m_pLoadedList->PopBack();
|
898 |
m_pLoadedList->PopBack();
|
| 902 |
|
899 |
|
| 903 |
this->SaveData();
|
900 |
this->SaveData();
|
| Line 1033... |
Line 1030... |
| 1033 |
}
|
1030 |
}
|
| 1034 |
|
1031 |
|
| 1035 |
// work out the type
|
1032 |
// work out the type
|
| 1036 |
float fVersion;
|
1033 |
float fVersion;
|
| 1037 |
int iconType = -1;
|
1034 |
int iconType = -1;
|
| 1038 |
int check = CBaseFile::CheckFile(str->str, &fVersion);
|
1035 |
int check = CBaseFile::CheckFile(str->str.ToString(), &fVersion);
|
| 1039 |
switch ( check )
|
1036 |
switch ( check )
|
| 1040 |
{
|
1037 |
{
|
| 1041 |
case SPKFILE_BASE:
|
1038 |
case SPKFILE_BASE:
|
| 1042 |
iconType = 5;
|
1039 |
iconType = 5;
|
| 1043 |
break;
|
1040 |
break;
|