mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #398 from erri120/mo2-stuff
Re-pathing and MO2 Output overwrite fixes
This commit is contained in:
commit
3f5b5ab357
@ -27,7 +27,7 @@ namespace Wabbajack.Common
|
||||
|
||||
public static HashSet<string> SupportedBSAs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".bsa", ".ba2"};
|
||||
|
||||
public static HashSet<string> ConfigFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".json", ".ini", ".yml"};
|
||||
public static HashSet<string> ConfigFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".json", ".ini", ".yml", ".xml"};
|
||||
public static HashSet<string> ESPFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".esp", ".esm", ".esl"};
|
||||
public static HashSet<string> AssetFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {".dds", ".tga", ".nif", ".psc", ".pex"};
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using IniParser;
|
||||
@ -16,7 +15,7 @@ namespace Wabbajack.Common
|
||||
|
||||
public DynamicIniData(IniData value) //
|
||||
{
|
||||
this._value = value;
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public static dynamic FromIni(IniData data)
|
||||
@ -37,19 +36,19 @@ namespace Wabbajack.Common
|
||||
}
|
||||
}
|
||||
|
||||
internal class SectionData : DynamicObject
|
||||
public class SectionData : DynamicObject
|
||||
{
|
||||
private readonly KeyDataCollection _coll;
|
||||
public KeyDataCollection Coll { get; }
|
||||
|
||||
public SectionData(KeyDataCollection coll)
|
||||
{
|
||||
_coll = coll;
|
||||
Coll = coll;
|
||||
}
|
||||
|
||||
public override bool TryGetMember(GetMemberBinder binder, out object result)
|
||||
{
|
||||
result = _coll[binder.Name];
|
||||
if (result is string) result = Interpret((string)result);
|
||||
result = Coll[binder.Name];
|
||||
if (result is string s) result = Interpret(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -70,7 +69,7 @@ namespace Wabbajack.Common
|
||||
|
||||
private static string UnescapeUTF8(string s)
|
||||
{
|
||||
List<byte> acc = new List<byte>();
|
||||
var acc = new List<byte>();
|
||||
for (var i = 0; i < s.Length; i++)
|
||||
{
|
||||
var c = s[i];
|
||||
@ -109,8 +108,8 @@ namespace Wabbajack.Common
|
||||
return false;
|
||||
}
|
||||
|
||||
result = _coll[(string) indexes[0]];
|
||||
if (result is string) result = Regex.Unescape(((string)result).Trim('"'));
|
||||
result = Coll[(string) indexes[0]];
|
||||
if (result is string s) result = Regex.Unescape(s.Trim('"'));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ using Wabbajack.Lib.Validation;
|
||||
using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||
using SectionData = Wabbajack.Common.SectionData;
|
||||
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
@ -45,7 +46,7 @@ namespace Wabbajack.Lib
|
||||
if (cancel.IsCancellationRequested) return false;
|
||||
var metric = Metrics.Send("begin_install", ModList.Name);
|
||||
|
||||
ConfigureProcessor(19, ConstructDynamicNumThreads(await RecommendQueueSize()));
|
||||
ConfigureProcessor(20, ConstructDynamicNumThreads(await RecommendQueueSize()));
|
||||
var game = ModList.GameType.MetaData();
|
||||
|
||||
if (GameFolder == null)
|
||||
@ -139,6 +140,9 @@ namespace Wabbajack.Lib
|
||||
UpdateTracker.NextStep("Set MO2 into portable");
|
||||
ForcePortable();
|
||||
|
||||
UpdateTracker.NextStep("Create Empty Output Mods");
|
||||
CreateOutputMods();
|
||||
|
||||
UpdateTracker.NextStep("Updating System-specific ini settings");
|
||||
SetScreenSizeInPrefs();
|
||||
|
||||
@ -148,6 +152,38 @@ namespace Wabbajack.Lib
|
||||
return true;
|
||||
}
|
||||
|
||||
private void CreateOutputMods()
|
||||
{
|
||||
Directory.EnumerateFiles(Path.Combine(OutputFolder, "profiles"), "settings.ini", DirectoryEnumerationOptions.Recursive).Do(f =>
|
||||
{
|
||||
var ini = f.LoadIniFile();
|
||||
if (ini == null)
|
||||
{
|
||||
Utils.Log($"settings.ini is null for {f}, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
var overwrites = ini.custom_overwrites;
|
||||
if (overwrites == null)
|
||||
{
|
||||
Utils.Log("No custom overwrites found, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
if (overwrites is SectionData data)
|
||||
{
|
||||
data.Coll.Do(keyData =>
|
||||
{
|
||||
var v = keyData.Value;
|
||||
var mod = Path.Combine(OutputFolder, "mods", v);
|
||||
|
||||
if (!Directory.Exists(mod))
|
||||
Directory.CreateDirectory(mod);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ForcePortable()
|
||||
{
|
||||
var path = Path.Combine(OutputFolder, "portable.txt");
|
||||
|
Loading…
Reference in New Issue
Block a user