mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
ExtensionManager: Added NeedsUpating function
This commit is contained in:
parent
74d16ed8b7
commit
a12faee21e
@ -28,6 +28,14 @@ namespace Wabbajack.Common
|
||||
{"PerceivedType", "Compressed"}
|
||||
};
|
||||
|
||||
public static bool NeedsUpdating(string appPath)
|
||||
{
|
||||
var progIDKey = Registry.CurrentUser.OpenSubKey(ProgIDPath);
|
||||
var tempKey = progIDKey?.OpenSubKey("shell\\open\\command");
|
||||
if (progIDKey == null || tempKey == null) return true;
|
||||
return tempKey.GetValue("").ToString().Equals($"\"{appPath}\" -i \"%1\"");
|
||||
}
|
||||
|
||||
public static bool IsAssociated(string appPath)
|
||||
{
|
||||
var progIDKey = Registry.CurrentUser.OpenSubKey(ProgIDPath);
|
||||
|
@ -86,17 +86,7 @@ namespace Wabbajack
|
||||
}
|
||||
|
||||
var appPath = Assembly.GetExecutingAssembly().Location;
|
||||
var iconPath = Path.Combine(Path.GetDirectoryName(appPath), "wabbajack.ico");
|
||||
if(!File.Exists(iconPath))
|
||||
{
|
||||
using (var s = Utils.GetResourceStream("Wabbajack.UI.Icons.icon-embedded.ico"))
|
||||
using (var fs = new FileStream(iconPath, FileMode.Create))
|
||||
{
|
||||
s.CopyTo(fs);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ExtensionManager.IsAssociated(appPath))
|
||||
if (!(ExtensionManager.IsAssociated(appPath) || ExtensionManager.NeedsUpdating(appPath)))
|
||||
{
|
||||
ExtensionManager.Associate(appPath);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user