Line 116... |
Line 116... |
116 |
game = m_pPackage->FindFirstGameInPackage();
|
116 |
game = m_pPackage->FindFirstGameInPackage();
|
117 |
}
|
117 |
}
|
118 |
|
118 |
|
119 |
SaveFileDialog ^ofd = gcnew SaveFileDialog();
|
119 |
SaveFileDialog ^ofd = gcnew SaveFileDialog();
|
120 |
ofd->Filter = "Zip Archive (*.zip)|*.zip";
|
120 |
ofd->Filter = "Zip Archive (*.zip)|*.zip";
|
121 |
ofd->FileName = _US((CFileIO(m_pPackage->filename()).dir() + L"/" + CFileIO(m_pPackage->filename()).baseName() + L"_" + CBaseFile::ConvertGameToString(game).toWString() + L".zip").findReplace(L"/", L"\\"));
|
121 |
ofd->FileName = _US((CFileIO(m_pPackage->filename()).dir() + L"/" + CFileIO(m_pPackage->filename()).baseName() + L"_" + CBaseFile::ConvertGameToString(game) + L".zip").findReplace(L"/", L"\\"));
|
122 |
ofd->FilterIndex = 1;
|
122 |
ofd->FilterIndex = 1;
|
123 |
ofd->RestoreDirectory = true;
|
123 |
ofd->RestoreDirectory = true;
|
124 |
ofd->AddExtension = true;
|
124 |
ofd->AddExtension = true;
|
125 |
ofd->Title = "Select the archive to export to";
|
125 |
ofd->Title = "Select the archive to export to";
|
126 |
if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
|
126 |
if ( ofd->ShowDialog(this) == Windows::Forms::DialogResult::OK )
|
Line 137... |
Line 137... |
137 |
/// Clean up any resources being used.
|
137 |
/// Clean up any resources being used.
|
138 |
/// </summary>
|
138 |
/// </summary>
|
139 |
~PackageForm();
|
139 |
~PackageForm();
|
140 |
|
140 |
|
141 |
private:
|
141 |
private:
|
142 |
void DropGetDirectories(String ^dir, Utils::CStringList *list, bool packages);
|
142 |
void DropGetDirectories(String ^dir, Utils::WStringList *list, bool packages);
|
143 |
void UpdateMirrors();
|
143 |
void UpdateMirrors();
|
144 |
void UpdatePackageNames();
|
144 |
void UpdatePackageNames();
|
145 |
void UpdateView();
|
145 |
void UpdateView();
|
146 |
void Setup();
|
146 |
void Setup();
|
147 |
void AddFile(C_File *file);
|
147 |
void AddFile(C_File *file);
|
Line 4580... |
Line 4580... |
4580 |
if ( w )
|
4580 |
if ( w )
|
4581 |
{
|
4581 |
{
|
4582 |
AddWareText ^wt = gcnew AddWareText(_US(w->sID));
|
4582 |
AddWareText ^wt = gcnew AddWareText(_US(w->sID));
|
4583 |
if ( wt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
4583 |
if ( wt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
4584 |
{
|
4584 |
{
|
4585 |
((CSpkFile *)m_pPackage)->AddWareText(w, wt->GetLang(), CyStringFromSystemString(wt->GetName()).ToString(), CyStringFromSystemString(wt->GetDescription()).ToString());
|
4585 |
((CSpkFile *)m_pPackage)->addWareText(w, wt->GetLang(), _WS(wt->GetName()), _WS(wt->GetDescription()));
|
4586 |
this->UpdateWareText();
|
4586 |
this->UpdateWareText();
|
4587 |
}
|
4587 |
}
|
4588 |
}
|
4588 |
}
|
4589 |
}
|
4589 |
}
|
4590 |
|
4590 |
|
Line 4596... |
Line 4596... |
4596 |
wt->SetEdit(System::Convert::ToInt32(m_pSelectedItem->Text));
|
4596 |
wt->SetEdit(System::Convert::ToInt32(m_pSelectedItem->Text));
|
4597 |
wt->SetName(m_pSelectedItem->SubItems[1]->Text);
|
4597 |
wt->SetName(m_pSelectedItem->SubItems[1]->Text);
|
4598 |
wt->SetDesc(m_pSelectedItem->SubItems[2]->Text);
|
4598 |
wt->SetDesc(m_pSelectedItem->SubItems[2]->Text);
|
4599 |
if ( wt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
4599 |
if ( wt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
4600 |
{
|
4600 |
{
|
4601 |
((CSpkFile *)m_pPackage)->AddWareText(w, wt->GetLang(), CyStringFromSystemString(wt->GetName()).ToString(), CyStringFromSystemString(wt->GetDescription()).ToString());
|
4601 |
((CSpkFile *)m_pPackage)->addWareText(w, wt->GetLang(), _WS(wt->GetName()), _WS(wt->GetDescription()));
|
4602 |
this->UpdateWareText();
|
4602 |
this->UpdateWareText();
|
4603 |
}
|
4603 |
}
|
4604 |
}
|
4604 |
}
|
4605 |
}
|
4605 |
}
|
4606 |
private: System::Void ContextWTRemove_Click(System::Object^ sender, System::EventArgs^ e) {
|
4606 |
private: System::Void ContextWTRemove_Click(System::Object^ sender, System::EventArgs^ e) {
|
Line 4985... |
Line 4985... |
4985 |
wt->SetEdit(System::Convert::ToInt32(item->Text));
|
4985 |
wt->SetEdit(System::Convert::ToInt32(item->Text));
|
4986 |
wt->SetName(item->SubItems[1]->Text);
|
4986 |
wt->SetName(item->SubItems[1]->Text);
|
4987 |
wt->SetDesc(item->SubItems[2]->Text);
|
4987 |
wt->SetDesc(item->SubItems[2]->Text);
|
4988 |
if ( wt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
4988 |
if ( wt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
4989 |
{
|
4989 |
{
|
4990 |
((CSpkFile *)m_pPackage)->AddWareText(w, wt->GetLang(), CyStringFromSystemString(wt->GetName()).ToString(), CyStringFromSystemString(wt->GetDescription()).ToString());
|
4990 |
((CSpkFile *)m_pPackage)->addWareText(w, wt->GetLang(), _WS(wt->GetName()), _WS(wt->GetDescription()));
|
4991 |
item->SubItems[1]->Text = wt->GetName();
|
4991 |
item->SubItems[1]->Text = wt->GetName();
|
4992 |
item->SubItems[2]->Text = wt->GetDescription();
|
4992 |
item->SubItems[2]->Text = wt->GetDescription();
|
4993 |
this->UpdateChanged();
|
4993 |
this->UpdateChanged();
|
4994 |
}
|
4994 |
}
|
4995 |
}
|
4995 |
}
|
Line 5112... |
Line 5112... |
5112 |
}
|
5112 |
}
|
5113 |
private: System::Void ListFiles_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) {
|
5113 |
private: System::Void ListFiles_DragDrop(System::Object^ sender, System::Windows::Forms::DragEventArgs^ e) {
|
5114 |
// dropping from outside
|
5114 |
// dropping from outside
|
5115 |
if ( e->Data->GetDataPresent(DataFormats::FileDrop) )
|
5115 |
if ( e->Data->GetDataPresent(DataFormats::FileDrop) )
|
5116 |
{
|
5116 |
{
|
5117 |
Utils::CStringList fileList;
|
5117 |
Utils::WStringList fileList;
|
5118 |
cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
|
5118 |
cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
|
5119 |
int i;
|
5119 |
int i;
|
5120 |
for(i = 0; i < a->Length; i++)
|
5120 |
for(i = 0; i < a->Length; i++)
|
5121 |
{
|
5121 |
{
|
5122 |
if ( IO::DirectoryInfo(a[i]).Exists )
|
5122 |
if ( IO::DirectoryInfo(a[i]).Exists )
|
5123 |
this->DropGetDirectories(a[i], &fileList, false);
|
5123 |
this->DropGetDirectories(a[i], &fileList, false);
|
5124 |
else
|
5124 |
else
|
5125 |
fileList.pushBack(_S(a[i]), Utils::String::Number(SPK::GetAutomaticFiletype(_S(a[i]), NULL, false)));
|
5125 |
fileList.pushBack(_WS(a[i]), Utils::WString::Number(SPK::GetAutomaticFiletype(_WS(a[i]), NULL, false)));
|
5126 |
}
|
5126 |
}
|
5127 |
|
5127 |
|
5128 |
SPK::AssignAutomaticFiletypes(fileList);
|
5128 |
SPK::AssignAutomaticFiletypes(fileList);
|
5129 |
|
5129 |
|
5130 |
if ( !fileList.empty() )
|
5130 |
if ( !fileList.empty() )
|
Line 5132... |
Line 5132... |
5132 |
SpkExplorer::DropFileDialog ^dropType = gcnew SpkExplorer::DropFileDialog(&fileList);
|
5132 |
SpkExplorer::DropFileDialog ^dropType = gcnew SpkExplorer::DropFileDialog(&fileList);
|
5133 |
if ( dropType->ShowDialog(this) == Windows::Forms::DialogResult::OK )
|
5133 |
if ( dropType->ShowDialog(this) == Windows::Forms::DialogResult::OK )
|
5134 |
{
|
5134 |
{
|
5135 |
for(auto itr = fileList.begin(); itr != fileList.end(); itr++)
|
5135 |
for(auto itr = fileList.begin(); itr != fileList.end(); itr++)
|
5136 |
{
|
5136 |
{
|
5137 |
FileType type = static_cast<FileType>((*itr)->data.token(" ", 1).toInt());
|
5137 |
FileType type = static_cast<FileType>((*itr)->data.token(L" ", 1).toInt());
|
5138 |
if ( type == FileType::FILETYPE_UNKNOWN)
|
5138 |
if ( type == FileType::FILETYPE_UNKNOWN)
|
5139 |
continue;
|
5139 |
continue;
|
5140 |
|
5140 |
|
5141 |
FileType filetype = m_pP->adjustFileType((*itr)->str, type);
|
5141 |
FileType filetype = m_pP->adjustFileType((*itr)->str, type);
|
5142 |
Utils::WString dir = (filetype == FILETYPE_EXTRA) ? L"PluginManager/Extras/$scriptname" : L"";
|
5142 |
Utils::WString dir = (filetype == FILETYPE_EXTRA) ? L"PluginManager/Extras/$scriptname" : L"";
|
5143 |
Utils::WString checkDir = CFileIO((*itr)->str).dir().token(L"/", -1);
|
5143 |
Utils::WString checkDir = CFileIO((*itr)->str).dir().token(L"/", -1);
|
5144 |
if ( checkDir.Compare(L"types") )
|
5144 |
if ( checkDir.Compare(L"types") )
|
5145 |
dir = checkDir;
|
5145 |
dir = checkDir;
|
5146 |
|
5146 |
|
5147 |
C_File *f = m_pPackage->addFile((*itr)->str, dir.toString(), filetype);
|
5147 |
C_File *f = m_pPackage->addFile((*itr)->str, dir, filetype);
|
5148 |
if ( filetype == FILETYPE_MOD && CFileIO((*itr)->str).isFileExtension(L"cat"))
|
5148 |
if ( filetype == FILETYPE_MOD && CFileIO((*itr)->str).isFileExtension(L"cat"))
|
5149 |
m_pPackage->addFile(CFileIO((*itr)->str).changeFileExtension(L"dat").toString(), "", filetype);
|
5149 |
m_pPackage->addFile(CFileIO((*itr)->str).changeFileExtension(L"dat"), L"", filetype);
|
5150 |
else if ( filetype == FILETYPE_MOD && CFileIO((*itr)->str).isFileExtension(L"dat"))
|
5150 |
else if ( filetype == FILETYPE_MOD && CFileIO((*itr)->str).isFileExtension(L"dat"))
|
5151 |
m_pPackage->addFile(CFileIO((*itr)->str).changeFileExtension(L"cat").toString(), "", filetype);
|
5151 |
m_pPackage->addFile(CFileIO((*itr)->str).changeFileExtension(L"cat"), L"", filetype);
|
5152 |
}
|
5152 |
}
|
5153 |
this->UpdateFileList();
|
5153 |
this->UpdateFileList();
|
5154 |
this->UpdateDisplayPic();
|
5154 |
this->UpdateDisplayPic();
|
5155 |
this->UpdateChanged();
|
5155 |
this->UpdateChanged();
|
5156 |
}
|
5156 |
}
|
Line 5278... |
Line 5278... |
5278 |
if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
5278 |
if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
|
5279 |
{
|
5279 |
{
|
5280 |
array<System::String ^> ^fileArray = ofd->FileNames;
|
5280 |
array<System::String ^> ^fileArray = ofd->FileNames;
|
5281 |
for ( int i = 0; i < fileArray->Length; i++ )
|
5281 |
for ( int i = 0; i < fileArray->Length; i++ )
|
5282 |
{
|
5282 |
{
|
5283 |
((CXspFile *)m_pPackage)->AddTextFromFile(_S(fileArray[i]));
|
5283 |
((CXspFile *)m_pPackage)->addTextFromFile(_WS(fileArray[i]));
|
5284 |
m_pPackage->adjustChanged(true);
|
5284 |
m_pPackage->adjustChanged(true);
|
5285 |
}
|
5285 |
}
|
5286 |
this->UpdateShipText();
|
5286 |
this->UpdateShipText();
|
5287 |
this->UpdateChanged();
|
5287 |
this->UpdateChanged();
|
5288 |
}
|
5288 |
}
|
Line 5294... |
Line 5294... |
5294 |
{
|
5294 |
{
|
5295 |
bool added = false;
|
5295 |
bool added = false;
|
5296 |
array <System::String ^> ^Files = System::IO::Directory::GetFiles(fbd->SelectedPath, "*.xml");
|
5296 |
array <System::String ^> ^Files = System::IO::Directory::GetFiles(fbd->SelectedPath, "*.xml");
|
5297 |
for ( int i = 0; i < Files->Length; i++ )
|
5297 |
for ( int i = 0; i < Files->Length; i++ )
|
5298 |
{
|
5298 |
{
|
5299 |
Utils::String file = _S(Files[i]);
|
5299 |
Utils::WString file = _WS(Files[i]);
|
5300 |
if ( m_pP->adjustFileType(file, FileType::FILETYPE_UNKNOWN) == FILETYPE_TEXT )
|
5300 |
if ( m_pP->adjustFileType(file, FileType::FILETYPE_UNKNOWN) == FILETYPE_TEXT )
|
5301 |
{
|
5301 |
{
|
5302 |
if ( ((CXspFile *)m_pPackage)->AddTextFromFile(file) )
|
5302 |
if ( ((CXspFile *)m_pPackage)->addTextFromFile(file) )
|
5303 |
added = true;
|
5303 |
added = true;
|
5304 |
}
|
5304 |
}
|
5305 |
}
|
5305 |
}
|
5306 |
Files = System::IO::Directory::GetFiles(fbd->SelectedPath, "*.pck");
|
5306 |
Files = System::IO::Directory::GetFiles(fbd->SelectedPath, "*.pck");
|
5307 |
for ( int i = 0; i < Files->Length; i++ )
|
5307 |
for ( int i = 0; i < Files->Length; i++ )
|
5308 |
{
|
5308 |
{
|
5309 |
Utils::String file = _S(Files[i]);
|
5309 |
Utils::WString file = _WS(Files[i]);
|
5310 |
if ( m_pP->adjustFileType(file, FileType::FILETYPE_UNKNOWN) == FILETYPE_TEXT )
|
5310 |
if ( m_pP->adjustFileType(file, FileType::FILETYPE_UNKNOWN) == FILETYPE_TEXT )
|
5311 |
{
|
5311 |
{
|
5312 |
if ( ((CXspFile *)m_pPackage)->AddTextFromFile(file) )
|
5312 |
if ( ((CXspFile *)m_pPackage)->addTextFromFile(file) )
|
5313 |
added = true;
|
5313 |
added = true;
|
5314 |
}
|
5314 |
}
|
5315 |
}
|
5315 |
}
|
5316 |
|
5316 |
|
5317 |
if ( added )
|
5317 |
if ( added )
|
Line 5396... |
Line 5396... |
5396 |
case 5:
|
5396 |
case 5:
|
5397 |
this->ImportAnimations(f);
|
5397 |
this->ImportAnimations(f);
|
5398 |
break;
|
5398 |
break;
|
5399 |
}
|
5399 |
}
|
5400 |
|
5400 |
|
5401 |
if ( IO::File::Exists(_US(CPackages::tempDirectory() + "tmp.dat")) )
|
5401 |
if ( IO::File::Exists(_US(CPackages::tempDirectory() + L"tmp.dat")) )
|
5402 |
IO::File::Delete(_US(CPackages::tempDirectory() + "tmp.dat"));
|
5402 |
IO::File::Delete(_US(CPackages::tempDirectory() + L"tmp.dat"));
|
5403 |
}
|
5403 |
}
|
5404 |
}
|
5404 |
}
|
5405 |
private: System::Void TextShipData_TextChanged(System::Object^ sender, System::EventArgs^ e) {
|
5405 |
private: System::Void TextShipData_TextChanged(System::Object^ sender, System::EventArgs^ e) {
|
5406 |
((CXspFile *)m_pPackage)->SetShipData(CyStringFromSystemString(this->TextShipData->Text).ToString());
|
5406 |
((CXspFile *)m_pPackage)->SetShipData(CyStringFromSystemString(this->TextShipData->Text).ToString());
|
5407 |
this->UpdateChanged();
|
5407 |
this->UpdateChanged();
|
Line 5588... |
Line 5588... |
5588 |
if ( item ) {
|
5588 |
if ( item ) {
|
5589 |
int game = Convert::ToInt32(item->Tag);
|
5589 |
int game = Convert::ToInt32(item->Tag);
|
5590 |
if ( game ) {
|
5590 |
if ( game ) {
|
5591 |
SGameCompat *g = m_pPackage->GetGameCompatability(game);
|
5591 |
SGameCompat *g = m_pPackage->GetGameCompatability(game);
|
5592 |
if ( g ) {
|
5592 |
if ( g ) {
|
5593 |
SGameExe *exe = m_pP->GetGameExe()->GetGame(game - 1);
|
5593 |
SGameExe *exe = m_pP->GetGameExe()->game(game - 1);
|
5594 |
if ( exe ) {
|
5594 |
if ( exe ) {
|
5595 |
this->ButGame->ImageIndex = game - 1;
|
5595 |
this->ButGame->ImageIndex = game - 1;
|
5596 |
this->ButGame->Text = _US(exe->sName);
|
5596 |
this->ButGame->Text = _US(exe->sName);
|
5597 |
this->ComboVersion->Enabled = true;
|
5597 |
this->ComboVersion->Enabled = true;
|
5598 |
this->ButGameAdd->Enabled = true;
|
5598 |
this->ButGameAdd->Enabled = true;
|