From e695f90c80cffeffcb1d8dcbbfdba2073b8d1726 Mon Sep 17 00:00:00 2001 From: junglebus <22320807+junglebus@users.noreply.github.com> Date: Mon, 20 Jan 2020 04:50:12 +1100 Subject: [PATCH] Remove COM reference for .NET Core (#6975) * Remove COM reference for .NET Core Removing only COM reference to get closer to having Jackett to run on .NET Core for Windows * Handle resources https://github.com/microsoft/msbuild/issues/4704 * Remove GenerateResourceUsePreserializedResources * Remove System.Resources.Extensions --- src/Jackett.Server/Jackett.Server.csproj | 1 + src/Jackett.Tray/Jackett.Tray.csproj | 11 --------- src/Jackett.Tray/Main.cs | 26 +++++++++++++++------- src/Jackett.Updater/Jackett.Updater.csproj | 5 +++++ 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/Jackett.Server/Jackett.Server.csproj b/src/Jackett.Server/Jackett.Server.csproj index d2471b26f..706f93d97 100644 --- a/src/Jackett.Server/Jackett.Server.csproj +++ b/src/Jackett.Server/Jackett.Server.csproj @@ -37,6 +37,7 @@ + diff --git a/src/Jackett.Tray/Jackett.Tray.csproj b/src/Jackett.Tray/Jackett.Tray.csproj index 309a2e49b..15c2ee7e7 100644 --- a/src/Jackett.Tray/Jackett.Tray.csproj +++ b/src/Jackett.Tray/Jackett.Tray.csproj @@ -12,17 +12,6 @@ - - - f935dc20-1cf0-11d0-adb9-00c04fd58a0b - 1 - 0 - tlbimp - 0 - false - - - diff --git a/src/Jackett.Tray/Main.cs b/src/Jackett.Tray/Main.cs index 421fafe9c..5383dabac 100644 --- a/src/Jackett.Tray/Main.cs +++ b/src/Jackett.Tray/Main.cs @@ -139,7 +139,14 @@ namespace Jackett.Tray { get { - return File.Exists(ShortcutPath); + if (File.Exists(ShortcutPath) || File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Jackett.lnk"))) + { + return true; + } + else + { + return false; + } } set { @@ -158,7 +165,7 @@ namespace Jackett.Tray { get { - return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Jackett.lnk"); + return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Jackett.url"); } } @@ -166,12 +173,15 @@ namespace Jackett.Tray { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { - var appPath = Assembly.GetExecutingAssembly().Location; - var shell = new IWshRuntimeLibrary.WshShell(); - var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(ShortcutPath); - shortcut.Description = Assembly.GetExecutingAssembly().GetName().Name; - shortcut.TargetPath = appPath; - shortcut.Save(); + using (StreamWriter writer = new StreamWriter(ShortcutPath)) + { + var appPath = Assembly.GetExecutingAssembly().Location; + writer.WriteLine("[InternetShortcut]"); + writer.WriteLine("URL=file:///" + appPath); + writer.WriteLine("IconIndex=0"); + string icon = appPath.Replace('\\', '/'); + writer.WriteLine("IconFile=" + icon); + } } } diff --git a/src/Jackett.Updater/Jackett.Updater.csproj b/src/Jackett.Updater/Jackett.Updater.csproj index a77fbd8c9..88d558902 100644 --- a/src/Jackett.Updater/Jackett.Updater.csproj +++ b/src/Jackett.Updater/Jackett.Updater.csproj @@ -9,6 +9,11 @@ false + + + + +