mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Archives tagged with WABBAJACK_VORTEX_MANUAL will now be correctly detected and added to the modlist
This commit is contained in:
parent
97b3296fb9
commit
bc8dc65f29
@ -30,6 +30,7 @@ namespace Wabbajack.Common
|
|||||||
public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE";
|
public static string WABBAJACK_INCLUDE = "WABBAJACK_INCLUDE";
|
||||||
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
|
public static string WABBAJACK_ALWAYS_ENABLE = "WABBAJACK_ALWAYS_ENABLE";
|
||||||
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
public static string WABBAJACK_NOMATCH_INCLUDE = "WABBAJACK_NOMATCH_INCLUDE";
|
||||||
|
public static string WABBAJACK_VORTEX_MANUAL = "WABBAJACK_VORTEX_MANUAL";
|
||||||
|
|
||||||
public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}";
|
public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}";
|
||||||
public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}";
|
public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}";
|
||||||
|
@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using DynamicData;
|
||||||
using Microsoft.WindowsAPICodePack.Shell;
|
using Microsoft.WindowsAPICodePack.Shell;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Wabbajack.Common;
|
using Wabbajack.Common;
|
||||||
@ -151,6 +152,40 @@ namespace Wabbajack.Lib
|
|||||||
Error($"Found {duplicates.Count} duplicates, exiting");
|
Error($"Found {duplicates.Count} duplicates, exiting");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < AllFiles.Count; i++)
|
||||||
|
{
|
||||||
|
var f = AllFiles[i];
|
||||||
|
if (!f.Path.StartsWith(Consts.GameFolderFilesDir) || !IndexedFiles.ContainsKey(f.Hash))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!IndexedFiles.TryGetValue(f.Hash, out var value))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var element = value.ElementAt(0);
|
||||||
|
|
||||||
|
if (!f.Path.Contains(element.Name))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
IndexedArchive targetArchive = null;
|
||||||
|
IndexedArchives.Where(a => a.File.Children.Contains(element)).Do(a => targetArchive = a);
|
||||||
|
|
||||||
|
if (targetArchive == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(targetArchive.IniData?.General?.tag == null || targetArchive.IniData?.General?.tag != Consts.WABBAJACK_VORTEX_MANUAL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Utils.Log($"Double hash for: {f.AbsolutePath}");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
var replace = f;
|
||||||
|
replace.Path = Path.Combine("Manual Game Files", element.FullPath.Substring(DownloadsFolder.Length + 1).Replace('|', '\\'));
|
||||||
|
AllFiles.RemoveAt(i);
|
||||||
|
AllFiles.Insert(i, replace);
|
||||||
|
//AllFiles.Replace(f, replace);
|
||||||
|
}
|
||||||
|
|
||||||
var stack = MakeStack();
|
var stack = MakeStack();
|
||||||
|
|
||||||
Info("Running Compilation Stack");
|
Info("Running Compilation Stack");
|
||||||
@ -246,7 +281,11 @@ namespace Wabbajack.Lib
|
|||||||
VortexDeployment.files.Do(f =>
|
VortexDeployment.files.Do(f =>
|
||||||
{
|
{
|
||||||
var archive = f.source;
|
var archive = f.source;
|
||||||
if(!ActiveArchives.Contains(archive)) ActiveArchives.Add(archive);
|
if (ActiveArchives.Contains(archive))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Utils.Log($"Adding Archive {archive} to ActiveArchives");
|
||||||
|
ActiveArchives.Add(archive);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,14 +353,32 @@ namespace Wabbajack.Lib
|
|||||||
ActiveArchives.Contains(Path.GetFileNameWithoutExtension(f)))
|
ActiveArchives.Contains(Path.GetFileNameWithoutExtension(f)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Utils.Log($"File {f} is not in ActiveArchives, checking if the archive is not from the Nexus");
|
Utils.Log($"File {f} is not in ActiveArchives");
|
||||||
var lines = File.ReadAllLines(f);
|
var lines = File.ReadAllLines(f);
|
||||||
if (lines.Length == 0 || !lines.Any(line => line.Contains("directURL=")))
|
if (lines.Length == 0 || !lines.Any(line => line.Contains("directURL=")))
|
||||||
|
{
|
||||||
|
if (lines.Length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
lines.Do(line =>
|
||||||
|
{
|
||||||
|
var tag = "";
|
||||||
|
if (line.Contains("tag="))
|
||||||
|
tag = line.Substring("tag=".Length);
|
||||||
|
|
||||||
|
if (tag != Consts.WABBAJACK_VORTEX_MANUAL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Utils.Log($"File {f} contains the {Consts.WABBAJACK_VORTEX_MANUAL} tag, adding to ActiveArchives");
|
||||||
|
ActiveArchives.Add(Path.GetFileNameWithoutExtension(f));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Utils.Log($"File {f} appears to not come from the Nexus, adding to ActiveArchives");
|
Utils.Log($"File {f} appears to not come from the Nexus, adding to ActiveArchives");
|
||||||
ActiveArchives.Add(Path.GetFileNameWithoutExtension(f));
|
ActiveArchives.Add(Path.GetFileNameWithoutExtension(f));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.Log($"Checking for Steam Workshop Items...");
|
Utils.Log($"Checking for Steam Workshop Items...");
|
||||||
@ -330,6 +387,13 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
_steamGame.WorkshopItems.Do(item =>
|
_steamGame.WorkshopItems.Do(item =>
|
||||||
{
|
{
|
||||||
|
var filePath = Path.Combine(DownloadsFolder, $"steamWorkshopItem_{item.ItemID}.meta");
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
Utils.Log($"File {filePath} already exists, skipping...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Utils.Log($"Creating meta file for {item.ItemID}");
|
Utils.Log($"Creating meta file for {item.ItemID}");
|
||||||
var metaString = "[General]\n" +
|
var metaString = "[General]\n" +
|
||||||
"repository=Steam\n" +
|
"repository=Steam\n" +
|
||||||
@ -338,14 +402,6 @@ namespace Wabbajack.Lib
|
|||||||
$"steamID={_steamGame.AppId}\n" +
|
$"steamID={_steamGame.AppId}\n" +
|
||||||
$"itemID={item.ItemID}\n" +
|
$"itemID={item.ItemID}\n" +
|
||||||
$"itemSize={item.Size}\n";
|
$"itemSize={item.Size}\n";
|
||||||
|
|
||||||
var filePath = Path.Combine(DownloadsFolder, $"steamWorkshopItem_{item.ItemID}.meta");
|
|
||||||
if (File.Exists(filePath))
|
|
||||||
{
|
|
||||||
Utils.Log($"File {filePath} already exists, skipping...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.WriteAllText(filePath, metaString);
|
File.WriteAllText(filePath, metaString);
|
||||||
|
Loading…
Reference in New Issue
Block a user