mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
ExtensionManager -> ModListAssociationManager
This commit is contained in:
parent
315b8069a7
commit
0f7c1b4632
@ -90,6 +90,7 @@ namespace Wabbajack.Common
|
||||
|
||||
public static string HashFileExtension => ".xxHash";
|
||||
public static string MetaFileExtension => ".meta";
|
||||
public static string ModListExtension = ".wabbajack";
|
||||
public static string LocalAppDataPath => Path.Combine(KnownFolders.LocalAppData.Path, "Wabbajack");
|
||||
public static string MetricsKeyHeader => "x-metrics-key";
|
||||
|
||||
|
@ -5,15 +5,13 @@ using Microsoft.Win32;
|
||||
|
||||
namespace Wabbajack.Common
|
||||
{
|
||||
public class ExtensionManager
|
||||
public class ModListAssociationManager
|
||||
{
|
||||
[DllImport("Shell32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
public static extern void SHChangeNotify(uint wEventId, uint uFlags, IntPtr dwItem1, IntPtr dwItem2);
|
||||
|
||||
public static string ModListExtension = ".wabbajack";
|
||||
|
||||
private static readonly string ProgIDPath = "Software\\Classes\\Wabbajack";
|
||||
private static readonly string ExtPath = $"Software\\Classes\\{ModListExtension}";
|
||||
private static readonly string ExtPath = $"Software\\Classes\\{Consts.ModListExtension}";
|
||||
|
||||
private static readonly Dictionary<string, string> ProgIDList = new Dictionary<string, string>
|
||||
{
|
@ -361,7 +361,7 @@ namespace Wabbajack.Lib
|
||||
foreach (var file in Directory.EnumerateFiles(path))
|
||||
{
|
||||
if (!File.Exists(file)) continue;
|
||||
if (System.IO.Path.GetExtension(file).Equals(ExtensionManager.ModListExtension))
|
||||
if (System.IO.Path.GetExtension(file).Equals(Consts.ModListExtension))
|
||||
{
|
||||
return ErrorResponse.Fail($"Cannot install into a folder with a Wabbajack ModList inside of it");
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace Wabbajack.Lib
|
||||
if (string.IsNullOrEmpty(ModListName))
|
||||
{
|
||||
ModListName = $"Vortex ModList for {Game.ToString()}";
|
||||
ModListOutputFile = $"{ModListName}{ExtensionManager.ModListExtension}";
|
||||
ModListOutputFile = $"{ModListName}{Consts.ModListExtension}";
|
||||
}
|
||||
|
||||
GameName = Game.MetaData().NexusName;
|
||||
|
@ -38,7 +38,7 @@ namespace Wabbajack.Test
|
||||
var compiler = new MO2Compiler(
|
||||
mo2Folder: utils.MO2Folder,
|
||||
mo2Profile: profile,
|
||||
outputFile: profile + ExtensionManager.ModListExtension);
|
||||
outputFile: profile + Consts.ModListExtension);
|
||||
compiler.ShowReportWhenFinished = false;
|
||||
Assert.IsTrue(await compiler.Begin());
|
||||
return compiler;
|
||||
|
@ -51,7 +51,7 @@ namespace Wabbajack.Test
|
||||
vortexFolder: VortexCompiler.TypicalVortexFolder(),
|
||||
downloadsFolder: VortexCompiler.RetrieveDownloadLocation(utils.Game),
|
||||
stagingFolder: VortexCompiler.RetrieveStagingLocation(utils.Game),
|
||||
outputFile: $"test{ExtensionManager.ModListExtension}");
|
||||
outputFile: $"test{Consts.ModListExtension}");
|
||||
}
|
||||
|
||||
protected async Task<ModList> CompileAndInstall()
|
||||
|
@ -76,7 +76,7 @@ namespace Wabbajack.Test
|
||||
var compiler = new MO2Compiler(
|
||||
mo2Folder: utils.InstallFolder,
|
||||
mo2Profile: profile,
|
||||
outputFile: profile + ExtensionManager.ModListExtension);
|
||||
outputFile: profile + Consts.ModListExtension);
|
||||
compiler.MO2DownloadsFolder = Path.Combine(utils.DownloadsFolder);
|
||||
compiler.ShowReportWhenFinished = false;
|
||||
Assert.IsTrue(await compiler.Begin());
|
||||
@ -165,7 +165,7 @@ namespace Wabbajack.Test
|
||||
var compiler = new MO2Compiler(
|
||||
mo2Folder: utils.MO2Folder,
|
||||
mo2Profile: profile,
|
||||
outputFile: profile + ExtensionManager.ModListExtension);
|
||||
outputFile: profile + Consts.ModListExtension);
|
||||
compiler.ShowReportWhenFinished = false;
|
||||
Assert.IsTrue(await compiler.Begin());
|
||||
return compiler;
|
||||
|
@ -47,7 +47,7 @@ namespace Wabbajack.Test
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"ModOrganizer.exe"));
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"modlist{ExtensionManager.ModListExtension}"));
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"modlist{Consts.ModListExtension}"));
|
||||
Assert.IsFalse(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName, downloadFolder: null).Succeeded);
|
||||
}
|
||||
}
|
||||
|
@ -168,11 +168,11 @@ namespace Wabbajack
|
||||
string outputFile;
|
||||
if (string.IsNullOrWhiteSpace(Parent.OutputLocation.TargetPath))
|
||||
{
|
||||
outputFile = MOProfile + ExtensionManager.ModListExtension;
|
||||
outputFile = MOProfile + Consts.ModListExtension;
|
||||
}
|
||||
else
|
||||
{
|
||||
outputFile = Path.Combine(Parent.OutputLocation.TargetPath, MOProfile + ExtensionManager.ModListExtension);
|
||||
outputFile = Path.Combine(Parent.OutputLocation.TargetPath, MOProfile + Consts.ModListExtension);
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -179,7 +179,7 @@ namespace Wabbajack
|
||||
|
||||
public async Task<bool> Compile()
|
||||
{
|
||||
string outputFile = $"{ModlistSettings.ModListName}{ExtensionManager.ModListExtension}";
|
||||
string outputFile = $"{ModlistSettings.ModListName}{Consts.ModListExtension}";
|
||||
if (!string.IsNullOrWhiteSpace(Parent.OutputLocation.TargetPath))
|
||||
{
|
||||
outputFile = Path.Combine(Parent.OutputLocation.TargetPath, outputFile);
|
||||
|
@ -52,7 +52,7 @@ namespace Wabbajack
|
||||
{
|
||||
_parent = parent;
|
||||
Metadata = metadata;
|
||||
Location = Path.Combine(Consts.ModListDownloadFolder, Metadata.Links.MachineURL + ExtensionManager.ModListExtension);
|
||||
Location = Path.Combine(Consts.ModListDownloadFolder, Metadata.Links.MachineURL + Consts.ModListExtension);
|
||||
IsBroken = metadata.ValidationSummary.HasFailures;
|
||||
OpenWebsiteCommand = ReactiveCommand.Create(() => Process.Start($"https://www.wabbajack.org/modlist/{Metadata.Links.MachineURL}"));
|
||||
ExecuteCommand = ReactiveCommand.CreateFromObservable<Unit, Unit>(
|
||||
|
@ -27,7 +27,7 @@ namespace Wabbajack
|
||||
if (string.IsNullOrWhiteSpace(path)
|
||||
|| !File.Exists(path))
|
||||
{
|
||||
path = UIUtils.OpenFileDialog($"*{ExtensionManager.ModListExtension}|*{ExtensionManager.ModListExtension}");
|
||||
path = UIUtils.OpenFileDialog($"*{Consts.ModListExtension}|*{Consts.ModListExtension}");
|
||||
}
|
||||
_mainVM.OpenInstaller(path);
|
||||
});
|
||||
|
@ -36,9 +36,9 @@ namespace Wabbajack
|
||||
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
try
|
||||
{
|
||||
if (!ExtensionManager.IsAssociated() || ExtensionManager.NeedsUpdating(appPath))
|
||||
if (!ModListAssociationManager.IsAssociated() || ModListAssociationManager.NeedsUpdating(appPath))
|
||||
{
|
||||
ExtensionManager.Associate(appPath);
|
||||
ModListAssociationManager.Associate(appPath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
Loading…
Reference in New Issue
Block a user