diff --git a/src/Jackett.Common/Indexers/BaseIndexer.cs b/src/Jackett.Common/Indexers/BaseIndexer.cs index e45b01ae2..c7d4f3cb9 100644 --- a/src/Jackett.Common/Indexers/BaseIndexer.cs +++ b/src/Jackett.Common/Indexers/BaseIndexer.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using AutoMapper; +using AutoMapper; using Jackett.Common.Models; using Jackett.Common.Models.IndexerConfig; using Jackett.Common.Services.Interfaces; @@ -14,6 +7,12 @@ using Jackett.Common.Utils.Clients; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NLog; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; namespace Jackett.Common.Indexers { @@ -184,10 +183,10 @@ namespace Jackett.Common.Indexers return false; } - Version dotNetVersion = Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.RuntimeFramework.Version; + bool runningOnDotNetCore = RuntimeInformation.FrameworkDescription.IndexOf("core", StringComparison.OrdinalIgnoreCase) >= 0; bool isWindows = Environment.OSVersion.Platform == PlatformID.Win32NT; - if (!isWindows && dotNetVersion.Major < 4) + if (!isWindows && runningOnDotNetCore) { // User isn't running Windows, but is running on .NET Core framework, no access to the DPAPI, so don't bother trying to migrate return false; @@ -290,7 +289,7 @@ namespace Jackett.Common.Indexers return false; if (caps.SupportsImdbSearch && query.IsImdbQuery) return true; - else if(!caps.SupportsImdbSearch && query.IsImdbQuery && query.QueryType != "TorrentPotato") // potato query should always contain imdb+search term + else if (!caps.SupportsImdbSearch && query.IsImdbQuery && query.QueryType != "TorrentPotato") // potato query should always contain imdb+search term return false; if (caps.SearchAvailable && query.IsSearch) return true; @@ -838,7 +837,6 @@ namespace Jackett.Common.Indexers public override TorznabCapabilities TorznabCaps { get; protected set; } - private List categoryMapping = new List(); protected WebClient webclient; protected readonly string downloadUrlBase = ""; diff --git a/src/Jackett.Common/Jackett.Common.csproj b/src/Jackett.Common/Jackett.Common.csproj index b55971394..f72532bb8 100644 --- a/src/Jackett.Common/Jackett.Common.csproj +++ b/src/Jackett.Common/Jackett.Common.csproj @@ -121,7 +121,6 @@ - diff --git a/src/Jackett.Common/Utils/EnvironmentUtil.cs b/src/Jackett.Common/Utils/EnvironmentUtil.cs index a9b3e2880..385d5bbdd 100644 --- a/src/Jackett.Common/Utils/EnvironmentUtil.cs +++ b/src/Jackett.Common/Utils/EnvironmentUtil.cs @@ -32,17 +32,7 @@ namespace Jackett.Common.Utils try { - var currentAssembly = Assembly.GetExecutingAssembly(); - - bool aspNetCorePresent = new StackTrace().GetFrames() - .Select(x => x.GetMethod().ReflectedType.Assembly).Distinct() - .Where(x => x.GetReferencedAssemblies().Any(y => y.FullName == currentAssembly.FullName)) - .Where(x => x.ManifestModule.Name == "JackettConsole.exe").Select(x => x.CustomAttributes) - .FirstOrDefault() - .Where(x => x.AttributeType.Assembly.FullName.StartsWith("Microsoft.AspNetCore", StringComparison.OrdinalIgnoreCase)) - .Any(); - - runningOwin = !aspNetCorePresent; + runningOwin = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName.StartsWith("Jackett, ")).Any(); } catch {