Subversion Repositories spk

Rev

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

Rev 182 Rev 183
Line 718... Line 718...
718
		m_pPi = gcnew PackageInstalled("Uninstall Packages");
718
		m_pPi = gcnew PackageInstalled("Uninstall Packages");
719
 
719
 
720
		CLinkList<CBaseFile> packageList;
720
		CLinkList<CBaseFile> packageList;
721
		CLinkList<CBaseFile> disableList;
721
		CLinkList<CBaseFile> disableList;
722
 
722
 
723
		if ( m_pPackages->UninstallPreparedPackages(m_pFileErrors, 0, &packageList, &disableList) )
723
		if ( m_pPackages->uninstallPreparedPackages(m_pFileErrors, 0, &packageList, &disableList) )
724
		{
724
		{
725
			Utils::String sDisplay;
725
			Utils::String sDisplay;
726
			Utils::String sAfterText;
726
			Utils::String sAfterText;
727
			for ( CBaseFile *p = packageList.First(); p; p = packageList.Next() )
727
			for ( CBaseFile *p = packageList.First(); p; p = packageList.Next() )
728
			{
728
			{
Line 756... Line 756...
756
		System::String ^display;
756
		System::String ^display;
757
		m_pPi = gcnew PackageInstalled("Enabled/Disabled Packages");
757
		m_pPi = gcnew PackageInstalled("Enabled/Disabled Packages");
758
 
758
 
759
		if ( m_pPackages->GetNumPackagesInDisabledQueue() )
759
		if ( m_pPackages->GetNumPackagesInDisabledQueue() )
760
		{
760
		{
761
			if ( m_pPackages->DisablePreparedPackages(0, 0, &packageList) )
761
			if ( m_pPackages->disablePreparedPackages(0, 0, &packageList) )
762
			{
762
			{
763
				for ( CBaseFile *p = packageList.First(); p; p = packageList.Next() )
763
				for ( CBaseFile *p = packageList.First(); p; p = packageList.Next() )
764
				{
764
				{
765
					m_pPi->AddPackageWithGroup(_US(p->name(m_pPackages->GetLanguage())), _US(p->author()), _US(p->version()), "Disabled", "Disabled Packages");
765
					m_pPi->AddPackageWithGroup(_US(p->name(m_pPackages->GetLanguage())), _US(p->author()), _US(p->version()), "Disabled", "Disabled Packages");
766
					display = "Package Disabled\n\n" + _US(p->getFullPackageName(m_pPackages->GetLanguage()));
766
					display = "Package Disabled\n\n" + _US(p->getFullPackageName(m_pPackages->GetLanguage()));
Line 771... Line 771...
771
		}
771
		}
772
 
772
 
773
		packageList.clear();
773
		packageList.clear();
774
		if ( m_pPackages->GetNumPackagesInEnabledQueue() )
774
		if ( m_pPackages->GetNumPackagesInEnabledQueue() )
775
		{
775
		{
776
			if ( m_pPackages->EnablePreparedPackages(0, 0, &packageList) )
776
			if ( m_pPackages->enablePreparedPackages(0, 0, &packageList) )
777
			{
777
			{
778
				for ( CBaseFile *p = packageList.First(); p; p = packageList.Next() )
778
				for ( CBaseFile *p = packageList.First(); p; p = packageList.Next() )
779
				{
779
				{
780
					m_pPi->AddPackageWithGroup(_US(p->name(m_pPackages->GetLanguage())), _US(p->author()), _US(p->version()), "Enabled", "Enable Packages");
780
					m_pPi->AddPackageWithGroup(_US(p->name(m_pPackages->GetLanguage())), _US(p->author()), _US(p->version()), "Enabled", "Enable Packages");
781
					display = "Package Enabled\n\n" + _US(p->getFullPackageName(m_pPackages->GetLanguage()));
781
					display = "Package Enabled\n\n" + _US(p->getFullPackageName(m_pPackages->GetLanguage()));
Line 795... Line 795...
795
 
795
 
796
	void MainGui::DoInstall(bool builtin, bool frombackground)
796
	void MainGui::DoInstall(bool builtin, bool frombackground)
797
	{
797
	{
798
		CLinkList<CBaseFile> erroredPackages;
798
		CLinkList<CBaseFile> erroredPackages;
799
		CLinkList<CBaseFile> installedPackages;
799
		CLinkList<CBaseFile> installedPackages;
800
		if ( m_pPackages->InstallPreparedPackages(m_pFileErrors, 0, &erroredPackages, &installedPackages) )
800
		if ( m_pPackages->installPreparedPackages(m_pFileErrors, 0, &erroredPackages, &installedPackages) )
801
		{
801
		{
802
			if ( !builtin )
802
			if ( !builtin )
803
			{
803
			{
804
				if ( installedPackages.size() == 1 && erroredPackages.size() == 0 )
804
				if ( installedPackages.size() == 1 && erroredPackages.size() == 0 )
805
				{
805
				{
Line 1115... Line 1115...
1115
 
1115
 
1116
	void MainGui::CloseCurrentDirectory()
1116
	void MainGui::CloseCurrentDirectory()
1117
	{
1117
	{
1118
		if (m_pPackages->IsLoaded())
1118
		if (m_pPackages->IsLoaded())
1119
		{
1119
		{
1120
			if (m_pPackages->CloseDir(0, 0, true))
1120
			if (m_pPackages->closeDir(0, 0, true))
1121
			{
1121
			{
1122
				// write the modname
1122
				// write the modname
1123
				if (!m_pPackages->getModKey().empty())
1123
				if (!m_pPackages->getModKey().empty())
1124
					PluginManager::WriteRegistryValue(m_pPackages->getModKey(), m_pPackages->selectedModName());
1124
					PluginManager::WriteRegistryValue(m_pPackages->getModKey(), m_pPackages->selectedModName());
1125
				m_pPackages->Reset();
1125
				m_pPackages->Reset();
Line 1484... Line 1484...
1484
			{
1484
			{
1485
				// from file
1485
				// from file
1486
				if (p->GetNum() < 0)
1486
				if (p->GetNum() < 0)
1487
				{
1487
				{
1488
					if (m_pPackages->GetEnabledMod())
1488
					if (m_pPackages->GetEnabledMod())
1489
						m_pPackages->DisablePackage(m_pPackages->GetEnabledMod(), 0, 0);
1489
						m_pPackages->disablePackage(m_pPackages->GetEnabledMod(), 0, 0);
1490
					if (this->InstallPackage(_US(p->filename()), true, false, true))
1490
					if (this->InstallPackage(_US(p->filename()), true, false, true))
1491
						reEnable = false;
1491
						reEnable = false;
1492
				}
1492
				}
1493
				// otherwise just enable it
1493
				// otherwise just enable it
1494
				else
1494
				else
Line 1511... Line 1511...
1511
		{
1511
		{
1512
			if (m_pPackages->GetEnabledMod())
1512
			if (m_pPackages->GetEnabledMod())
1513
			{
1513
			{
1514
				CBaseFile *mod = m_pPackages->GetEnabledMod();
1514
				CBaseFile *mod = m_pPackages->GetEnabledMod();
1515
				Utils::String message = mod->getFullPackageName(m_pPackages->GetLanguage());
1515
				Utils::String message = mod->getFullPackageName(m_pPackages->GetLanguage());
1516
				m_pPackages->DisablePackage(m_pPackages->GetEnabledMod(), 0, 0);
1516
				m_pPackages->disablePackage(m_pPackages->GetEnabledMod(), 0, 0);
1517
				this->DisplayMessageBox(false, "Mod Disabed", _US(message) + " has been disabled\nYour game is no longer using any mods\n", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
1517
				this->DisplayMessageBox(false, "Mod Disabed", _US(message) + " has been disabled\nYour game is no longer using any mods\n", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
1518
			}
1518
			}
1519
		}
1519
		}
1520
 
1520
 
1521
		// uninstall the selected mod
1521
		// uninstall the selected mod
Line 1686... Line 1686...
1686
	void MainGui::CheckUnusedShared()
1686
	void MainGui::CheckUnusedShared()
1687
	{
1687
	{
1688
		if ( m_pPackages->AnyUnusedShared() )
1688
		if ( m_pPackages->AnyUnusedShared() )
1689
		{
1689
		{
1690
			if ( this->DisplayMessageBox(false, "Remove Shared Files", "You have some unused shared files, would you like to remove these?", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes)
1690
			if ( this->DisplayMessageBox(false, "Remove Shared Files", "You have some unused shared files, would you like to remove these?", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes)
1691
				m_pPackages->RemoveUnusedSharedFiles();
1691
				m_pPackages->removeUnusedSharedFiles();
1692
		}
1692
		}
1693
	}
1693
	}
1694
 
1694
 
1695
	void MainGui::ChangeDirectoryEvent(System::Object ^Sender, System::EventArgs ^E)
1695
	void MainGui::ChangeDirectoryEvent(System::Object ^Sender, System::EventArgs ^E)
1696
	{
1696
	{
Line 1801... Line 1801...
1801
 
1801
 
1802
		// display any files that failed
1802
		// display any files that failed
1803
		if ( m_iBackgroundTask == MGUI_BACKGROUND_INSTALL )
1803
		if ( m_iBackgroundTask == MGUI_BACKGROUND_INSTALL )
1804
		{
1804
		{
1805
			String ^files = "";
1805
			String ^files = "";
1806
			for ( SStringList *str = m_pFileErrors->;Head(); str; str = str->next )
1806
			for(auto itr = m_pFileErrors->;begin(); itr != m_pFileErrors->end(); itr++)
1807
			{
1807
			{
1808
				if ( str->data.ToInt() == SPKINSTALL_WRITEFILE_FAIL )
1808
				if ((*itr)->data.toInt() == SPKINSTALL_WRITEFILE_FAIL )
1809
				{
1809
				{
1810
					files += "\n";
1810
					files += "\n";
1811
					files += SystemStringFromCyString(str->str);
1811
					files += _US((*itr)->str);
1812
				}
1812
				}
1813
			}
1813
			}
1814
 
1814
 
1815
			if ( files->Length )
1815
			if ( files->Length )
1816
				MessageBox::Show(this, "These files failed to install\n" + files, "Failed Files", MessageBoxButtons::OK, MessageBoxIcon::Warning);
1816
				MessageBox::Show(this, "These files failed to install\n" + files, "Failed Files", MessageBoxButtons::OK, MessageBoxIcon::Warning);
Line 2558... Line 2558...
2558
	{
2558
	{
2559
		FakePatchControl ^fpc = gcnew FakePatchControl(m_pPackages);
2559
		FakePatchControl ^fpc = gcnew FakePatchControl(m_pPackages);
2560
		if ( fpc->ShowDialog(this) == Windows::Forms::DialogResult::OK )
2560
		if ( fpc->ShowDialog(this) == Windows::Forms::DialogResult::OK )
2561
		{
2561
		{
2562
			m_pPackages->ApplyFakePatchOrder(fpc->GetPatchOrder());
2562
			m_pPackages->ApplyFakePatchOrder(fpc->GetPatchOrder());
2563
			m_pPackages->ShuffleFakePatches(0);
2563
			m_pPackages->shuffleFakePatches(0);
2564
		}
2564
		}
2565
	}
2565
	}
2566
 
2566
 
2567
	void MainGui::CheckFakePatchCompatability()
2567
	void MainGui::CheckFakePatchCompatability()
2568
	{
2568
	{
Line 2662... Line 2662...
2662
		}
2662
		}
2663
	}
2663
	}
2664
 
2664
 
2665
	void MainGui::ViewFileLog()
2665
	void MainGui::ViewFileLog()
2666
	{
2666
	{
2667
		if ( m_pFileErrors->Empty() )
2667
		if ( m_pFileErrors->empty() )
2668
			MessageBox::Show(this, "No messages to view in file log", "Empty File Log", MessageBoxButtons::OK, MessageBoxIcon::Warning);
2668
			MessageBox::Show(this, "No messages to view in file log", "Empty File Log", MessageBoxButtons::OK, MessageBoxIcon::Warning);
2669
		else
2669
		else
2670
		{
2670
		{
2671
			FileLog ^log = gcnew FileLog;
2671
			FileLog ^log = gcnew FileLog;
2672
			for ( SStringList *str = m_pFileErrors->;Head(); str; str = str->next )
2672
			for(auto itr = m_pFileErrors->;begin(); itr != m_pFileErrors->end(); itr++)
2673
			{
2673
			{
2674
				bool add = true;
2674
				bool add = true;
2675
				String ^status = "Unknown Error";
2675
				String ^status = "Unknown Error";
2676
				switch(str-&gt;data.GetToken(" ", 1, 1).ToInt())
2676
				switch((*itr)-&gt;data.token(" ", 1).toInt())
2677
				{
2677
				{
2678
					case SPKINSTALL_CREATEDIRECTORY:
2678
					case SPKINSTALL_CREATEDIRECTORY:
2679
						status = "Created Directory";
2679
						status = "Created Directory";
2680
						break;
2680
						break;
2681
					case SPKINSTALL_CREATEDIRECTORY_FAIL:
2681
					case SPKINSTALL_CREATEDIRECTORY_FAIL:
Line 2773... Line 2773...
2773
						break;
2773
						break;
2774
				}
2774
				}
2775
 
2775
 
2776
				if ( add )
2776
				if ( add )
2777
				{
2777
				{
2778
					if ( str->data.NumToken(" ") > 1 )
2778
					if ((*itr)->data.countToken(" ") > 1 )
2779
						log->AddItem(SystemStringFromCyString(str->str.findreplace("~", " => ")), status, _US(SPK::ConvertTimeString((long)str->data.GetToken(" ", 2, 2).ToLong())));
2779
						log->AddItem(_US((*itr)->str.findReplace("~", " => ")), status, _US(SPK::ConvertTimeString((long)(*itr)->data.token(" ", 2).toLong())));
2780
					else
2780
					else
2781
						log->AddItem(SystemStringFromCyString(str->str.findreplace("~", " => ")), status, nullptr);
2781
						log->AddItem(_US((*itr)->str.findReplace("~", " => ")), status, nullptr);
2782
				}
2782
				}
2783
			}
2783
			}
2784
			if ( log->ShowDialog(this) == Windows::Forms::DialogResult::Cancel )
2784
			if ( log->ShowDialog(this) == Windows::Forms::DialogResult::Cancel )
2785
			{
2785
			{
2786
				if ( MessageBox::Show(this, "Are you sure you want to clear the file log?", "Clear File Log", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == Windows::Forms::DialogResult::Yes )
2786
				if ( MessageBox::Show(this, "Are you sure you want to clear the file log?", "Clear File Log", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == Windows::Forms::DialogResult::Yes )
2787
				{
2787
				{
2788
					m_pFileErrors->Clear();
2788
					m_pFileErrors->clear();
2789
					MessageBox::Show(this, "The file log has been cleared", "File Log Cleared", MessageBoxButtons::OK, MessageBoxIcon::Information);
2789
					MessageBox::Show(this, "The file log has been cleared", "File Log Cleared", MessageBoxButtons::OK, MessageBoxIcon::Information);
2790
				}
2790
				}
2791
			}
2791
			}
2792
 
2792
 
2793
		}
2793
		}