Merge pull request #232 from erri120/vortex-installer-fixes

Assortement of Vortex Installer fixes
This commit is contained in:
Timothy Baldridge 2019-12-03 06:06:38 -07:00 committed by GitHub
commit 97ec9c9d0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,6 @@
using System.Linq; using System.Diagnostics;
using System.Linq;
using System.Windows;
using Wabbajack.Common; using Wabbajack.Common;
using Directory = Alphaleonis.Win32.Filesystem.Directory; using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File; using File = Alphaleonis.Win32.Filesystem.File;
@ -29,6 +31,12 @@ namespace Wabbajack.Lib
protected override bool _Begin() protected override bool _Begin()
{ {
MessageBox.Show(
"Vortex Support is still experimental and may produce unexpected results. " +
"If anything fails go to the special vortex support channels on the discord. @erri120#2285 " +
"for support.", "Warning",
MessageBoxButton.OK);
ConfigureProcessor(10, RecommendQueueSize()); ConfigureProcessor(10, RecommendQueueSize());
Directory.CreateDirectory(DownloadFolder); Directory.CreateDirectory(DownloadFolder);
@ -52,12 +60,58 @@ namespace Wabbajack.Lib
BuildFolderStructure(); BuildFolderStructure();
InstallArchives(); InstallArchives();
InstallIncludedFiles(); InstallIncludedFiles();
InstallSteamWorkshopItems();
//InstallIncludedDownloadMetas(); //InstallIncludedDownloadMetas();
Info("Installation complete! You may exit the program."); Info("Installation complete! You may exit the program.");
return true; return true;
} }
private void InstallSteamWorkshopItems()
{
//var currentLib = "";
SteamGame currentSteamGame = null;
SteamHandler.Instance.Games.Where(g => g.Game == GameInfo.Game).Do(s => currentSteamGame = s);
/*SteamHandler.Instance.InstallFolders.Where(f => f.Contains(currentSteamGame.InstallDir)).Do(s => currentLib = s);
var downloadFolder = Path.Combine(currentLib, "workshop", "downloads", currentSteamGame.AppId.ToString());
var contentFolder = Path.Combine(currentLib, "workshop", "content", currentSteamGame.AppId.ToString());
*/
if (!ModList.Directives.Any(s => s is SteamMeta))
return;
var result = MessageBox.Show("The ModList you are installing requires Steam Workshop Items to exist. " +
"You can check the Workshop Items in the manifest of this ModList. Wabbajack can start Steam for you " +
"and download the Items automatically. Do you want to proceed with this step?",
"Warning", MessageBoxButton.YesNo);
if (result != MessageBoxResult.Yes)
return;
ModList.Directives.OfType<SteamMeta>()
.PMap(Queue, item =>
{
Status("Extracting Steam meta file to temp folder");
var path = Path.Combine(DownloadFolder, $"steamWorkshopItem_{item.ItemID}.meta");
if (!File.Exists(path))
File.WriteAllBytes(path, LoadBytesFromPath(item.SourceDataID));
Status("Downloading Steam Workshop Item through steam cmd");
var p = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = System.IO.Path.Combine(SteamHandler.Instance.SteamPath, "steam.exe"),
CreateNoWindow = true,
Arguments = $"console +workshop_download_item {currentSteamGame.AppId} {item.ItemID}"
}
};
p.Start();
});
}
private void InstallIncludedFiles() private void InstallIncludedFiles()
{ {
Info("Writing inline files"); Info("Writing inline files");