Subversion Repositories spk

Rev

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

Rev 163 Rev 164
Line 880... Line 880...
880
	}
880
	}
881
 
881
 
882
	void MainGui::FindPackages()
882
	void MainGui::FindPackages()
883
	{
883
	{
884
		if (m_lAvailablePackages)
884
		if (m_lAvailablePackages)
885
			m_lAvailablePackages->MemoryClear();
885
			m_lAvailablePackages->clear();
886
		if (!m_lAvailablePackages)
886
		if (!m_lAvailablePackages)
887
			m_lAvailablePackages = new CLinkList<CBaseFile>;
887
			m_lAvailablePackages = new CLinkList<CBaseFile>;
888
 
888
 
889
		String ^curDir = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName;
889
		String ^curDir = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName;
890
		m_pPackages->findAllPackages(*m_lAvailablePackages, _S(curDir));
890
		m_pPackages->updateFoundPackages(_S(curDir));
891
 
891
 
892
		// find packages from registry key
892
		// find packages from registry key
893
		RegistryKey ^searchKey = Registry::CurrentUser->OpenSubKey("Software\\Egosoft\\SuperBox");
893
		RegistryKey ^searchKey = Registry::CurrentUser->OpenSubKey("Software\\Egosoft\\SuperBox");
894
		if (searchKey)
894
		if (searchKey)
895
		{
895
		{
896
			String ^dir = System::Convert::ToString(searchKey->GetValue("Addons"));
896
			String ^dir = System::Convert::ToString(searchKey->GetValue("Addons"));
897
			if (dir)
897
			if (dir)
898
				m_pPackages->findPackageDirectories(*m_lAvailablePackages, _S(dir));
898
				m_pPackages->addFoundPackages(_S(dir));
899
		}
899
		}
900
 
900
 
901
		// find packages from DVD
901
		// find packages from DVD
902
		cli::array<IO::DriveInfo ^> ^Drives = IO::DriveInfo::GetDrives();
902
		cli::array<IO::DriveInfo ^> ^Drives = IO::DriveInfo::GetDrives();
903
		if (Drives)
903
		if (Drives)
Line 906... Line 906...
906
			{
906
			{
907
				IO::DriveInfo ^info = Drives[i];
907
				IO::DriveInfo ^info = Drives[i];
908
				if (info->DriveType != IO::DriveType::CDRom)
908
				if (info->DriveType != IO::DriveType::CDRom)
909
					continue;
909
					continue;
910
				if (info->IsReady)
910
				if (info->IsReady)
911
					m_pPackages->findPackageDirectories(*m_lAvailablePackages, _S(info->RootDirectory + "XPluginManager"));
911
					m_pPackages->addFoundPackages(_S(info->RootDirectory + "XPluginManager"));
912
			}
912
			}
913
		}
913
		}
-
 
914
 
-
 
915
		for (auto p = m_pPackages->getFoundPackageList()->First(); p; p = m_pPackages->getFoundPackageList()->Next())
-
 
916
			m_lAvailablePackages->push_back(p);
914
 
917
 
915
		int num = 0;
918
		int num = 0;
916
		for (CBaseFile *p = m_lAvailablePackages->First(); p; p = m_lAvailablePackages->Next())
919
		for (CBaseFile *p = m_lAvailablePackages->First(); p; p = m_lAvailablePackages->Next())
917
		{
920
		{
918
			p->SetNum(num);
921
			p->SetNum(num);
Line 1117... Line 1120...
1117
			m_pPackages->UpdatePackages();
1120
			m_pPackages->UpdatePackages();
1118
			m_pPackages->ReadGameLanguage(true);
1121
			m_pPackages->ReadGameLanguage(true);
1119
			System::String ^mod = PluginManager::ReadRegistryValue(m_pPackages->GetModKey());
1122
			System::String ^mod = PluginManager::ReadRegistryValue(m_pPackages->GetModKey());
1120
			m_pPackages->setMod(_S(mod));
1123
			m_pPackages->setMod(_S(mod));
1121
			if(m_lAvailablePackages)
1124
			if(m_lAvailablePackages)
1122
				m_lAvailablePackages->MemoryClear();
1125
				m_lAvailablePackages->clear();
1123
			this->FindPackages();
1126
			this->FindPackages();
1124
		}
1127
		}
1125
		else
1128
		else
1126
		{
1129
		{
1127
			this->DisplayMessageBox(true, "Error", "unable to open new directory", MessageBoxButtons::OK, MessageBoxIcon::Error);
1130
			this->DisplayMessageBox(true, "Error", "unable to open new directory", MessageBoxButtons::OK, MessageBoxIcon::Error);