Subversion Repositories spk

Rev

Rev 160 | Rev 175 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 160 Rev 170
Line 141... Line 141...
141
		// read the icons
141
		// read the icons
142
		for ( SMultiSpkFile *package = p->GetFileList()->First(); package; package = p->GetFileList()->Next() )
142
		for ( SMultiSpkFile *package = p->GetFileList()->First(); package; package = p->GetFileList()->Next() )
143
		{
143
		{
144
			if ( !package->pFile )
144
			if ( !package->pFile )
145
				continue;
145
				continue;
146
			if ( package->pFile->GetIcon() )
146
			if ( package->pFile->icon() )
147
			{
147
			{
148
				package->pFile->ReadIconFileToMemory();
148
				package->pFile->ReadIconFileToMemory();
149
				Utils::String sIconFile = _S(IO::Path::GetTempPath()) + "\\" + CFileIO(package->sName).baseName() + "." + package->pFile->iconExt();
149
				Utils::String sIconFile = _S(IO::Path::GetTempPath()) + "\\" + CFileIO(package->sName).baseName() + "." + package->pFile->iconExt();
150
				if ( package->pFile->ExtractFile(package->pFile->GetIcon(), CFileIO(sIconFile).fullFilename(), false) )
150
				if ( package->pFile->ExtractFile(package->pFile->icon(), CFileIO(sIconFile).fullFilename(), false) )
151
				{
151
				{
152
					String ^iconFile = _US(sIconFile);
152
					String ^iconFile = _US(sIconFile);
153
					if ( IO::File::Exists(iconFile) )
153
					if ( IO::File::Exists(iconFile) )
154
					{
154
					{
155
						String ^file = SystemStringFromCyString(package->sName);
155
						String ^file = SystemStringFromCyString(package->sName);
Line 545... Line 545...
545
		// remove the dat or cat file as well
545
		// remove the dat or cat file as well
546
		if ( f->GetFileType() == FILETYPE_MOD )
546
		if ( f->GetFileType() == FILETYPE_MOD )
547
		{
547
		{
548
			if ( f->CheckFileExt("cat") )
548
			if ( f->CheckFileExt("cat") )
549
			{
549
			{
550
				C_File *datFile = m_pPackage->FindFile(CFileIO(f).changeFileExtension("dat"), FILETYPE_MOD, "", f->GetGame());
550
				C_File *datFile = m_pPackage->findFile(CFileIO(f).changeFileExtension("dat"), FILETYPE_MOD, "", f->GetGame());
551
				if ( datFile )
551
				if ( datFile )
552
					ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
552
					ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
553
			}
553
			}
554
			else if ( f->CheckFileExt("dat") )
554
			else if ( f->CheckFileExt("dat") )
555
			{
555
			{
556
				C_File *datFile = m_pPackage->FindFile(CFileIO(f).changeFileExtension("cat"), FILETYPE_MOD, "", f->GetGame());
556
				C_File *datFile = m_pPackage->findFile(CFileIO(f).changeFileExtension("cat"), FILETYPE_MOD, "", f->GetGame());
557
				if ( datFile )
557
				if ( datFile )
558
					ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
558
					ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
559
			}
559
			}
560
		}
560
		}
561
		ad->ShowDialog(this);
561
		ad->ShowDialog(this);
Line 579... Line 579...
579
			// remove the dat or cat file as well
579
			// remove the dat or cat file as well
580
			if ( f->GetFileType() == FILETYPE_MOD )
580
			if ( f->GetFileType() == FILETYPE_MOD )
581
			{
581
			{
582
				if ( f->CheckFileExt("cat") )
582
				if ( f->CheckFileExt("cat") )
583
				{
583
				{
584
					C_File *datFile = m_pPackage->FindFile(CFileIO(f).changeFileExtension("dat"), FILETYPE_MOD, "", f->GetGame());
584
					C_File *datFile = m_pPackage->findFile(CFileIO(f).changeFileExtension("dat"), FILETYPE_MOD, "", f->GetGame());
585
					if ( datFile )
585
					if ( datFile )
586
						ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
586
						ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
587
				}
587
				}
588
				else if ( f->CheckFileExt("dat") )
588
				else if ( f->CheckFileExt("dat") )
589
				{
589
				{
590
					C_File *datFile = m_pPackage->FindFile(CFileIO(f).changeFileExtension("cat"), FILETYPE_MOD, "", f->GetGame());
590
					C_File *datFile = m_pPackage->findFile(CFileIO(f).changeFileExtension("cat"), FILETYPE_MOD, "", f->GetGame());
591
					if ( datFile )
591
					if ( datFile )
592
						ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
592
						ad->AddFile(_US(datFile->name()), _US(datFile->dir()), datFile->GetFileType(), datFile->GetGame());
593
				}
593
				}
594
			}
594
			}
595
		}
595
		}
Line 677... Line 677...
677
			else
677
			else
678
			{
678
			{
679
				if ( packages )
679
				if ( packages )
680
					list->PushBack(CyStringFromSystemString(dirList[j]), "-1");
680
					list->PushBack(CyStringFromSystemString(dirList[j]), "-1");
681
				else
681
				else
682
					list->PushBack(CyStringFromSystemString(dirList[j]), CyString::Number(SPK::GetAutomaticFiletype(CyStringFromSystemString(dirList[j]), NULL, false)));
682
					list->PushBack(CyStringFromSystemString(dirList[j]), CyString::Number(SPK::GetAutomaticFiletype(_S(dirList[j]), NULL, false)));
683
			}
683
			}
684
		}
684
		}
685
	}
685
	}
686
 
686
 
687
	System::Void SpkForm::listView2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  E)
687
	System::Void SpkForm::listView2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  E)
Line 735... Line 735...
735
			for(i = 0; i < a->Length; i++)
735
			for(i = 0; i < a->Length; i++)
736
			{
736
			{
737
				if ( IO::DirectoryInfo(a[i]).Exists )
737
				if ( IO::DirectoryInfo(a[i]).Exists )
738
					this->DropGetDirectories(a[i], &fileList, false);
738
					this->DropGetDirectories(a[i], &fileList, false);
739
				else
739
				else
740
					fileList.PushBack(CyStringFromSystemString(a[i]), CyString::Number(SPK::GetAutomaticFiletype(CyStringFromSystemString(a[i]), NULL, false)));
740
					fileList.PushBack(CyStringFromSystemString(a[i]), CyString::Number(SPK::GetAutomaticFiletype(_S(a[i]), NULL, false)));
741
			}
741
			}
742
 
742
 
743
			SPK::AssignAutomaticFiletypes(&fileList);
743
			SPK::AssignAutomaticFiletypes(&fileList);
744
 
744
 
745
			if ( !fileList.Empty() )
745
			if ( !fileList.Empty() )
Line 992... Line 992...
992
 
992
 
993
			switch ( f->GetFileType() )
993
			switch ( f->GetFileType() )
994
			{
994
			{
995
				case FILETYPE_SCRIPT:
995
				case FILETYPE_SCRIPT:
996
				case FILETYPE_UNINSTALL:
996
				case FILETYPE_UNINSTALL:
997
					if ( m_pPackage->ExtractFile(f, CyStringFromSystemString(IO::Path::GetTempPath()), false) )
997
					if ( m_pPackage->ExtractFile(f, _S(IO::Path::GetTempPath()), false) )
998
					{
998
					{
999
						SPK::WriteScriptStyleSheet(CyStringFromSystemString(IO::Path::GetTempPath()));
999
						SPK::WriteScriptStyleSheet(_S(IO::Path::GetTempPath()));
1000
						process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + SystemStringFromCyString(f->GetName());
1000
						process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(f->name());
1001
					}
1001
					}
1002
					break;
1002
					break;
1003
 
1003
 
1004
				case FILETYPE_MOD:
1004
				case FILETYPE_MOD:
1005
					if ( m_pPackage->ExtractFile(f, CyStringFromSystemString(IO::Path::GetTempPath()), false) )
1005
					if ( m_pPackage->ExtractFile(f, _S(IO::Path::GetTempPath()), false) )
1006
					{
1006
					{
1007
						if ( f->CheckFileExt("cat") )
1007
						if ( f->CheckFileExt("cat") )
1008
						{
1008
						{
1009
							C_File *datFile = m_pPackage->FindFile(CFileIO(f).changeFileExtension("dat"), FILETYPE_MOD, "");
1009
							C_File *datFile = m_pPackage->findFile(CFileIO(f).changeFileExtension("dat"), FILETYPE_MOD, "");
1010
							if ( datFile )
1010
							if ( datFile )
1011
							{
1011
							{
1012
								if ( m_pPackage->ExtractFile(datFile, CyStringFromSystemString(IO::Path::GetTempPath()), false) )
1012
								if ( m_pPackage->ExtractFile(datFile, _S(IO::Path::GetTempPath()), false) )
1013
									process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(f->name());
1013
									process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(f->name());
1014
							}
1014
							}
1015
						}
1015
						}
1016
						else if ( f->CheckFileExt("dat") )
1016
						else if ( f->CheckFileExt("dat") )
1017
						{
1017
						{
1018
							C_File *catFile = m_pPackage->FindFile(CFileIO(f).changeFileExtension("cat"), FILETYPE_MOD, "");
1018
							C_File *catFile = m_pPackage->findFile(CFileIO(f).changeFileExtension("cat"), FILETYPE_MOD, "");
1019
							if ( catFile )
1019
							if ( catFile )
1020
							{
1020
							{
1021
								if ( m_pPackage->ExtractFile(catFile, CyStringFromSystemString(IO::Path::GetTempPath()), false) )
1021
								if ( m_pPackage->ExtractFile(catFile, _S(IO::Path::GetTempPath()), false) )
1022
									process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(catFile->name());
1022
									process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(catFile->name());
1023
							}
1023
							}
1024
						}
1024
						}
1025
					}
1025
					}
1026
					break;
1026
					break;
1027
 
1027
 
1028
				case FILETYPE_MAP:
1028
				case FILETYPE_MAP:
1029
					break;
1029
					break;
1030
 
1030
 
1031
				default:
1031
				default:
1032
					if ( m_pPackage->ExtractFile(f, CyStringFromSystemString(IO::Path::GetTempPath()), false) )
1032
					if ( m_pPackage->ExtractFile(f, _S(IO::Path::GetTempPath()), false) )
1033
						process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(f->name());
1033
						process->StartInfo->FileName = IO::Path::GetTempPath() + "\\" + _US(f->name());
1034
			}
1034
			}
1035
 
1035
 
1036
			if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
1036
			if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
1037
			{
1037
			{
Line 1039... Line 1039...
1039
				process->Start();
1039
				process->Start();
1040
			}
1040
			}
1041
		}
1041
		}
1042
		catch (System::Exception ^E) 
1042
		catch (System::Exception ^E) 
1043
		{
1043
		{
1044
			MessageBox::Show(this, "Error opening file:\n" + SystemStringFromCyString(f->GetName()) + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1044
			MessageBox::Show(this, "Error opening file:\n" + _US(f->name()) + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1045
		}
1045
		}
1046
	}
1046
	}
1047
}
1047
}