diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da534e1d5..d347d6c92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: Platform: ${{ matrix.platform }} DOTNET_INSTALL_DIR: '.\.dotnet' DOTNET_VERSION: '9.x' - DOTNET_QUALITY: 'preview' + DOTNET_QUALITY: 'ga' NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages steps: @@ -71,7 +71,7 @@ jobs: Platform: ${{ matrix.platform }} DOTNET_INSTALL_DIR: '.\.dotnet' DOTNET_VERSION: '9.x' - DOTNET_QUALITY: 'preview' + DOTNET_QUALITY: 'ga' NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages steps: diff --git a/CollapseLauncher/Classes/Helper/TaskSchedulerHelper.cs b/CollapseLauncher/Classes/Helper/TaskSchedulerHelper.cs index 7ec93d52b..47a3f515e 100644 --- a/CollapseLauncher/Classes/Helper/TaskSchedulerHelper.cs +++ b/CollapseLauncher/Classes/Helper/TaskSchedulerHelper.cs @@ -1,4 +1,6 @@ -using Hi3Helper; +using CollapseLauncher.ShellLinkCOM; +using Hi3Helper; +using Hi3Helper.Data; using Hi3Helper.Shared.Region; using System; using System.Diagnostics; @@ -140,8 +142,11 @@ private static void AppendTaskNameAndPathArgument(StringBuilder argumentBuilder) argumentBuilder.Append('"'); } - internal static async Task RecreateIconShortcuts() + internal static void RecreateIconShortcuts() { + /* Invocation from Hi3Helper.TaskScheduler is no longer being user. + * Moving to Main App's ShellLink implementation instead! + // Build the argument and get the current executable path StringBuilder argumentBuilder = new StringBuilder(); argumentBuilder.Append("RecreateIcons"); @@ -160,6 +165,51 @@ internal static async Task RecreateIconShortcuts() // Print init determination CheckInitDetermination(returnCode); + */ + + // Get current executable path as its target. + string currentExecPath = LauncherConfig.AppExecutablePath; + string workingDirPath = Path.GetDirectoryName(currentExecPath); + + // Get exe's description + FileVersionInfo currentExecVersionInfo = FileVersionInfo.GetVersionInfo(currentExecPath); + string currentExecDescription = currentExecVersionInfo.FileDescription ?? ""; + + // Create shell link instance and save the shortcut under Desktop and User's Start menu + using ShellLink shellLink = new ShellLink() + { + IconIndex = 0, + IconPath = currentExecPath, + DisplayMode = LinkDisplayMode.edmNormal, + WorkingDirectory = workingDirPath, + Target = currentExecPath, + Description = currentExecDescription + }; + + // Get paths + string shortcutFilename = currentExecVersionInfo.ProductName + ".lnk"; + string startMenuLocation = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu); + string desktopLocation = Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory); + string iconLocationStartMenu = Path.Combine( + startMenuLocation, + "Programs", + currentExecVersionInfo.CompanyName, + shortcutFilename); + string iconLocationDesktop = Path.Combine( + desktopLocation, + shortcutFilename); + + // Get icon location directory + string iconLocationStartMenuDir = Path.GetDirectoryName(iconLocationStartMenu); + string iconLocationDesktopDir = Path.GetDirectoryName(iconLocationDesktop); + + // Try create directory + Directory.CreateDirectory(iconLocationStartMenuDir); + Directory.CreateDirectory(iconLocationDesktopDir); + + // Save the icons + shellLink.Save(iconLocationStartMenu); + shellLink.Save(iconLocationDesktop); } private static async Task GetInvokeCommandReturnCode(string argument) diff --git a/CollapseLauncher/Classes/ShellLinkCOM/Enums.cs b/CollapseLauncher/Classes/ShellLinkCOM/Enums.cs index 5f898256c..0c8261fe6 100644 --- a/CollapseLauncher/Classes/ShellLinkCOM/Enums.cs +++ b/CollapseLauncher/Classes/ShellLinkCOM/Enums.cs @@ -50,6 +50,13 @@ public enum SHGetFileInfoConstants : int SHGFI_OVERLAYINDEX = 0x000000040 // Get the index of the overlay } + public enum LinkDisplayMode : uint + { + edmNormal = EShowWindowFlags.SW_NORMAL, + edmMinimized = EShowWindowFlags.SW_SHOWMINNOACTIVE, + edmMaximized = EShowWindowFlags.SW_MAXIMIZE + } + /// /// Flags determining how the links with missing /// targets are resolved. diff --git a/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs b/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs index 593c94062..605bb8282 100644 --- a/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs +++ b/CollapseLauncher/Classes/ShellLinkCOM/ShellLink.cs @@ -9,18 +9,11 @@ #pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type namespace CollapseLauncher.ShellLinkCOM { + unsafe delegate void ToDelegateInvoke(char* buffer, int length); + unsafe delegate void ToDelegateWithW32FindDataInvoke(char* buffer, nint findDataPtr, int length); + public class ShellLink : IDisposable { - private unsafe delegate void ToDelegateInvoke(char* buffer, int length); - private unsafe delegate void ToDelegateWithW32FindDataInvoke(char* buffer, nint findDataPtr, int length); - - public enum LinkDisplayMode : uint - { - edmNormal = EShowWindowFlags.SW_NORMAL, - edmMinimized = EShowWindowFlags.SW_SHOWMINNOACTIVE, - edmMaximized = EShowWindowFlags.SW_MAXIMIZE - } - // Use Unicode (W) under NT, otherwise use ANSI IShellLinkW? linkW; IPersistFile? persistFileW; @@ -87,14 +80,9 @@ public IntPtr GetIcon(bool large) SHGetFileInfoConstants flags = SHGetFileInfoConstants.SHGFI_ICON | SHGetFileInfoConstants.SHGFI_ATTRIBUTES; - if (large) - { - flags = flags | SHGetFileInfoConstants.SHGFI_LARGEICON; - } - else - { - flags = flags | SHGetFileInfoConstants.SHGFI_SMALLICON; - } + + flags = flags | (large ? SHGetFileInfoConstants.SHGFI_LARGEICON : SHGetFileInfoConstants.SHGFI_SMALLICON); + FileIcon fileIcon = new FileIcon(Target, flags); return fileIcon.ShellIcon; } diff --git a/CollapseLauncher/CollapseLauncher.csproj b/CollapseLauncher/CollapseLauncher.csproj index ca0153407..cdf8fb17a 100644 --- a/CollapseLauncher/CollapseLauncher.csproj +++ b/CollapseLauncher/CollapseLauncher.csproj @@ -21,7 +21,7 @@ x64 net9.0-windows10.0.22621.0 - 10.0.22621.48 + 10.0.22621.57 10.0.17763.0 win-x64 true @@ -140,6 +140,10 @@ --> + + + + @@ -159,27 +163,27 @@ - + - + - + - - - + + + diff --git a/CollapseLauncher/Program.cs b/CollapseLauncher/Program.cs index 65912fde4..009c4b0a9 100644 --- a/CollapseLauncher/Program.cs +++ b/CollapseLauncher/Program.cs @@ -1,7 +1,9 @@ -using CollapseLauncher.Helper; +using CollapseLauncher.Helper; using CollapseLauncher.Helper.Update; +using CollapseLauncher.ShellLinkCOM; using Hi3Helper; using Hi3Helper.SentryHelper; +using Hi3Helper.Data; using Hi3Helper.Http.Legacy; using Hi3Helper.Shared.ClassStruct; using InnoSetupHelper; @@ -18,6 +20,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; +using System.Linq; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; @@ -318,13 +321,17 @@ private static void StartUpdaterHook() public static void TryCleanupFallbackUpdate(SemanticVersion newVersion) { string currentExecutedAppFolder = AppFolder.TrimEnd('\\'); + string currentExecutedPath = AppExecutablePath; + string currentExecutedFilename = Path.GetFileName(currentExecutedPath); // If the path is not actually running under "current" velopack folder, then return +#if !DEBUG if (!currentExecutedAppFolder.EndsWith("current", StringComparison.OrdinalIgnoreCase)) // Expecting "current" { Logger.LogWriteLine("[TryCleanupFallbackUpdate] The launcher does not run from \"current\" folder"); return; } +#endif try { @@ -374,8 +381,35 @@ public static void TryCleanupFallbackUpdate(SemanticVersion newVersion) } } + // Try to delete all possible shortcuts on any users (since the shortcut used will be the global one) + string currentUsersDirPath = Path.Combine(currentWindowsPathDrive, "Users"); + foreach (string userDirInfoPath in Directory + .EnumerateDirectories(currentUsersDirPath, "*", SearchOption.TopDirectoryOnly) + .Where(ConverterTool.IsUserHasPermission)) + { + // Get the shortcut file + string thisUserStartMenuShortcut = Path.Combine(userDirInfoPath, @"AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Collapse.lnk"); + if (File.Exists(thisUserStartMenuShortcut)) + { + // Try open the shortcut and check whether this shortcut is actually pointing to + // CollapseLauncher.exe file + using (ShellLink shellLink = new ShellLink(thisUserStartMenuShortcut)) + { + // Try get the target path and its filename + string shortcutTargetPath = shellLink.Target; + string shortcutTargetFilename = Path.GetFileName(shortcutTargetPath); + + // Compare if the filename is equal, then delete it. + if (shortcutTargetFilename.Equals(currentExecutedFilename, StringComparison.OrdinalIgnoreCase)) + File.Delete(thisUserStartMenuShortcut); + + LogWriteLine($"[TryCleanupFallbackUpdate] Deleted old shortcut located at: {thisUserStartMenuShortcut} -> {shortcutTargetPath}", LogType.Default, true); + } + } + } + // Try to recreate shortcuts - TaskSchedulerHelper.RecreateIconShortcuts().GetAwaiter().GetResult(); + TaskSchedulerHelper.RecreateIconShortcuts(); } catch (Exception ex) { @@ -410,13 +444,13 @@ public static string FindCollapseStubPath() LogType.Default, true); return collapseMainPath; } - + private static async Task CheckRuntimeFeatures() { try { await Task.Run(() => - { + { // RuntimeFeature docs https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.runtimefeature?view=net-9.0 LogWriteLine($"Available Runtime Features:\r\n\t" + $"PortablePdb: {RuntimeFeature.IsSupported(RuntimeFeature.PortablePdb)}\r\n\t" + @@ -506,7 +540,7 @@ public static string GetVersionString() return $"Windows 11 (build: {version.Build}.{version.Revision})"; return $"Windows {version.Major} (build: {version.Build}.{version.Revision})"; } - + public static string MD5Hash(string path) { if (!File.Exists(path)) diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml index 63e672f2b..d6e36415c 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml +++ b/CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml @@ -519,7 +519,7 @@ PointerExited="ElementScaleInHoveredPointerExited" Shadow="{ThemeResource SharedShadow}" Style="{ThemeResource AcrylicSemiButtonStyle}" - Tag="{x:Bind Url, Mode=OneWay}" + Tag="{x:Bind Url}" Translation="0,0,8"> @@ -532,7 +532,7 @@ VerticalAlignment="Center" FontWeight="Medium" HorizontalTextAlignment="Left" - Text="{x:Bind Title, Mode=OneWay}" /> + Text="{x:Bind Title}" /> + Source="{x:Bind IconImg}" /> + Source="{x:Bind IconImgHover}" /> @@ -707,7 +707,7 @@ HorizontalAlignment="Right" Visibility="{x:Bind IsPostEventPanelEmpty}"> - - - + Text="{x:Bind text}" /> diff --git a/CollapseLauncher/packages.lock.json b/CollapseLauncher/packages.lock.json index 491573309..d638ed7b6 100644 --- a/CollapseLauncher/packages.lock.json +++ b/CollapseLauncher/packages.lock.json @@ -95,9 +95,9 @@ }, "HtmlAgilityPack": { "type": "Direct", - "requested": "[1.11.70, )", - "resolved": "1.11.70", - "contentHash": "lwCgdq4H+WXH+lkM7TvJhyEs5uNGzoTud1VmXz2jr30/yOTRtG/oMCour5JMTN0t0fU4uFwFYIrDd98FH2RKsQ==" + "requested": "[1.11.71, )", + "resolved": "1.11.71", + "contentHash": "HlEThQBnob4/29DIiyrPSYlGXXSZUtOH7571PRev+yu8FW8n5pdxqHyun+PMm17cp3ovCrxFhXedC+1HUSdRMA==" }, "Libsql.Client": { "type": "Direct", @@ -111,6 +111,21 @@ "resolved": "0.38.0", "contentHash": "zfi6kNm5QJnsCGm5a0hMG2qw8juYbOfsS4c1OuTcqkbYQUCdkam6d6Nt7nPIrbV4D+U7sHChidSQlg+ViiMPuw==" }, + "Microsoft.Extensions.DependencyInjection.Abstractions": { + "type": "Direct", + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "+6f2qv2a3dLwd5w6JanPIPs47CxRbnk+ZocMJUhv9NxP88VlOcJYZs9jY+MYSjxvady08bUZn6qgiNh7DadGgg==" + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "Direct", + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "g0UfujELzlLbHoVG8kPKVBaW470Ewi+jnptGS9KUi6jcb+k2StujtK3m26DFSGGwQ/+bVgZfsWqNzlP6YOejvw==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "9.0.0" + } + }, "Microsoft.Graphics.Win2D": { "type": "Direct", "requested": "[1.3.0, )", @@ -140,9 +155,9 @@ }, "Microsoft.Windows.CsWinRT": { "type": "Direct", - "requested": "[2.1.6, )", - "resolved": "2.1.6", - "contentHash": "k5G30dezZjGnGyLokTkj+yBX9gyAhDSm8pY7MqEUX1Dorl4GfSywfodOA8wmhFaNuUd4OI6q1MuQQaxQIA/t0w==" + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "R8MDVawukHrKgYCFgYaoLfbAna/FrImEFRxDK9k8ITbrXv3KLE5uN6tRqrNV83H4MFdqJ/uiA/hg1cSsXkl0vw==" }, "Microsoft.Windows.SDK.BuildTools": { "type": "Direct", @@ -192,9 +207,9 @@ }, "runtime.win-x64.Microsoft.DotNet.ILCompiler": { "type": "Direct", - "requested": "[9.0.0-rc.2.24473.5, )", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "gtZORh0O2hlNn8D+ezseJs1SEAI83Ca+LC8vmAIqaYUbiAn5+6iqD+ytuztGo4Thjr/2qWXKn3l7GGQEQiCJMg==" + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "oDIioFi3rPT79AS5TSEwU/nlqINeJwxG5yKG/BLY57an5PV+btlPBGJgOjI3d8/BdTpKmsd9pdavm/4ENq5M/A==" }, "Sentry": { "type": "Direct", @@ -244,21 +259,21 @@ }, "System.Security.Cryptography.ProtectedData": { "type": "Direct", - "requested": "[9.0.0-rc.2.24473.5, )", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "WmEKZcNdOoUSEVQVTs8LsD0WdnliOij0G4s9ljfVTFekI82JWk3WfvlpFzDsc7sXO12w/ckXrkaaRkiUBT8Gyw==" + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "CJW+x/F6fmRQ7N6K8paasTw9PDZp4t7G76UjGNlSDgoHPF0h08vTzLYbLZpOLEJSg35d5wy2jCXGo84EN05DpQ==" }, "System.Text.Encoding.CodePages": { "type": "Direct", - "requested": "[9.0.0-rc.2.24473.5, )", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "H1e56lFcgmKStcHlfRZQHn0Ck4Lb2BQIMbTrIq+5CT3LLn8uyL9R7kSM0RtYaIoOl5bD5NvGXjNQvReNY1siAA==" + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "GxJTSFPQpoVd0vQRgq8hwesicxgZoHTbYMvR/UMM4IzhkHMT+ebZE11c2C1gUyxz55zWtGCWktMTHvmgLzob9g==" }, "System.Text.Json": { "type": "Direct", - "requested": "[9.0.0-rc.2.24473.5, )", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "IsQCD+zBcFhteX7fUrS4cU/GvfLPy8F4oLtC9VBcF1U1qu1gZB/zlAxW8G0kqmAiXI84/gowZtcX1MjLk2QWoQ==" + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "js7+qAu/9mQvnhA4EfGMZNEzXtJCDxgkgj8ohuxq/Qxv+R56G+ljefhiJHOxTNiw54q8vmABCWUwkMulNdlZ4A==" }, "Velopack": { "type": "Direct", @@ -315,23 +330,10 @@ "resolved": "4.7.0", "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" }, - "Microsoft.Extensions.DependencyInjection.Abstractions": { - "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "cjWrLkJXK0rs4zofsK4bSdg+jhDLTaxrkXu4gS6Y7MAlCvRyNNgwY/lJi5RDlQOnSZweHqoyvgvbdvQsRIW+hg==" - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "arDBqTgFCyS0EvRV7O3MZturChstm50OJ0y9bDJvAcmEPJm0FFpFyjU/JLYyStNGGey081DvnQYlncNX5SJJGA==", - "dependencies": { - "Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0" - } - }, "Microsoft.Win32.SystemEvents": { "type": "Transitive", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "is9hwbUxr4o0jPDY5uRJTmq5RqqZVrV/OvZTt/sEC4bekBf/r1un1+SY1L9KE87QkeIkFbFzKomLivEvJ8vCbg==" + "resolved": "9.0.0", + "contentHash": "z8FfGIaoeALdD+KF44A2uP8PZIQQtDGiXsOLuN8nohbKhkyKt7zGaZb+fKiCxTuBqG22Q7myIAioSWaIcOOrOw==" }, "NuGet.Versioning": { "type": "Transitive", @@ -340,16 +342,16 @@ }, "System.Drawing.Common": { "type": "Transitive", - "resolved": "9.0.0-rc.2.24474.1", - "contentHash": "a+wqXfOnCuBc7ql6xsCr9IJh5g4Hmm6HBOtQIW/QEuTPHc/R/zMNe6b13FSHN7goEd/0tea7p6EH0OsH3iBKCQ==", + "resolved": "9.0.0", + "contentHash": "uoozjI3+dlgKh2onFJcz8aNLh6TRCPlLSh8Dbuljc8CdvqXrxHOVysJlrHvlsOCqceqGBR1wrMPxlnzzhynktw==", "dependencies": { - "Microsoft.Win32.SystemEvents": "9.0.0-rc.2.24473.5" + "Microsoft.Win32.SystemEvents": "9.0.0" } }, "System.IO.Hashing": { "type": "Transitive", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "BWkkIwLhG75+RnyBHGQd0Vrti8wqIBeNiAmHQrb6UiFny6qEQ+z6r61bFAOubw8dbp5S8nQrTS/wjJtpolkYTA==" + "resolved": "9.0.0", + "contentHash": "seeO8icDfED/Qwl9PDFUx2Gf/7xv7dPsMnw5PnRwNZuz4EWMpy0wIVohC4MfCcTIoJgp+KUrWG4WH3NPSusQOA==" }, "System.Threading.Tasks.Extensions": { "type": "Transitive", @@ -373,19 +375,19 @@ "colorthief": { "type": "Project", "dependencies": { - "System.Drawing.Common": "[9.0.0-rc.2.24474.1, )" + "System.Drawing.Common": "[9.0.0, )" } }, "discordrpc": { "type": "Project", "dependencies": { - "System.Text.Json": "[9.0.0-rc.2.24473.5, )" + "System.Text.Json": "[9.0.0, )" } }, "h.generatedicons.system.drawing": { "type": "Project", "dependencies": { - "System.Drawing.Common": "[9.0.0-rc.2.24474.1, )" + "System.Drawing.Common": "[9.0.0, )" } }, "h.notifyicon": { @@ -407,7 +409,7 @@ "type": "Project", "dependencies": { "Hi3Helper.EncTool": "[1.0.0, )", - "Microsoft.Windows.CsWinRT": "[2.1.6, )", + "Microsoft.Windows.CsWinRT": "[2.2.0, )" "Sentry": "[4.13.0, )" } }, @@ -416,7 +418,7 @@ "dependencies": { "Google.Protobuf": "[3.28.3, )", "Hi3Helper.Http": "[2.0.0, )", - "System.IO.Hashing": "[9.0.0-rc.2.24473.5, )" + "System.IO.Hashing": "[9.0.0, )" } }, "hi3helper.http": { @@ -427,7 +429,7 @@ "dependencies": { "Google.Protobuf": "[*, )", "Hi3Helper.ZstdNet": "[*, )", - "System.IO.Hashing": "[9.0.0-rc.2.24473.5, )" + "System.IO.Hashing": "[9.0.0, )" } }, "ImageCropper": { @@ -438,7 +440,7 @@ "CommunityToolkit.WinUI.Media": "[8.1.240916, )", "Microsoft.Graphics.Win2D": "[1.3.0, )", "Microsoft.Web.WebView2": "[1.0.2895-prerelease, )", - "Microsoft.Windows.CsWinRT": "[2.1.6, )", + "Microsoft.Windows.CsWinRT": "[2.2.0, )", "Microsoft.Windows.SDK.BuildTools": "[10.0.26100.1742, )", "Microsoft.WindowsAppSDK": "[1.6.240923002, )" } @@ -456,7 +458,7 @@ "innosetuphelper": { "type": "Project", "dependencies": { - "System.IO.Hashing": "[9.0.0-rc.2.24473.5, )" + "System.IO.Hashing": "[9.0.0, )" } }, "SettingsControls": { @@ -465,7 +467,7 @@ "CommunityToolkit.Common": "[8.4.0-preview1, )", "CommunityToolkit.WinUI.Triggers": "[8.1.240916, )", "Microsoft.Web.WebView2": "[1.0.2895-prerelease, )", - "Microsoft.Windows.CsWinRT": "[2.1.6, )", + "Microsoft.Windows.CsWinRT": "[2.2.0, )", "Microsoft.Windows.SDK.BuildTools": "[10.0.26100.1742, )", "Microsoft.WindowsAppSDK": "[1.6.240923002, )" } @@ -523,14 +525,14 @@ }, "System.Text.Encoding.CodePages": { "type": "Direct", - "requested": "[9.0.0-rc.2.24473.5, )", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "H1e56lFcgmKStcHlfRZQHn0Ck4Lb2BQIMbTrIq+5CT3LLn8uyL9R7kSM0RtYaIoOl5bD5NvGXjNQvReNY1siAA==" + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "GxJTSFPQpoVd0vQRgq8hwesicxgZoHTbYMvR/UMM4IzhkHMT+ebZE11c2C1gUyxz55zWtGCWktMTHvmgLzob9g==" }, "Microsoft.Win32.SystemEvents": { "type": "Transitive", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "is9hwbUxr4o0jPDY5uRJTmq5RqqZVrV/OvZTt/sEC4bekBf/r1un1+SY1L9KE87QkeIkFbFzKomLivEvJ8vCbg==" + "resolved": "9.0.0", + "contentHash": "z8FfGIaoeALdD+KF44A2uP8PZIQQtDGiXsOLuN8nohbKhkyKt7zGaZb+fKiCxTuBqG22Q7myIAioSWaIcOOrOw==" } } } diff --git a/Hi3Helper.CommunityToolkit/ImageCropper/Hi3Helper.CommunityToolkit.WinUI.Controls.ImageCropper.csproj b/Hi3Helper.CommunityToolkit/ImageCropper/Hi3Helper.CommunityToolkit.WinUI.Controls.ImageCropper.csproj index d060f6d30..cb641a13e 100644 --- a/Hi3Helper.CommunityToolkit/ImageCropper/Hi3Helper.CommunityToolkit.WinUI.Controls.ImageCropper.csproj +++ b/Hi3Helper.CommunityToolkit/ImageCropper/Hi3Helper.CommunityToolkit.WinUI.Controls.ImageCropper.csproj @@ -4,7 +4,7 @@ x64 net9.0-windows10.0.22621.0 - 10.0.22621.48 + 10.0.22621.57 10.0.17763.0 win-x64 true @@ -38,7 +38,7 @@ - + diff --git a/Hi3Helper.CommunityToolkit/ImageCropper/packages.lock.json b/Hi3Helper.CommunityToolkit/ImageCropper/packages.lock.json index b1576a0c0..4c770dfe9 100644 --- a/Hi3Helper.CommunityToolkit/ImageCropper/packages.lock.json +++ b/Hi3Helper.CommunityToolkit/ImageCropper/packages.lock.json @@ -55,9 +55,9 @@ }, "Microsoft.Windows.CsWinRT": { "type": "Direct", - "requested": "[2.1.6, )", - "resolved": "2.1.6", - "contentHash": "k5G30dezZjGnGyLokTkj+yBX9gyAhDSm8pY7MqEUX1Dorl4GfSywfodOA8wmhFaNuUd4OI6q1MuQQaxQIA/t0w==" + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "R8MDVawukHrKgYCFgYaoLfbAna/FrImEFRxDK9k8ITbrXv3KLE5uN6tRqrNV83H4MFdqJ/uiA/hg1cSsXkl0vw==" }, "Microsoft.Windows.SDK.BuildTools": { "type": "Direct", diff --git a/Hi3Helper.CommunityToolkit/SettingsControls/Hi3Helper.CommunityToolkit.WinUI.Controls.SettingsControls.csproj b/Hi3Helper.CommunityToolkit/SettingsControls/Hi3Helper.CommunityToolkit.WinUI.Controls.SettingsControls.csproj index 8ce118b7d..9af10aaaf 100644 --- a/Hi3Helper.CommunityToolkit/SettingsControls/Hi3Helper.CommunityToolkit.WinUI.Controls.SettingsControls.csproj +++ b/Hi3Helper.CommunityToolkit/SettingsControls/Hi3Helper.CommunityToolkit.WinUI.Controls.SettingsControls.csproj @@ -4,7 +4,7 @@ x64 net9.0-windows10.0.22621.0 - 10.0.22621.48 + 10.0.22621.57 10.0.17763.0 win-x64 true @@ -38,7 +38,7 @@ - + diff --git a/Hi3Helper.CommunityToolkit/SettingsControls/packages.lock.json b/Hi3Helper.CommunityToolkit/SettingsControls/packages.lock.json index 7979d7617..e72bbd015 100644 --- a/Hi3Helper.CommunityToolkit/SettingsControls/packages.lock.json +++ b/Hi3Helper.CommunityToolkit/SettingsControls/packages.lock.json @@ -33,9 +33,9 @@ }, "Microsoft.Windows.CsWinRT": { "type": "Direct", - "requested": "[2.1.6, )", - "resolved": "2.1.6", - "contentHash": "k5G30dezZjGnGyLokTkj+yBX9gyAhDSm8pY7MqEUX1Dorl4GfSywfodOA8wmhFaNuUd4OI6q1MuQQaxQIA/t0w==" + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "R8MDVawukHrKgYCFgYaoLfbAna/FrImEFRxDK9k8ITbrXv3KLE5uN6tRqrNV83H4MFdqJ/uiA/hg1cSsXkl0vw==" }, "Microsoft.Windows.SDK.BuildTools": { "type": "Direct", diff --git a/Hi3Helper.Core/Hi3Helper.Core.csproj b/Hi3Helper.Core/Hi3Helper.Core.csproj index 87d2c0a42..1d73a5782 100644 --- a/Hi3Helper.Core/Hi3Helper.Core.csproj +++ b/Hi3Helper.Core/Hi3Helper.Core.csproj @@ -1,4 +1,4 @@ - + net9.0-windows10.0.22621.0 @@ -42,7 +42,7 @@ - + diff --git a/Hi3Helper.Core/Lang/id_ID.json b/Hi3Helper.Core/Lang/id_ID.json index ba528d456..57f1e26c0 100644 --- a/Hi3Helper.Core/Lang/id_ID.json +++ b/Hi3Helper.Core/Lang/id_ID.json @@ -548,7 +548,7 @@ "UseExternalBrowser": "Selalu Gunakan Browser Eksternal", "LowerCollapsePrioOnGameLaunch": "Turunkan Prioritas Collapse saat Game Berjalan", - "LowerCollapsePrioOnGameLaunch_Tooltip": "Hentikan tayangan slide gambar di halaman utama dan menurunkan prioritas Collapse ke Dibawah Normal ", + "LowerCollapsePrioOnGameLaunch_Tooltip": "Hentikan carousel gambar pada Home Page dan turunkan prioritas Collapse menjadi \"dibawah normal\"", "KbShortcuts_Title": "Pintasan Keyboard", "KbShortcuts_ShowBtn": "Tunjukkan Pintasan", diff --git a/Hi3Helper.Core/packages.lock.json b/Hi3Helper.Core/packages.lock.json index 20856c3ee..075e92e23 100644 --- a/Hi3Helper.Core/packages.lock.json +++ b/Hi3Helper.Core/packages.lock.json @@ -10,9 +10,9 @@ }, "Microsoft.Windows.CsWinRT": { "type": "Direct", - "requested": "[2.1.6, )", - "resolved": "2.1.6", - "contentHash": "k5G30dezZjGnGyLokTkj+yBX9gyAhDSm8pY7MqEUX1Dorl4GfSywfodOA8wmhFaNuUd4OI6q1MuQQaxQIA/t0w==" + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "R8MDVawukHrKgYCFgYaoLfbAna/FrImEFRxDK9k8ITbrXv3KLE5uN6tRqrNV83H4MFdqJ/uiA/hg1cSsXkl0vw==" }, "Sentry": { "type": "Direct", @@ -27,15 +27,15 @@ }, "System.IO.Hashing": { "type": "Transitive", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "BWkkIwLhG75+RnyBHGQd0Vrti8wqIBeNiAmHQrb6UiFny6qEQ+z6r61bFAOubw8dbp5S8nQrTS/wjJtpolkYTA==" + "resolved": "9.0.0", + "contentHash": "seeO8icDfED/Qwl9PDFUx2Gf/7xv7dPsMnw5PnRwNZuz4EWMpy0wIVohC4MfCcTIoJgp+KUrWG4WH3NPSusQOA==" }, "hi3helper.enctool": { "type": "Project", "dependencies": { "Google.Protobuf": "[3.28.3, )", "Hi3Helper.Http": "[2.0.0, )", - "System.IO.Hashing": "[9.0.0-rc.2.24473.5, )" + "System.IO.Hashing": "[9.0.0, )" } }, "hi3helper.http": { diff --git a/Hi3Helper.TaskScheduler/Hi3Helper.TaskScheduler.csproj b/Hi3Helper.TaskScheduler/Hi3Helper.TaskScheduler.csproj index b381880d6..0545f59ac 100644 --- a/Hi3Helper.TaskScheduler/Hi3Helper.TaskScheduler.csproj +++ b/Hi3Helper.TaskScheduler/Hi3Helper.TaskScheduler.csproj @@ -16,6 +16,7 @@ $(Company). neon-nyan, Cry0, bagusnl, shatyuka, gablm. Copyright 2022-2024 $(Company) 8.0 + 1.0.2 @@ -30,7 +31,6 @@ - diff --git a/Hi3Helper.TaskScheduler/Program.cs b/Hi3Helper.TaskScheduler/Program.cs index 485be56bd..dcf84e981 100644 --- a/Hi3Helper.TaskScheduler/Program.cs +++ b/Hi3Helper.TaskScheduler/Program.cs @@ -1,15 +1,8 @@ -using Microsoft.Extensions.Logging; -using Microsoft.Win32.TaskScheduler; -using NuGet.Versioning; +using Microsoft.Win32.TaskScheduler; using System; -using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; -using Velopack; -using Velopack.Locators; -using Velopack.NuGet; -using Velopack.Windows; using TaskSched = Microsoft.Win32.TaskScheduler.Task; namespace Hi3Helper.TaskScheduler @@ -33,7 +26,6 @@ static int PrintUsage() Console.WriteLine($"{executableName} [EnableToTray] \"Scheduler name\" \"Executable path\""); Console.WriteLine($"{executableName} [Disable] \"Scheduler name\" \"Executable path\""); Console.WriteLine($"{executableName} [DisableToTray] \"Scheduler name\" \"Executable path\""); - Console.WriteLine($"{executableName} [RecreateIcons] \"Executable path\""); return int.MaxValue; } @@ -41,9 +33,6 @@ static int Main(string[] args) { try { - if (args.Length == 2 && args[0].ToLower() == "recreateicons") - return RecreateIcons(args[1]); - if (args.Length < 3) return PrintUsage().ReturnValAsConsole(); @@ -82,17 +71,6 @@ static int Main(string[] args) return 0.ReturnValAsConsole(); } - static int RecreateIcons(string executablePath) - { -#pragma warning disable CS0618 // Type or member is obsolete - ILogger logger = new DummyILoggerWrapper(); - VelopackLocator locator = new CollapseVelopackLocator(executablePath); - ShortcutTool shortcuts = new ShortcutTool(logger, locator); - shortcuts.CreateShortcut(executablePath, ShortcutLocation.Desktop | ShortcutLocation.StartMenuRoot, false, null); -#pragma warning restore CS0618 // Type or member is obsolete - return 0; - } - static TaskSched Create(TaskService taskService, string schedName, string execPath) { using (TaskDefinition taskDefinition = TaskService.Instance.NewTask()) @@ -240,165 +218,4 @@ static void ToggleTask(bool isEnabled, bool isStartupToTray, string schedName, s static void WriteConsole(string message) => Console.WriteLine(message); } - - internal class CollapseVelopackLocator : VelopackLocator - { - const string SpecVersionFileName = "sq.version"; - - /// - public override string? AppId { get; } - - /// - public override string? RootAppDir { get; } - - /// - public override string? UpdateExePath { get; } - - /// - public override string? AppContentDir { get; } - - /// - public override SemanticVersion? CurrentlyInstalledVersion { get; } - - /// - public override string? PackagesDir => CreateSubDirIfDoesNotExist(RootAppDir, "packages"); - - /// - public override bool IsPortable => - RootAppDir != null ? File.Exists(Path.Combine(RootAppDir, ".portable")) : false; - - /// - public override string? Channel { get; } - - /// - /// Internal use only. Auto detect app details from the specified EXE path. - /// - internal CollapseVelopackLocator(string ourExePath) - : base(null) - { - if (!VelopackRuntimeInfo.IsWindows) - throw new NotSupportedException("Cannot instantiate WindowsLocator on a non-Windows system."); - - // We try various approaches here. Firstly, if Update.exe is in the parent directory, - // we use that. If it's not present, we search for a parent "current" or "app-{ver}" directory, - // which could designate that this executable is running in a nested sub-directory. - // There is some legacy code here, because it's possible that we're running in an "app-{ver}" - // directory which is NOT containing a sq.version, in which case we need to infer a lot of info. - - ourExePath = Path.GetFullPath(ourExePath); - string myDirPath = Path.GetDirectoryName(ourExePath); - var myDirName = Path.GetFileName(myDirPath); - var possibleUpdateExe = Path.GetFullPath(Path.Combine(myDirPath, "..", "Update.exe")); - var ixCurrent = ourExePath.LastIndexOf("/current/", StringComparison.InvariantCultureIgnoreCase); - - Console.WriteLine($"Initializing {nameof(CollapseVelopackLocator)}"); - - if (File.Exists(possibleUpdateExe)) - { - Console.WriteLine("Update.exe found in parent directory"); - // we're running in a directory with an Update.exe in the parent directory - var manifestFile = Path.Combine(myDirPath, SpecVersionFileName); - if (PackageManifest.TryParseFromFile(manifestFile, out var manifest)) - { - // ideal, the info we need is in a manifest file. - Console.WriteLine("Located valid manifest file at: " + manifestFile); - AppId = manifest.Id; - CurrentlyInstalledVersion = manifest.Version; - RootAppDir = Path.GetDirectoryName(possibleUpdateExe); - UpdateExePath = possibleUpdateExe; - AppContentDir = myDirPath; - Channel = manifest.Channel; - } - else if (myDirName.StartsWith("app-", StringComparison.OrdinalIgnoreCase) && NuGetVersion.TryParse(myDirName.Substring(4), out var version)) - { - // this is a legacy case, where we're running in an 'root/app-*/' directory, and there is no manifest. - Console.WriteLine("Legacy app-* directory detected, sq.version not found. Using directory name for AppId and Version."); - AppId = Path.GetFileName(Path.GetDirectoryName(possibleUpdateExe)); - CurrentlyInstalledVersion = version; - RootAppDir = Path.GetDirectoryName(possibleUpdateExe); - UpdateExePath = possibleUpdateExe; - AppContentDir = myDirPath; - } - } - else if (ixCurrent > 0) - { - // this is an attempt to handle the case where we are running in a nested current directory. - var rootDir = ourExePath.Substring(0, ixCurrent); - var currentDir = Path.Combine(rootDir, "current"); - var manifestFile = Path.Combine(currentDir, SpecVersionFileName); - possibleUpdateExe = Path.GetFullPath(Path.Combine(rootDir, "Update.exe")); - // we only support parsing a manifest when we're in a nested current directory. no legacy fallback. - if (File.Exists(possibleUpdateExe) && PackageManifest.TryParseFromFile(manifestFile, out var manifest)) - { - Console.WriteLine("Running in deeply nested directory. This is not an advised use-case."); - Console.WriteLine("Located valid manifest file at: " + manifestFile); - RootAppDir = Path.GetDirectoryName(possibleUpdateExe); - UpdateExePath = possibleUpdateExe; - AppId = manifest.Id; - CurrentlyInstalledVersion = manifest.Version; - AppContentDir = currentDir; - Channel = manifest.Channel; - } - } - } - - public override List GetLocalPackages() - { - try - { - if (CurrentlyInstalledVersion == null) - return new List(0); - - var list = new List(); - if (PackagesDir != null) - { - foreach (var pkg in Directory.EnumerateFiles(PackagesDir, "*.nupkg")) - { - try - { - var asset = VelopackAsset.FromNupkg(pkg); - if (asset?.Version != null) - { - list.Add(asset); - } - } - catch (Exception ex) - { - Log.LogWarning(ex, $"Error while reading local package '{pkg}'."); - } - } - } - return list; - } - catch (Exception ex) - { - Log.LogError(ex, "Error while reading local packages."); - return new List(0); - } - } - - /// - public override VelopackAsset? GetLatestLocalFullPackage() - { - return GetLocalPackages() - .OrderByDescending(x => x.Version) - .FirstOrDefault(x => x.Type == VelopackAssetType.Full); - } - } - - internal class DummyILoggerWrapper : ILogger - { - internal DummyILoggerWrapper() { } - - public IDisposable BeginScope(TState state) - where TState : notnull => default!; - - public bool IsEnabled(LogLevel logLevel) => true; - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - string message = formatter(state, exception); - Console.WriteLine(string.Format("[{0}] {1}", logLevel, message)); - } - } } diff --git a/Hi3Helper.TaskScheduler/ShortcutTool.cs b/Hi3Helper.TaskScheduler/ShortcutTool.cs deleted file mode 100644 index 970e2b9d5..000000000 --- a/Hi3Helper.TaskScheduler/ShortcutTool.cs +++ /dev/null @@ -1,258 +0,0 @@ -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using Velopack; -using Velopack.Locators; -using Velopack.NuGet; -using Velopack.Windows; - -namespace Hi3Helper.TaskScheduler -{ - public class ShortcutTool - { - /// Log for diagnostic messages. - protected ILogger Log { get; } - - /// Locator to use for finding important application paths. - protected IVelopackLocator Locator { get; } - - /// - public ShortcutTool(ILogger? logger = null, IVelopackLocator? locator = null) - { - Log = logger ?? NullLogger.Instance; - Locator = locator ?? VelopackLocator.GetDefault(Log); - } - - /// - /// Create a shortcut to the currently running executable at the specified locations. - /// See to create a shortcut to a different program - /// - public void CreateShortcutForThisExe(ShortcutLocation location = ShortcutLocation.Desktop | ShortcutLocation.StartMenuRoot) - { - CreateShortcut( - Locator.ThisExeRelativePath, - location, - false, - null, // shortcut arguments - null); // shortcut icon - } - - /// - /// Removes a shortcut for the currently running executable at the specified locations - /// - public void RemoveShortcutForThisExe(ShortcutLocation location = ShortcutLocation.Desktop | ShortcutLocation.StartMenu | ShortcutLocation.StartMenuRoot) - { - DeleteShortcuts( - Locator.ThisExeRelativePath, - location); - } - - /// - /// Searches for existing shortcuts to an executable inside the current package. - /// - /// The relative path or filename of the executable (from the current app dir). - /// The locations to search. - public Dictionary FindShortcuts(string relativeExeName, ShortcutLocation locations) - { - var release = Locator.GetLatestLocalFullPackage(); - var pkgDir = Locator.PackagesDir; - var currentDir = Locator.AppContentDir; - var rootAppDirectory = Locator.RootAppDir; - - var ret = new Dictionary(); - var pkgPath = Path.Combine(pkgDir, release.FileName); - var zf = new ZipPackage(pkgPath); - var exePath = Path.Combine(currentDir, relativeExeName); - if (!File.Exists(exePath)) - return ret; - - var fileVerInfo = FileVersionInfo.GetVersionInfo(exePath); - - foreach (var f in GetLocations(locations)) - { - var file = LinkPathForVersionInfo(f, zf, fileVerInfo, rootAppDirectory); - if (File.Exists(file)) - { - Log.LogInformation($"Opening existing shortcut for {relativeExeName} ({file})"); - ret.Add(f, new ShellLink(file)); - } - } - - return ret; - } - - /// - /// Creates new shortcuts to the specified executable at the specified locations. - /// - /// The relative path or filename of the executable (from the current app dir). - /// The locations to create shortcuts. - /// If true, shortcuts will be updated instead of created. - /// The arguments the application should be launched with - /// Path to a specific icon to use instead of the exe icon. - public void CreateShortcut(string? relativeExeName, ShortcutLocation locations, bool updateOnly, string? programArguments = null, string? icon = null) - { - VelopackAsset? release = Locator.GetLatestLocalFullPackage(); - string? pkgDir = Locator.PackagesDir; - string? currentDir = Locator.AppContentDir; - string? rootAppDirectory = Locator.RootAppDir; - Log.LogInformation($"About to create shortcuts for {relativeExeName}, rootAppDir {rootAppDirectory}"); - - string pkgPath = Path.Combine(pkgDir, release.FileName); - ZipPackage zf = new ZipPackage(pkgPath); - string exePath = Path.Combine(currentDir, relativeExeName); - if (!File.Exists(exePath)) - throw new FileNotFoundException($"Could not find: {exePath}"); - - var fileVerInfo = FileVersionInfo.GetVersionInfo(exePath); - - foreach (var f in GetLocations(locations)) - { - string file = LinkPathForVersionInfo(f, zf, fileVerInfo, rootAppDirectory); - bool fileExists = File.Exists(file); - - // NB: If we've already installed the app, but the shortcut - // is no longer there, we have to assume that the user didn't - // want it there and explicitly deleted it, so we shouldn't - // annoy them by recreating it. - if (!fileExists && updateOnly) - { - Log.LogWarning($"Wanted to update shortcut {file} but it appears user deleted it"); - continue; - } - - Log.LogInformation($"Creating shortcut for {relativeExeName} => {file}"); - - ShellLink sl; - File.Delete(file); - - string target = Path.Combine(currentDir, relativeExeName); - sl = new ShellLink - { - Target = target, - IconPath = icon ?? target, - IconIndex = 0, - WorkingDirectory = Path.GetDirectoryName(exePath), - Description = zf.ProductDescription, - }; - - if (!string.IsNullOrWhiteSpace(programArguments)) - { - sl.Arguments += string.Format(" -a \"{0}\"", programArguments); - } - - //var appUserModelId = Utility.GetAppUserModelId(zf.Id, exeName); - //var toastActivatorCLSID = Utility.CreateGuidFromHash(appUserModelId).ToString(); - //sl.SetAppUserModelId(appUserModelId); - //sl.SetToastActivatorCLSID(toastActivatorCLSID); - - Log.LogInformation($"About to save shortcut: {file} (target {sl.Target}, workingDir {sl.WorkingDirectory}, args {sl.Arguments})"); - sl.Save(file); - } - } - - /// - /// Delete all the shortcuts for the specified executable in the specified locations. - /// - /// The relative path or filename of the executable (from the current app dir). - /// The locations to create shortcuts. - public void DeleteShortcuts(string? relativeExeName, ShortcutLocation locations) - { - var release = Locator.GetLatestLocalFullPackage(); - var pkgDir = Locator.PackagesDir; - var currentDir = Locator.AppContentDir; - var rootAppDirectory = Locator.RootAppDir; - Log.LogInformation($"About to delete shortcuts for {relativeExeName}, rootAppDir {rootAppDirectory}"); - - var pkgPath = Path.Combine(pkgDir, release.FileName); - var zf = new ZipPackage(pkgPath); - var exePath = Path.Combine(currentDir, relativeExeName); - if (!File.Exists(exePath)) return; - - var fileVerInfo = FileVersionInfo.GetVersionInfo(exePath); - - foreach (var f in GetLocations(locations)) - { - var file = LinkPathForVersionInfo(f, zf, fileVerInfo, rootAppDirectory); - Log.LogInformation($"Removing shortcut for {relativeExeName} => {file}"); - try - { - if (File.Exists(file)) File.Delete(file); - } - catch (Exception ex) - { - Log.LogError(ex, "Couldn't delete shortcut: " + file); - } - } - } - - /// - /// Given an and return the target shortcut path. - /// - protected virtual string LinkPathForVersionInfo(ShortcutLocation location, ZipPackage package, FileVersionInfo versionInfo, string? rootdir) - { - var possibleProductNames = new[] { - versionInfo.ProductName, - package.ProductName, - versionInfo.FileDescription, - Path.GetFileNameWithoutExtension(versionInfo.FileName) - }; - - var possibleCompanyNames = new[] { - versionInfo.CompanyName, - package.ProductCompany, - }; - - var prodName = possibleCompanyNames.First(x => !string.IsNullOrWhiteSpace(x)); - var pkgName = possibleProductNames.First(x => !string.IsNullOrWhiteSpace(x)); - - return GetLinkPath(location, pkgName, prodName, rootdir); - } - - /// - /// Given the application info, return the shortcut target path. - /// - protected virtual string GetLinkPath(ShortcutLocation location, string? title, string? applicationName, string? rootdir, bool createDirectoryIfNecessary = true) - { - var dir = default(string); - - switch (location) - { - case ShortcutLocation.Desktop: - dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); - break; - case ShortcutLocation.StartMenu: - dir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs", applicationName); - break; - case ShortcutLocation.StartMenuRoot: - dir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.StartMenu), "Programs"); - break; - case ShortcutLocation.Startup: - dir = Environment.GetFolderPath(Environment.SpecialFolder.Startup); - break; - case ShortcutLocation.AppRoot: - dir = rootdir; - break; - } - - if (createDirectoryIfNecessary && !Directory.Exists(dir)) - { - Directory.CreateDirectory(dir); - } - - return Path.Combine(dir, title + ".lnk"); - } - - private ShortcutLocation[] GetLocations(ShortcutLocation flag) - { - var locations = Enum.GetValues(typeof(ShortcutLocation)).Cast().ToArray(); - return locations - .Where(x => x != ShortcutLocation.None) - .Where(x => flag.HasFlag(x)) - .ToArray(); - } - } -} diff --git a/Hi3Helper.TaskScheduler/packages.lock.json b/Hi3Helper.TaskScheduler/packages.lock.json index 070b4927d..f3b23cd91 100644 --- a/Hi3Helper.TaskScheduler/packages.lock.json +++ b/Hi3Helper.TaskScheduler/packages.lock.json @@ -48,22 +48,6 @@ "resolved": "2.11.0", "contentHash": "p9wH58XSNIyUtO7PIFAEldaKUzpYmlj+YWAfnUqBKnGxIZRY51I9BrsBGJijUVwlxrgmLLPUigRIv2ZTD4uPJA==" }, - "Velopack": { - "type": "Direct", - "requested": "[0.0.869, )", - "resolved": "0.0.869", - "contentHash": "oGk+2xphxXDm2rsj4z5JTOnfE7CydgEmsbadubkJOUAbLcaAnuLZQF+3EgVZEiuEFLgtdtl7BBhZ8GrDs41l1g==", - "dependencies": { - "Microsoft.Extensions.Logging.Abstractions": "2.2.0", - "Newtonsoft.Json": "13.0.3", - "NuGet.Versioning": "6.11.1" - } - }, - "Microsoft.Extensions.Logging.Abstractions": { - "type": "Transitive", - "resolved": "2.2.0", - "contentHash": "B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A==" - }, "Microsoft.NETCore.Platforms": { "type": "Transitive", "resolved": "1.1.0", @@ -130,16 +114,6 @@ "System.Xml.XDocument": "4.3.0" } }, - "Newtonsoft.Json": { - "type": "Transitive", - "resolved": "13.0.3", - "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" - }, - "NuGet.Versioning": { - "type": "Transitive", - "resolved": "6.11.1", - "contentHash": "YNn3BB71F+guJW42TbAhGcMh3gpyqFMZcPVD9pm5vcvGivTALtRely/VCPWQQ6JQ5PfwIrjPaJMO7VnqyeK3rg==" - }, "System.AppContext": { "type": "Transitive", "resolved": "4.3.0", diff --git a/InnoSetupHelper/InnoSetupHelper.csproj b/InnoSetupHelper/InnoSetupHelper.csproj index ca6074357..326c0b235 100644 --- a/InnoSetupHelper/InnoSetupHelper.csproj +++ b/InnoSetupHelper/InnoSetupHelper.csproj @@ -19,7 +19,7 @@ - + diff --git a/InnoSetupHelper/packages.lock.json b/InnoSetupHelper/packages.lock.json index 3a864d87f..878ce5e65 100644 --- a/InnoSetupHelper/packages.lock.json +++ b/InnoSetupHelper/packages.lock.json @@ -10,9 +10,9 @@ }, "System.IO.Hashing": { "type": "Direct", - "requested": "[9.0.0-rc.2.24473.5, )", - "resolved": "9.0.0-rc.2.24473.5", - "contentHash": "BWkkIwLhG75+RnyBHGQd0Vrti8wqIBeNiAmHQrb6UiFny6qEQ+z6r61bFAOubw8dbp5S8nQrTS/wjJtpolkYTA==" + "requested": "[9.0.0, )", + "resolved": "9.0.0", + "contentHash": "seeO8icDfED/Qwl9PDFUx2Gf/7xv7dPsMnw5PnRwNZuz4EWMpy0wIVohC4MfCcTIoJgp+KUrWG4WH3NPSusQOA==" } } } diff --git a/Type Dependencies Diagram for InstallationConvert and other elements.png b/Type Dependencies Diagram for InstallationConvert and other elements.png new file mode 100644 index 000000000..5f9f60908 Binary files /dev/null and b/Type Dependencies Diagram for InstallationConvert and other elements.png differ