diff --git a/setup/DsHidMini.Installer.csproj b/setup/DsHidMini.Installer.csproj index 69464529..d238c04a 100644 --- a/setup/DsHidMini.Installer.csproj +++ b/setup/DsHidMini.Installer.csproj @@ -40,10 +40,11 @@ + - + diff --git a/setup/InstallScript.cs b/setup/InstallScript.cs index a71427b7..85c5427b 100644 --- a/setup/InstallScript.cs +++ b/setup/InstallScript.cs @@ -20,6 +20,7 @@ using Nefarius.Utilities.DeviceManagement.Drivers; using Nefarius.Utilities.DeviceManagement.Exceptions; using Nefarius.Utilities.DeviceManagement.PnP; +using Nefarius.Utilities.WixSharp.Util; using Newtonsoft.Json; @@ -82,7 +83,7 @@ private static void Main() new Dir(driversFeature, "nefcon") { Files = new DirFiles(driversFeature, "*.*").GetFiles(nefconDir), - Dirs = GetSubDirectories(driversFeature, nefconDir).ToArray() + Dirs = WixExt.GetSubDirectories(driversFeature, nefconDir).ToArray() }, new Dir(driversFeature, "drivers", new Files(driversFeature, @"..\artifacts\drivers\*.*"), @@ -198,27 +199,6 @@ private static void ProjectOnAfterInstall(SetupEventArgs e) CustomActions.UninstallDrivers(e.Session); } } - - /// - /// Recursively resolves all subdirectories and their containing files. - /// - private static List GetSubDirectories(Feature feature, string directory) - { - List subDirectoryInfosCollection = new(); - - foreach (string subDirectory in Directory.GetDirectories(directory)) - { - string subDirectoryName = subDirectory.Remove(0, subDirectory.LastIndexOf('\\') + 1); - Dir newDir = - new(feature, subDirectoryName, new Files(feature, subDirectory + @"\*.*")) { Name = subDirectoryName }; - subDirectoryInfosCollection.Add(newDir); - - // Recursively traverse nested directories - GetSubDirectories(feature, subDirectory); - } - - return subDirectoryInfosCollection; - } } public static class CustomActions diff --git a/setup/Util/ArchitectureInfo.cs b/setup/Util/ArchitectureInfo.cs deleted file mode 100644 index 683f7eb5..00000000 --- a/setup/Util/ArchitectureInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace Nefarius.DsHidMini.Setup.Util; - -public static class ArchitectureInfo -{ - public static bool IsArm64 - { - get - { - IntPtr handle = Process.GetCurrentProcess().Handle; - IsWow64Process2(handle, out ushort processMachine, out ushort nativeMachine); - - return nativeMachine == 0xaa64; - } - } - - public static string PlatformShortName => - IsArm64 - ? "arm64" - : RuntimeInformation.OSArchitecture.ToString(); - - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool IsWow64Process2( - IntPtr process, - out ushort processMachine, - out ushort nativeMachine - ); -} \ No newline at end of file diff --git a/setup/Util/FileSystemHelpers.cs b/setup/Util/FileSystemHelpers.cs deleted file mode 100644 index 19daea59..00000000 --- a/setup/Util/FileSystemHelpers.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.IO; - -namespace Nefarius.DsHidMini.Setup.Util; - -public static class FileSystemHelpers -{ - public static string GetTemporaryDirectory() - { - string tempPath = Path.GetTempPath(); - string tempDirectory = Path.Combine(tempPath, Path.GetRandomFileName()); - Directory.CreateDirectory(tempDirectory); - return tempDirectory; - } -} \ No newline at end of file diff --git a/setup/Util/StringExtensions.cs b/setup/Util/StringExtensions.cs deleted file mode 100644 index d7a55d9e..00000000 --- a/setup/Util/StringExtensions.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Nefarius.DsHidMini.Setup.Util; - -public static class StringExtensions -{ - public static bool Contains(this string source, string toCheck, StringComparison comp) - { - return source?.IndexOf(toCheck, comp) >= 0; - } -} \ No newline at end of file