Subversion Repositories spk

Rev

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

Rev 196 Rev 197
Line 144... Line 144...
144
			if ( !package->pFile )
144
			if ( !package->pFile )
145
				continue;
145
				continue;
146
			if ( package->pFile->icon() )
146
			if ( package->pFile->icon() )
147
			{
147
			{
148
				package->pFile->ReadIconFileToMemory();
148
				package->pFile->ReadIconFileToMemory();
149
				Utils::WString sIconFile = _WS(IO::Path::GetTempPath()) + L"\\" + CFileIO(package->sName).baseName() + L"." + package->pFile->iconExt().toWString();
149
				Utils::WString sIconFile = _WS(IO::Path::GetTempPath()) + L"\\" + CFileIO(package->sName).baseName() + L"." + package->pFile->iconExt();
150
				if ( package->pFile->extractFile(package->pFile->icon(), CFileIO(sIconFile).fullFilename().toString(), false))
150
				if ( package->pFile->extractFile(package->pFile->icon(), CFileIO(sIconFile).fullFilename().toString(), 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
					{
Line 300... Line 300...
300
			item->SubItems->Add("All Games");
300
			item->SubItems->Add("All Games");
301
		}
301
		}
302
		else {
302
		else {
303
			if (file->game() & GAME_ALLNEW)
303
			if (file->game() & GAME_ALLNEW)
304
			{
304
			{
305
				Utils::String sGames = "";
305
				Utils::WString sGames = L"";
306
				for (int i = 0; i < 31; ++i)
306
				for (int i = 0; i < 31; ++i)
307
				{
307
				{
308
					if (file->game() & (1 << i))
308
					if (file->game() & (1 << i))
309
					{
309
					{
310
						Utils::String sGame;
310
						Utils::WString sGame;
311
						SGameExe *exe = _pPackages->GetGameExe()->GetGame(i - 1);
311
						SGameExe *exe = _pPackages->GetGameExe()->game(i - 1);
312
						sGame = (exe) ? exe->sName : ("Game: " + Utils::String::Number(i));
312
						sGame = (exe) ? exe->sName : (L"Game: " + Utils::WString::Number(i));
313
 
313
 
314
						if (sGames.empty())
314
						if (sGames.empty())
315
							sGames = sGame;
315
							sGames = sGame;
316
						else
316
						else
317
							sGames = sGames + ", " + sGame;
317
							sGames = sGames + L", " + sGame;
318
					}
318
					}
319
				}
319
				}
320
				if(sGames.empty())
320
				if(sGames.empty())
321
					item->SubItems->Add(_US("All Games"));
321
					item->SubItems->Add(_US("All Games"));
322
				else
322
				else
323
					item->SubItems->Add(_US(sGames));
323
					item->SubItems->Add(_US(sGames));
324
			}
324
			}
325
			else
325
			else
326
			{
326
			{
327
				SGameExe *exe = _pPackages->GetGameExe()->GetGame(file->game() - 1);
327
				SGameExe *exe = _pPackages->GetGameExe()->game(file->game() - 1);
328
				if (exe) {
328
				if (exe) {
329
					item->SubItems->Add(_US(exe->sName));
329
					item->SubItems->Add(_US(exe->sName));
330
				}
330
				}
331
				else {
331
				else {
332
					item->SubItems->Add("Game: " + file->game());
332
					item->SubItems->Add("Game: " + file->game());
Line 664... Line 664...
664
		}
664
		}
665
		else if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
665
		else if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
666
			E->Effect = DragDropEffects::Copy;
666
			E->Effect = DragDropEffects::Copy;
667
	}
667
	}
668
 
668
 
669
	void SpkForm::DropGetDirectories(String ^dir, Utils::CStringList *list, bool packages)
669
	void SpkForm::DropGetDirectories(String ^dir, Utils::WStringList *list, bool packages)
670
	{
670
	{
671
		cli::array<String ^> ^dirList = IO::Directory::GetFileSystemEntries(dir);
671
		cli::array<String ^> ^dirList = IO::Directory::GetFileSystemEntries(dir);
672
		for ( int j = 0; j < dirList->Length; j++ )
672
		for ( int j = 0; j < dirList->Length; j++ )
673
		{
673
		{
674
			if ( IO::DirectoryInfo(dirList[j]).Exists )
674
			if ( IO::DirectoryInfo(dirList[j]).Exists )
675
				this->DropGetDirectories(dirList[j], list, packages);
675
				this->DropGetDirectories(dirList[j], list, packages);
676
			else
676
			else
677
			{
677
			{
678
				if ( packages )
678
				if ( packages )
679
					list->pushBack(_S(dirList[j]), "-1");
679
					list->pushBack(_WS(dirList[j]), L"-1");
680
				else
680
				else
681
					list->pushBack(_S(dirList[j]), Utils::String::Number(SPK::GetAutomaticFiletype(_S(dirList[j]), NULL, false)));
681
					list->pushBack(_WS(dirList[j]), Utils::WString::Number(SPK::GetAutomaticFiletype(_WS(dirList[j]), NULL, false)));
682
			}
682
			}
683
		}
683
		}
684
	}
684
	}
685
 
685
 
686
	System::Void SpkForm::listView2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  E)
686
	System::Void SpkForm::listView2_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  E)
Line 688... Line 688...
688
		if ( !m_pMultiPackage )
688
		if ( !m_pMultiPackage )
689
			return;
689
			return;
690
 
690
 
691
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
691
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
692
		{
692
		{
693
			Utils::CStringList fileList;
693
			Utils::WStringList fileList;
694
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
694
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
695
			int i;
695
			int i;
696
			for(i = 0; i < a->Length; i++)
696
			for(i = 0; i < a->Length; i++)
697
			{
697
			{
698
				if ( IO::DirectoryInfo(a[i]).Exists )
698
				if ( IO::DirectoryInfo(a[i]).Exists )
699
					this->DropGetDirectories(a[i], &fileList, true);
699
					this->DropGetDirectories(a[i], &fileList, true);
700
				else
700
				else
701
					fileList.pushBack(_S(a[i]), "-1");
701
					fileList.pushBack(_WS(a[i]), L"-1");
702
			}
702
			}
703
 
703
 
704
			// remove invalid files
704
			// remove invalid files
705
			if ( !fileList.empty() )
705
			if ( !fileList.empty() )
706
			{
706
			{
Line 726... Line 726...
726
	System::Void SpkForm::listView1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^ E)
726
	System::Void SpkForm::listView1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^ E)
727
	{
727
	{
728
		// dropping from outside
728
		// dropping from outside
729
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
729
		if ( E->Data->GetDataPresent(DataFormats::FileDrop) )
730
		{
730
		{
731
			Utils::CStringList fileList;
731
			Utils::WStringList fileList;
732
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
732
			cli::array<String ^> ^a = (cli::array<String ^> ^)E->Data->GetData(DataFormats::FileDrop, false);
733
			int i;
733
			int i;
734
			for(i = 0; i < a->Length; i++)
734
			for(i = 0; i < a->Length; i++)
735
			{
735
			{
736
				if ( IO::DirectoryInfo(a[i]).Exists )
736
				if ( IO::DirectoryInfo(a[i]).Exists )
737
					this->DropGetDirectories(a[i], &fileList, false);
737
					this->DropGetDirectories(a[i], &fileList, false);
738
				else
738
				else
739
					fileList.pushBack(_S(a[i]), Utils::String::Number(SPK::GetAutomaticFiletype(_S(a[i]), NULL, false)));
739
					fileList.pushBack(_WS(a[i]), Utils::WString::Number(SPK::GetAutomaticFiletype(_WS(a[i]), NULL, false)));
740
			}
740
			}
741
 
741
 
742
			SPK::AssignAutomaticFiletypes(fileList);
742
			SPK::AssignAutomaticFiletypes(fileList);
743
 
743
 
744
			if ( !fileList.empty() )
744
			if ( !fileList.empty() )
Line 747... Line 747...
747
				if ( dropType->ShowDialog(this) == Forms::DialogResult::OK )
747
				if ( dropType->ShowDialog(this) == Forms::DialogResult::OK )
748
				{
748
				{
749
					AddDialog ^ad = gcnew AddDialog(m_pPackage, NULL);
749
					AddDialog ^ad = gcnew AddDialog(m_pPackage, NULL);
750
					for(auto itr = fileList.begin(); itr != fileList.end(); itr++)
750
					for(auto itr = fileList.begin(); itr != fileList.end(); itr++)
751
					{
751
					{
752
						int type = (*itr)->data.token(" ", 1).toInt();
752
						int type = (*itr)->data.token(L" ", 1).toInt();
753
						if ( type == -1 )
753
						if ( type == -1 )
754
							continue;
754
							continue;
755
						ad->AddFile(_US((*itr)->str), "", type, 0);
755
						ad->AddFile(_US((*itr)->str), "", type, 0);
756
					}
756
					}
757
					if ( ad->AnyFiles() )
757
					if ( ad->AnyFiles() )
Line 925... Line 925...
925
			m_pMultiPackage->readAllPackages();
925
			m_pMultiPackage->readAllPackages();
926
			m_pMultiPackage->UpdatedPackage(m_pPackage);
926
			m_pMultiPackage->UpdatedPackage(m_pPackage);
927
			m_pMultiPackage->writeFile(m_pMultiPackage->filename());
927
			m_pMultiPackage->writeFile(m_pMultiPackage->filename());
928
		}
928
		}
929
		else
929
		else
930
			m_pPackage->writeFile(m_pPackage->filename());
930
			m_pPackage->writeFile(m_pPackage->filename().toString());
931
	}
931
	}
932
 
932
 
933
	void SpkForm::PasteFiles(CLinkList<C_File> *list)
933
	void SpkForm::PasteFiles(CLinkList<C_File> *list)
934
	{
934
	{
935
		if ( m_pMultiPackage && m_pSelectedPackage )
935
		if ( m_pMultiPackage && m_pSelectedPackage )