diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/Program.cs b/Program.cs index df44ae0..1c9912c 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,4 @@ +using Microsoft.Win32; using Serilog; using Serilog.Core; using Serilog.Formatting.Display; @@ -20,9 +21,47 @@ static void Main() .WriteToSimpleAndRichTextBox(new MessageTemplateTextFormatter("{Message} {Exception}\n")) .CreateLogger(); + Task.Run(SetAddRemoveProgramsIcon); + // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); Application.Run(new Form1()); } + +#pragma warning disable CS8602 // 可能 null 參考的取值 (dereference)。 + private static void SetAddRemoveProgramsIcon() + { + //if (ApplicationDeployment.IsNetworkDeployed && ApplicationDeployment.CurrentDeployment.IsFirstRun) + { + try + { + var iconSourcePath = Path.Combine(System.Windows.Forms.Application.StartupPath, @"YoutubeSegmentDownloader.ico"); + + if (!File.Exists(iconSourcePath)) return; + + var uninstallKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Uninstall"); + if (uninstallKey == null) return; + + var subKeyNames = uninstallKey.GetSubKeyNames(); + foreach (var subkeyName in subKeyNames) + { + var myKey = uninstallKey.OpenSubKey(subkeyName, true); + var myValue = myKey.GetValue("DisplayName"); + if (myValue != null + && myValue.ToString() == "Youtube Segment Downloader") + { + myKey.SetValue("DisplayIcon", iconSourcePath); + break; + } + } + } + catch (Exception e) + { + Log.Logger.Error(e.Message); + } + } + } +#pragma warning restore CS8602 // 可能 null 參考的取值 (dereference)。 } + diff --git a/Properties/PublishProfiles/ClickOnceProfile.pubxml b/Properties/PublishProfiles/ClickOnceProfile.pubxml index e66e793..58e74bf 100644 --- a/Properties/PublishProfiles/ClickOnceProfile.pubxml +++ b/Properties/PublishProfiles/ClickOnceProfile.pubxml @@ -4,39 +4,45 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - 2 + 0 1.0.0.* True Release - True - False + True + False + True + https://github.com/jim60105/YoutubeSegmentDownloader/issues + True True True - Disk + Web + https://github.com/jim60105/YoutubeSegmentDownloader/raw/setup/ True - False - False + True + True False Any CPU - bin\Release\net6.0-windows\publish\ - bin\Release\net6.0-windows\publish\ + Youtube Segment Downloader + bin\Release\net6.0-windows\win-x64\app.publish\ + bin\Release\net6.0-windows\win-x64\app.publish\ ClickOnce - True + False True win-x64 False (無) False + Youtube Segment Downloader + https://github.com/jim60105/YoutubeSegmentDownloader net6.0-windows - False + True Foreground False Publish.html - True|2022-02-21T10:39:30.5249061Z; - True + true .NET Desktop 執行階段 6.0.1 (x64) diff --git a/README.md b/README.md new file mode 100644 index 0000000..fac571f --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# YoutubeSegmentDownloader diff --git a/YoutubeSegmentDownloader.csproj b/YoutubeSegmentDownloader.csproj index 6e024ae..95c9199 100644 --- a/YoutubeSegmentDownloader.csproj +++ b/YoutubeSegmentDownloader.csproj @@ -3,19 +3,28 @@ WinExe net6.0-windows + win-x64 enable true enable - assets\256.ico + YoutubeSegmentDownloader.ico 256.png + true + README.md + https://github.com/jim60105/YoutubeSegmentDownloader + GPL-3.0 License + Youtube Segment Downloader + Youtube Segment Downloader + jim60105 + https://github.com/jim60105/YoutubeSegmentDownloader.git + E:\repos\YoutubeSegmentDownload\LICENSE + True + YoutubeSegmentDownloader.Program + x64 - - - - - + Always @@ -27,14 +36,6 @@ - - - True - \ - Always - - - True @@ -44,10 +45,22 @@ + + True + \ + Never + + + Always + SettingsSingleFileGenerator Settings.Designer.cs + + Always + True + \ + - \ No newline at end of file diff --git a/assets/256.ico b/YoutubeSegmentDownloader.ico similarity index 100% rename from assets/256.ico rename to YoutubeSegmentDownloader.ico diff --git a/YoutubeSegmentDownloader.sln b/YoutubeSegmentDownloader.sln index 8d65e2d..fd95998 100644 --- a/YoutubeSegmentDownloader.sln +++ b/YoutubeSegmentDownloader.sln @@ -8,6 +8,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{28BC7A00-8813-43CD-9A3A-E7F8E15513B2}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig + .github\workflows\dotnet.yml = .github\workflows\dotnet.yml EndProjectSection EndProject Global diff --git a/assets/16.ico b/assets/16.ico deleted file mode 100644 index c8afc79..0000000 Binary files a/assets/16.ico and /dev/null differ