diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8ba52fb5c..fda05e6c0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -115,10 +115,6 @@ stages: artifact: WindowsCoreTests displayName: Publish Windows Test Package condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - publish: '$(testsFolder)/net472/linux-x64/publish' - artifact: LinuxTests - displayName: Publish Linux Mono Test Package - condition: and(succeeded(), eq(variables['osName'], 'Windows')) - publish: '$(testsFolder)/net5.0/linux-x64/publish' artifact: LinuxCoreTests displayName: Publish Linux Test Package @@ -277,14 +273,6 @@ stages: tarCompression: 'gz' includeRootFolder: false rootFolderOrFile: $(artifactsFolder)/macos/net5.0 - - task: ArchiveFiles@2 - displayName: Create Linux Mono tar - inputs: - archiveFile: '$(Build.ArtifactStagingDirectory)/Radarr.$(buildName).linux.tar.gz' - archiveType: 'tar' - tarCompression: 'gz' - includeRootFolder: false - rootFolderOrFile: $(artifactsFolder)/linux-x64/net472 - task: ArchiveFiles@2 displayName: Create Linux Core tar inputs: @@ -439,14 +427,6 @@ stages: - powershell: Set-Service SCardSvr -StartupType Manual displayName: Enable Windows Test Service condition: and(succeeded(), eq(variables['osName'], 'Windows')) - - bash: | - SYMLINK=6_6_0 - MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$SYMLINK - echo "##vso[task.setvariable variable=MONOPREFIX;]$MONOPREFIX" - echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH" - echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH" - displayName: Set Mono Version - condition: and(succeeded(), eq(variables['osName'], 'Mac')) - bash: find ${TESTSFOLDER} -name "Radarr.Test.Dummy" -exec chmod a+x {} \; displayName: Make Test Dummy Executable condition: and(succeeded(), ne(variables['osName'], 'Windows')) @@ -470,18 +450,6 @@ stages: condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) strategy: matrix: - mono520: - testName: 'Mono 5.20' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-5.20 - mono610: - testName: 'Mono 6.10' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.10 - mono612: - testName: 'Mono 6.12' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.12 alpine: testName: 'Musl Net Core' artifactName: LinuxMuslCoreTests @@ -566,14 +534,6 @@ stages: vmImage: $(imageName) steps: - - bash: | - SYMLINK=6_6_0 - MONOPREFIX=/Library/Frameworks/Mono.framework/Versions/$SYMLINK - echo "##vso[task.setvariable variable=MONOPREFIX;]$MONOPREFIX" - echo "##vso[task.setvariable variable=PKG_CONFIG_PATH;]$MONOPREFIX/lib/pkgconfig:$MONOPREFIX/share/pkgconfig:$PKG_CONFIG_PATH" - echo "##vso[task.setvariable variable=PATH;]$MONOPREFIX/bin:$PATH" - displayName: Set Mono Version - condition: and(succeeded(), eq(variables['osName'], 'Mac')) - task: UseDotNet@2 displayName: 'Install .net core' inputs: @@ -665,21 +625,6 @@ stages: condition: and(succeeded(), eq(dependencies.Prepare.outputs['setVar.backendNotUpdated'], '0')) strategy: matrix: - mono520: - testName: 'Mono 5.20' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-5.20 - pattern: 'Radarr.*.linux.tar.gz' - mono610: - testName: 'Mono 6.10' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.10 - pattern: 'Radarr.*.linux.tar.gz' - mono612: - testName: 'Mono 6.12' - artifactName: LinuxTests - containerImage: ghcr.io/servarr/testimages:mono-6.12 - pattern: 'Radarr.*.linux.tar.gz' alpine: testName: 'Musl Net Core' artifactName: LinuxMuslCoreTests diff --git a/build.sh b/build.sh index e2b7adf33..baa6873c9 100755 --- a/build.sh +++ b/build.sh @@ -33,7 +33,6 @@ EnableBsdSupport() if grep -qv freebsd-x64 src/Directory.Build.props; then sed -i'' -e "s^\(.*\)^\1;freebsd-x64^g" src/Directory.Build.props - sed -i'' -e "s^\(.*\)^\1;freebsd-x64:net472^g" src/Directory.Build.props fi } @@ -148,11 +147,6 @@ PackageMacOS() PackageFiles "$folder" "$framework" "osx-x64" - if [ "$framework" = "net472" ]; then - echo "Adding Startup script" - cp macOS/Radarr $folder - fi - echo "Removing Service helpers" rm -f $folder/ServiceUninstall.* rm -f $folder/ServiceInstall.* @@ -337,7 +331,6 @@ then PackageTests "net5.0" "linux-x64" PackageTests "net5.0" "linux-musl-x64" PackageTests "net5.0" "osx-x64" - PackageTests "net472" "linux-x64" if [ "$ENABLE_BSD" = "YES" ]; then PackageTests "net5.0" "freebsd-x64" @@ -377,7 +370,6 @@ then Package "net5.0" "linux-musl-arm64" Package "net5.0" "linux-arm" Package "net5.0" "osx-x64" - Package "net472" "linux-x64" if [ "$ENABLE_BSD" = "YES" ]; then Package "net5.0" "freebsd-x64" diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 518e7dcac..fd31745cd 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -6,7 +6,6 @@ AnyCPU true win-x64;win-x86;osx-x64;linux-x64;linux-musl-x64;linux-arm;linux-arm64;linux-musl-arm64 - win-x64:net472;win-x86:net472;osx-x64:net472;linux-arm:net472;linux-arm64:net472;linux-musl-x64:net472;linux-musl-arm64:net472 $(MSBuildThisFileDirectory)..\ @@ -100,14 +99,6 @@ - - - - all - runtime; build; native; contentfiles; analyzers - - - false diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index c5681e6b2..4cf15bc72 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,11 +1,4 @@ - - - full - - - - diff --git a/src/Libraries/Mono/System.Diagnostics.Tracing.dll b/src/Libraries/Mono/System.Diagnostics.Tracing.dll deleted file mode 100644 index 3c7819569..000000000 Binary files a/src/Libraries/Mono/System.Diagnostics.Tracing.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Globalization.Extensions.dll b/src/Libraries/Mono/System.Globalization.Extensions.dll deleted file mode 100644 index 8c0861579..000000000 Binary files a/src/Libraries/Mono/System.Globalization.Extensions.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Numerics.Vectors.dll b/src/Libraries/Mono/System.Numerics.Vectors.dll deleted file mode 100755 index 10205772c..000000000 Binary files a/src/Libraries/Mono/System.Numerics.Vectors.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll b/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll deleted file mode 100644 index e55b5eb23..000000000 Binary files a/src/Libraries/Mono/System.Runtime.InteropServices.RuntimeInformation.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll b/src/Libraries/Mono/System.Text.Encoding.CodePages.dll deleted file mode 100644 index 414770bc0..000000000 Binary files a/src/Libraries/Mono/System.Text.Encoding.CodePages.dll and /dev/null differ diff --git a/src/Libraries/Mono/System.Threading.Overlapped.dll b/src/Libraries/Mono/System.Threading.Overlapped.dll deleted file mode 100644 index c06475843..000000000 Binary files a/src/Libraries/Mono/System.Threading.Overlapped.dll and /dev/null differ diff --git a/src/Libraries/Mono/readme.txt b/src/Libraries/Mono/readme.txt deleted file mode 100644 index f1251a98f..000000000 --- a/src/Libraries/Mono/readme.txt +++ /dev/null @@ -1,3 +0,0 @@ -Copied from mono/4.5/Facades of the mono 5.4 release. -These are the mono version of the dotnet Core TypeForwardedTo assemblies. -Using these assemblies is no longer necessary once we reach mono 5.18 as minimum version \ No newline at end of file diff --git a/src/NzbDrone.Api.Test/Radarr.Api.Test.csproj b/src/NzbDrone.Api.Test/Radarr.Api.Test.csproj index 757942be2..54e9639b1 100644 --- a/src/NzbDrone.Api.Test/Radarr.Api.Test.csproj +++ b/src/NzbDrone.Api.Test/Radarr.Api.Test.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Automation.Test/Radarr.Automation.Test.csproj b/src/NzbDrone.Automation.Test/Radarr.Automation.Test.csproj index c5b2ef926..13b6acb22 100644 --- a/src/NzbDrone.Automation.Test/Radarr.Automation.Test.csproj +++ b/src/NzbDrone.Automation.Test/Radarr.Automation.Test.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Common.Test/Radarr.Common.Test.csproj b/src/NzbDrone.Common.Test/Radarr.Common.Test.csproj index 7b7306832..c2495d284 100644 --- a/src/NzbDrone.Common.Test/Radarr.Common.Test.csproj +++ b/src/NzbDrone.Common.Test/Radarr.Common.Test.csproj @@ -1,13 +1,10 @@ - net5.0;net472 + net5.0 - - - diff --git a/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs b/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs index 03a2b58a2..4439b3bde 100644 --- a/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs +++ b/src/NzbDrone.Common/Composition/ContainerBuilderBase.cs @@ -1,17 +1,14 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.Loader; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Messaging; using TinyIoC; -#if NETCOREAPP -using System.IO; -using System.Runtime.InteropServices; -using System.Runtime.Loader; -#endif - namespace NzbDrone.Common.Composition { public abstract class ContainerBuilderBase @@ -27,12 +24,6 @@ namespace NzbDrone.Common.Composition assemblies.Add(OsInfo.IsWindows ? "Radarr.Windows" : "Radarr.Mono"); assemblies.Add("Radarr.Common"); -#if !NETCOREAPP - foreach (var assembly in assemblies) - { - _loadedTypes.AddRange(Assembly.Load(assembly).GetExportedTypes()); - } -#else var startupPath = AppDomain.CurrentDomain.BaseDirectory; foreach (var assemblyName in assemblies) @@ -44,14 +35,12 @@ namespace NzbDrone.Common.Composition toRegisterResolver.AddRange(assemblies.Intersect(new[] { "Radarr.Core" })); RegisterNativeResolver(toRegisterResolver); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ContainerResolveEventHandler); -#endif Container = new Container(new TinyIoCContainer(), _loadedTypes); AutoRegisterInterfaces(); Container.Register(args); } -#if NETCOREAPP private static Assembly ContainerResolveEventHandler(object sender, ResolveEventArgs args) { var resolver = new AssemblyDependencyResolver(args.RequestingAssembly.Location); @@ -103,7 +92,6 @@ namespace NzbDrone.Common.Composition return NativeLibrary.Load(mappedName, assembly, dllImportSearchPath); } -#endif private void AutoRegisterInterfaces() { diff --git a/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs index 0a0ac17c9..5c28231fe 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/PlatformInfo.cs @@ -26,21 +26,8 @@ namespace NzbDrone.Common.EnvironmentInfo static PlatformInfo() { -#if NETCOREAPP _platform = PlatformType.NetCore; _version = Environment.Version; -#else - if (Type.GetType("Mono.Runtime") != null) - { - _platform = PlatformType.Mono; - _version = GetMonoVersion(); - } - else - { - _platform = PlatformType.DotNet; - _version = GetDotNetVersion(); - } -#endif } public static PlatformType Platform => _platform; diff --git a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs index 5be00f9f3..a75c3c676 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/RuntimeInfo.cs @@ -23,7 +23,6 @@ namespace NzbDrone.Common.EnvironmentInfo serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME) && serviceProvider.GetStatus(ServiceProvider.SERVICE_NAME) == ServiceControllerStatus.StartPending; -#if NETCOREAPP // net5.0 will return Radarr.dll for entry assembly, we need the actual // executable name (Radarr on linux). On mono this will return the location of // the mono executable itself, which is not what we want. @@ -34,12 +33,6 @@ namespace NzbDrone.Common.EnvironmentInfo ExecutingApplication = entry.FileName; IsWindowsTray = OsInfo.IsWindows && entry.ModuleName == $"{ProcessProvider.RADARR_PROCESS_NAME}.exe"; } -#else - // On mono we need to get the location of the Radarr assembly, not Mono. - // Can't be running tray app in mono. - ExecutingApplication = Assembly.GetEntryAssembly()?.Location; -#endif - } static RuntimeInfo() diff --git a/src/NzbDrone.Common/Expansive/CircularReferenceException.cs b/src/NzbDrone.Common/Expansive/CircularReferenceException.cs deleted file mode 100644 index 737663c54..000000000 --- a/src/NzbDrone.Common/Expansive/CircularReferenceException.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace NzbDrone.Common.Expansive -{ - public class CircularReferenceException : Exception - { - public CircularReferenceException(string message) - : base(message) - { - } - } -} diff --git a/src/NzbDrone.Common/Expansive/Expansive.cs b/src/NzbDrone.Common/Expansive/Expansive.cs deleted file mode 100644 index f6a2ff3c5..000000000 --- a/src/NzbDrone.Common/Expansive/Expansive.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Dynamic; -using System.Linq; -using System.Text.RegularExpressions; - -namespace NzbDrone.Common.Expansive -{ - public static class Expansive - { - private static PatternStyle _patternStyle; - - public static bool RequireAllExpansions { get; set; } - - public static Func DefaultExpansionFactory { get; set; } - - static Expansive() - { - Initialize(); - } - - public static string Expand(this string source) - { - return source.Expand(DefaultExpansionFactory); - } - - public static string Expand(this string source, params string[] args) - { - var output = source; - var tokens = new List(); - var pattern = new Regex(_patternStyle.TokenMatchPattern, RegexOptions.IgnoreCase); - var calls = new Stack(); - string callingToken = null; - - while (pattern.IsMatch(output)) - { - foreach (Match match in pattern.Matches(output)) - { - var token = _patternStyle.TokenReplaceFilter(match.Value); - var tokenIndex = 0; - if (!tokens.Contains(token)) - { - tokens.Add(token); - tokenIndex = tokens.Count - 1; - } - else - { - tokenIndex = tokens.IndexOf(token); - } - - output = Regex.Replace(output, _patternStyle.OutputFilter(match.Value), "{" + tokenIndex + "}"); - } - } - - var newArgs = new List(); - foreach (var arg in args) - { - var newArg = arg; - var tokenPattern = new Regex(_patternStyle.TokenFilter(string.Join("|", tokens))); - while (tokenPattern.IsMatch(newArg)) - { - foreach (Match match in tokenPattern.Matches(newArg)) - { - var token = _patternStyle.TokenReplaceFilter(match.Value); - if (calls.Contains(string.Format("{0}:{1}", callingToken, token))) - { - throw new CircularReferenceException(string.Format("Circular Reference Detected for token '{0}'.", callingToken)); - } - - calls.Push(string.Format("{0}:{1}", callingToken, token)); - callingToken = token; - newArg = Regex.Replace(newArg, _patternStyle.OutputFilter(match.Value), args[tokens.IndexOf(token)]); - } - } - - newArgs.Add(newArg); - } - - return string.Format(output, newArgs.ToArray()); - } - - public static string Expand(this string source, Func expansionFactory) - { - return source.ExpandInternal(expansionFactory); - } - - public static string Expand(this string source, object model) - { - return source.ExpandInternal( - name => - { - IDictionary modelDict = model.ToDictionary(); - if (RequireAllExpansions && !modelDict.ContainsKey(name)) - { - return ""; - } - - if (modelDict[name] == null) - { - return ""; - } - - return modelDict[name].ToString(); - }); - } - - private static void Initialize() - { - _patternStyle = new PatternStyle - { - TokenMatchPattern = @"\{[a-zA-Z]\w*\}", - TokenReplaceFilter = token => token.Replace("{", "").Replace("}", ""), - OutputFilter = output => (output.StartsWith("{") && output.EndsWith("}") ? output : @"\{" + output + @"\}"), - TokenFilter = tokens => "{(" + tokens + ")}" - }; - } - - private static string ExpandInternal(this string source, Func expansionFactory) - { - if (expansionFactory == null) - { - throw new ApplicationException("ExpansionFactory not defined.\nDefine a DefaultExpansionFactory or call Expand(source, Func expansionFactory))"); - } - - var pattern = new Regex(_patternStyle.TokenMatchPattern, RegexOptions.IgnoreCase); - - var callTreeParent = new Tree("root").Root; - - return source.Explode(pattern, _patternStyle, expansionFactory, callTreeParent); - } - - private static string Explode(this string source, Regex pattern, PatternStyle patternStyle, Func expansionFactory, TreeNode parent) - { - var output = source; - while (output.HasChildren(pattern)) - { - foreach (Match match in pattern.Matches(source)) - { - var child = match.Value; - var token = patternStyle.TokenReplaceFilter(match.Value); - - var thisNode = parent.Children.Add(token); - - // if we have already encountered this token in this call tree, we have a circular reference - if (thisNode.CallTree.Contains(token)) - { - throw new CircularReferenceException(string.Format("Circular Reference Detected for token '{0}'. Call Tree: {1}->{2}", - token, - string.Join("->", thisNode.CallTree.ToArray().Reverse()), - token)); - } - - // expand this match - var expandedValue = expansionFactory(token); - - // Replace the match with the expanded value - child = Regex.Replace(child, patternStyle.OutputFilter(match.Value), expandedValue); - - // Recursively expand the child until we no longer encounter nested tokens (or hit a circular reference) - child = child.Explode(pattern, patternStyle, expansionFactory, thisNode); - - // finally, replace the match in the output with the fully-expanded value - output = Regex.Replace(output, patternStyle.OutputFilter(match.Value), child); - } - } - - return output; - } - - private static bool HasChildren(this string token, Regex pattern) - { - return pattern.IsMatch(token); - } - - /// - /// Turns the object into an ExpandoObject - /// - private static dynamic ToExpando(this object o) - { - var result = new ExpandoObject(); - var d = result as IDictionary; //work with the Expando as a Dictionary - if (o is ExpandoObject) - { - return o; //shouldn't have to... but just in case - } - - if (o is NameValueCollection || o.GetType().IsSubclassOf(typeof(NameValueCollection))) - { - var nv = (NameValueCollection)o; - nv.Cast().Select(key => new KeyValuePair(key, nv[key])).ToList().ForEach(i => d.Add(i)); - } - else - { - var props = o.GetType().GetProperties(); - foreach (var item in props) - { - d.Add(item.Name, item.GetValue(o, null)); - } - } - - return result; - } - - /// - /// Turns the object into a Dictionary - /// - private static IDictionary ToDictionary(this object thingy) - { - return (IDictionary)thingy.ToExpando(); - } - } -} diff --git a/src/NzbDrone.Common/Expansive/PatternStyle.cs b/src/NzbDrone.Common/Expansive/PatternStyle.cs deleted file mode 100644 index 011e77315..000000000 --- a/src/NzbDrone.Common/Expansive/PatternStyle.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace NzbDrone.Common.Expansive -{ - internal class PatternStyle - { - public string TokenMatchPattern { get; set; } - public Func TokenFilter { get; set; } - public Func TokenReplaceFilter { get; set; } - public Func OutputFilter { get; set; } - } -} diff --git a/src/NzbDrone.Common/Expansive/Tree.cs b/src/NzbDrone.Common/Expansive/Tree.cs deleted file mode 100644 index 744c0714e..000000000 --- a/src/NzbDrone.Common/Expansive/Tree.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace NzbDrone.Common.Expansive -{ - internal class Tree : TreeNode - { - public Tree(T rootValue) - : base(rootValue) - { - Value = rootValue; - } - } -} diff --git a/src/NzbDrone.Common/Expansive/TreeNode.cs b/src/NzbDrone.Common/Expansive/TreeNode.cs deleted file mode 100644 index 4a61fa08e..000000000 --- a/src/NzbDrone.Common/Expansive/TreeNode.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections.Generic; - -namespace NzbDrone.Common.Expansive -{ - internal class TreeNode - { - private List _CallTree; - private TreeNode _Parent; - - public TreeNode(T value) - { - Value = value; - Parent = null; - Children = new TreeNodeList(this); - _CallTree = new List(); - } - - public TreeNode(T value, TreeNode parent) - { - Value = value; - Parent = parent; - Children = new TreeNodeList(this); - _CallTree = new List(); - } - - public TreeNode Parent - { - get - { - return _Parent; - } - - set - { - if (value == _Parent) - { - return; - } - - if (_Parent != null) - { - _Parent.Children.Remove(this); - } - - if (value != null && !value.Children.Contains(this)) - { - value.Children.Add(this); - } - - _Parent = value; - } - } - - public TreeNode Root - { - get - { - //return (Parent == null) ? this : Parent.Root; - TreeNode node = this; - while (node.Parent != null) - { - node = node.Parent; - } - - return node; - } - } - - public TreeNodeList Children { get; private set; } - - public List CallTree - { - get - { - _CallTree = new List(); - TreeNode node = this; - while (node.Parent != null) - { - node = node.Parent; - _CallTree.Add(node.Value); - } - - return _CallTree; - } - private set => _CallTree = value; - } - - public T Value { get; set; } - } -} diff --git a/src/NzbDrone.Common/Expansive/TreeNodeList.cs b/src/NzbDrone.Common/Expansive/TreeNodeList.cs deleted file mode 100644 index a239a3b15..000000000 --- a/src/NzbDrone.Common/Expansive/TreeNodeList.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections.Generic; - -namespace NzbDrone.Common.Expansive -{ - internal class TreeNodeList : List> - { - public TreeNode Parent; - - public TreeNodeList(TreeNode parent) - { - Parent = parent; - } - - public new TreeNode Add(TreeNode node) - { - base.Add(node); - node.Parent = Parent; - return node; - } - - public TreeNode Add(T value) - { - return Add(new TreeNode(value)); - } - - public override string ToString() - { - return "Count=" + Count.ToString(); - } - } -} diff --git a/src/NzbDrone.Common/Expansive/license.txt b/src/NzbDrone.Common/Expansive/license.txt deleted file mode 100644 index b48f7ea2f..000000000 --- a/src/NzbDrone.Common/Expansive/license.txt +++ /dev/null @@ -1,2 +0,0 @@ -Source: https://github.com/anderly/Expansive -Microsoft Public License (MS-PL): http://opensource.org/licenses/MS-PL \ No newline at end of file diff --git a/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs b/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs index aa29245e3..7f0fe06ce 100644 --- a/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs +++ b/src/NzbDrone.Common/Extensions/DictionaryExtensions.cs @@ -6,14 +6,6 @@ namespace NzbDrone.Common.Extensions { public static class DictionaryExtensions { -#if !NETCOREAPP - public static TValue GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key, TValue defaultValue = default(TValue)) - { - TValue value; - return dictionary.TryGetValue(key, out value) ? value : defaultValue; - } -#endif - public static Dictionary Merge(this Dictionary first, Dictionary second) { if (first == null) diff --git a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs index 356d684b9..61d024e93 100644 --- a/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs +++ b/src/NzbDrone.Common/Http/Dispatchers/ManagedHttpDispatcher.cs @@ -33,19 +33,10 @@ namespace NzbDrone.Common.Http.Dispatchers { var webRequest = (HttpWebRequest)WebRequest.Create((Uri)request.Url); - if (PlatformInfo.IsMono) - { - // On Mono GZipStream/DeflateStream leaks memory if an exception is thrown, use an intermediate buffer in that case. - webRequest.AutomaticDecompression = DecompressionMethods.None; - webRequest.Headers.Add("Accept-Encoding", "gzip"); - } - else - { - // Deflate is not a standard and could break depending on implementation. - // we should just stick with the more compatible Gzip - //http://stackoverflow.com/questions/8490718/how-to-decompress-stream-deflated-with-java-util-zip-deflater-in-net - webRequest.AutomaticDecompression = DecompressionMethods.GZip; - } + // Deflate is not a standard and could break depending on implementation. + // we should just stick with the more compatible Gzip + //http://stackoverflow.com/questions/8490718/how-to-decompress-stream-deflated-with-java-util-zip-deflater-in-net + webRequest.AutomaticDecompression = DecompressionMethods.GZip; webRequest.Method = request.Method.ToString(); webRequest.UserAgent = _userAgentBuilder.GetUserAgent(request.UseSimplifiedUserAgent); @@ -86,9 +77,6 @@ namespace NzbDrone.Common.Http.Dispatchers if (httpWebResponse == null) { - // Workaround for mono not closing connections properly in certain situations. - AbortWebRequest(webRequest); - // The default messages for WebException on mono are pretty horrible. if (e.Status == WebExceptionStatus.NameResolutionFailure) { @@ -122,19 +110,6 @@ namespace NzbDrone.Common.Http.Dispatchers try { data = responseStream.ToBytes(); - - if (PlatformInfo.IsMono && httpWebResponse.ContentEncoding == "gzip") - { - using (var compressedStream = new MemoryStream(data)) - using (var gzip = new GZipStream(compressedStream, CompressionMode.Decompress)) - using (var decompressedStream = new MemoryStream()) - { - gzip.CopyTo(decompressedStream); - data = decompressedStream.ToArray(); - } - - httpWebResponse.Headers.Remove("Content-Encoding"); - } } catch (Exception ex) { @@ -244,36 +219,5 @@ namespace NzbDrone.Common.Http.Dispatchers } } } - - // Workaround for mono not closing connections properly on timeouts - private void AbortWebRequest(HttpWebRequest webRequest) - { - // First affected version was mono 5.16 - if (OsInfo.IsNotWindows && _platformInfo.Version >= new Version(5, 16)) - { - try - { - var currentOperationInfo = webRequest.GetType().GetField("currentOperation", BindingFlags.NonPublic | BindingFlags.Instance); - var currentOperation = currentOperationInfo.GetValue(webRequest); - - if (currentOperation != null) - { - var responseStreamInfo = currentOperation.GetType().GetField("responseStream", BindingFlags.NonPublic | BindingFlags.Instance); - var responseStream = responseStreamInfo.GetValue(currentOperation) as Stream; - - // Note that responseStream will likely be null once mono fixes it. - responseStream?.Dispose(); - } - } - catch (Exception ex) - { - // This can fail randomly on future mono versions that have been changed/fixed. Log to sentry and ignore. - _logger.Trace() - .Exception(ex) - .Message("Unable to dispose responseStream on mono {0}", _platformInfo.Version) - .Write(); - } - } - } } } diff --git a/src/NzbDrone.Common/Http/HttpAccept.cs b/src/NzbDrone.Common/Http/HttpAccept.cs index fc0eab894..21367b3a6 100644 --- a/src/NzbDrone.Common/Http/HttpAccept.cs +++ b/src/NzbDrone.Common/Http/HttpAccept.cs @@ -4,11 +4,7 @@ { public static readonly HttpAccept Rss = new HttpAccept("application/rss+xml, text/rss+xml, application/xml, text/xml"); public static readonly HttpAccept Json = new HttpAccept("application/json"); -#if NETCOREAPP public static readonly HttpAccept JsonCharset = new HttpAccept("application/json; charset=utf-8"); -#else - public static readonly HttpAccept JsonCharset = new HttpAccept("application/json;charset=utf-8"); -#endif public static readonly HttpAccept Html = new HttpAccept("text/html"); public string Value { get; private set; } diff --git a/src/NzbDrone.Common/Http/NzbDroneWebClient.cs b/src/NzbDrone.Common/Http/NzbDroneWebClient.cs deleted file mode 100644 index ccd369bb7..000000000 --- a/src/NzbDrone.Common/Http/NzbDroneWebClient.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Net; - -namespace NzbDrone.Common.Http -{ - public class NzbDroneWebClient : WebClient - { - protected override WebRequest GetWebRequest(Uri address) - { - var request = base.GetWebRequest(address); - if (request is HttpWebRequest) - { - ((HttpWebRequest)request).KeepAlive = false; - ((HttpWebRequest)request).ServicePoint.Expect100Continue = false; - } - - return request; - } - } -} diff --git a/src/NzbDrone.Common/Processes/ProcessProvider.cs b/src/NzbDrone.Common/Processes/ProcessProvider.cs index 368d01662..f2318e4e8 100644 --- a/src/NzbDrone.Common/Processes/ProcessProvider.cs +++ b/src/NzbDrone.Common/Processes/ProcessProvider.cs @@ -44,11 +44,7 @@ namespace NzbDrone.Common.Processes public static int GetCurrentProcessId() { -#if NETCOREAPP return Environment.ProcessId; -#else - return Process.GetCurrentProcess().Id; -#endif } public ProcessInfo GetCurrentProcess() diff --git a/src/NzbDrone.Common/Radarr.Common.csproj b/src/NzbDrone.Common/Radarr.Common.csproj index f44233c6c..9c07a241b 100644 --- a/src/NzbDrone.Common/Radarr.Common.csproj +++ b/src/NzbDrone.Common/Radarr.Common.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 ISMUSL @@ -12,17 +12,12 @@ - - - - - True diff --git a/src/NzbDrone.Console/Radarr.Console.csproj b/src/NzbDrone.Console/Radarr.Console.csproj index bc5851b45..bac151faa 100644 --- a/src/NzbDrone.Console/Radarr.Console.csproj +++ b/src/NzbDrone.Console/Radarr.Console.csproj @@ -1,7 +1,7 @@ Exe - net5.0;net472 + net5.0 ..\NzbDrone.Host\Radarr.ico app.manifest diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugFixture.cs deleted file mode 100644 index 765dc95b8..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoDebugFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -using NUnit.Framework; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common; -using static NzbDrone.Core.HealthCheck.Checks.MonoDebugCheck; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class MonoDebugFixture : CoreTest - { - private void GivenHasStackFrame(bool hasStackFrame) - { - Mocker.GetMock() - .Setup(f => f.HasStackFrameInfo()) - .Returns(hasStackFrame); - } - - [Test] - public void should_return_ok_if_not_mono() - { - if (PlatformInfo.IsMono) - { - throw new IgnoreException("non mono specific test"); - } - - Subject.Check().ShouldBeOk(); - } - - [Test] - public void should_return_ok_if_not_debug() - { - MonoOnly(); - - GivenHasStackFrame(false); - - Subject.Check().ShouldBeOk(); - } - - [Test] - public void should_log_warning_if_not_debug() - { - MonoOnly(); - - GivenHasStackFrame(false); - - Subject.Check(); - - ExceptionVerification.ExpectedWarns(1); - } - - [Test] - public void should_return_ok_if_debug() - { - MonoOnly(); - - GivenHasStackFrame(true); - - Subject.Check().ShouldBeOk(); - } - } -} diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs deleted file mode 100644 index ee2b47ad6..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoNotNetCoreCheckFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections.Generic; -using Moq; -using NUnit.Framework; -using NzbDrone.Common.Processes; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Localization; -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class MonoNotNetCoreCheckFixture : CoreTest - { - [SetUp] - public void setup() - { - Mocker.GetMock() - .Setup(s => s.GetLocalizedString(It.IsAny())) - .Returns("Some Warning Message"); - } - - [Test] - [Platform(Exclude = "Mono")] - public void should_return_ok_if_net_core() - { - Subject.Check().ShouldBeOk(); - } - - [Test] - [Platform("Mono")] - public void should_log_error_if_mono() - { - Subject.Check().ShouldBeError(); - } - - [Test] - [Platform("Mono")] - public void should_return_error_if_otherbsd() - { - Mocker.GetMock() - .Setup(x => x.StartAndCapture("uname", null, null)) - .Returns(new ProcessOutput - { - Lines = new List - { - new ProcessOutputLine(ProcessOutputLevel.Standard, "OpenBSD") - } - }); - Subject.Check().ShouldBeError(); - } - - [Test] - [Platform("Mono")] - public void should_log_error_if_freebsd() - { - Mocker.GetMock() - .Setup(x => x.StartAndCapture("uname", null, null)) - .Returns(new ProcessOutput - { - Lines = new List - { - new ProcessOutputLine(ProcessOutputLevel.Standard, "FreeBSD") - } - }); - Subject.Check().ShouldBeError(); - } - } -} diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs deleted file mode 100644 index 4be2bdeb0..000000000 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/MonoVersionCheckFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using Moq; -using NUnit.Framework; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Core.HealthCheck.Checks; -using NzbDrone.Core.Localization; -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test.HealthCheck.Checks -{ - [TestFixture] - public class MonoVersionCheckFixture : CoreTest - { - [SetUp] - public void Setup() - { - Mocker.GetMock() - .Setup(s => s.GetLocalizedString(It.IsAny())) - .Returns("Some Warning Message"); - } - - private void GivenOutput(string version) - { - MonoOnly(); - - Mocker.GetMock() - .SetupGet(s => s.Version) - .Returns(new Version(version)); - } - - [TestCase("5.20")] - [TestCase("6.4")] - [TestCase("6.12")] - public void should_return_ok(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeOk(); - } - - public void should_return_notice(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeNotice(); - } - - public void should_return_warning(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeWarning(); - } - - [TestCase("2.10.2")] - [TestCase("2.10.8.1")] - [TestCase("3.0.0.1")] - [TestCase("3.2.0.1")] - [TestCase("3.2.1")] - [TestCase("3.2.7")] - [TestCase("3.6.1")] - [TestCase("3.8")] - [TestCase("3.10")] - [TestCase("4.0.0.0")] - [TestCase("4.2")] - [TestCase("4.4.0")] - [TestCase("4.4.1")] - [TestCase("5.4")] - [TestCase("5.8")] - [TestCase("5.10")] - [TestCase("5.12")] - [TestCase("5.14")] - [TestCase("5.16")] - [TestCase("5.18")] - public void should_return_error(string version) - { - GivenOutput(version); - - Subject.Check().ShouldBeError(); - } - } -} diff --git a/src/NzbDrone.Core.Test/Radarr.Core.Test.csproj b/src/NzbDrone.Core.Test/Radarr.Core.Test.csproj index 099b952fc..3c48b9f50 100644 --- a/src/NzbDrone.Core.Test/Radarr.Core.Test.csproj +++ b/src/NzbDrone.Core.Test/Radarr.Core.Test.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs deleted file mode 100644 index bb0a96c70..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoDebugCheck.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Diagnostics; -using NLog; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Extensions; -using NzbDrone.Core.Localization; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoDebugCheck : HealthCheckBase - { - private readonly Logger _logger; - private readonly StackFrameHelper _stackFrameHelper; - - public override bool CheckOnSchedule => false; - - public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper, ILocalizationService localizationService) - : base(localizationService) - { - _logger = logger; - _stackFrameHelper = stackFrameHelper; - } - - public class StackFrameHelper - { - public virtual bool HasStackFrameInfo() - { - var stackTrace = new StackTrace(true); - - return stackTrace.FrameCount > 0 && stackTrace.GetFrame(0).GetFileName().IsNotNullOrWhiteSpace(); - } - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - if (!_stackFrameHelper.HasStackFrameInfo()) - { - _logger.Warn("Mono is not running with --debug switch"); - return new HealthCheck(GetType()); - } - - return new HealthCheck(GetType()); - } - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs deleted file mode 100644 index 8e828550b..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoNotNetCoreCheck.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Linq; -using System.Runtime.InteropServices; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Processes; -using NzbDrone.Core.Localization; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoNotNetCoreCheck : HealthCheckBase - { - private static string[] MonoUnames = new string[] { "OpenBSD", "MidnightBSD", "NetBSD" }; - private readonly IProcessProvider _processProvider; - - public MonoNotNetCoreCheck(IProcessProvider processProvider, - ILocalizationService localizationService) - : base(localizationService) - { - _processProvider = processProvider; - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - // Don't warn on linux x86 - we don't build x86 net core - if (OsInfo.IsLinux && RuntimeInformation.ProcessArchitecture == Architecture.X86) - { - return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("Monox86SupportCheckMessage"), "#mono-support-end-of-life"); - } - - // Check for BSD - var output = _processProvider.StartAndCapture("uname"); - if (output?.ExitCode == 0 && MonoUnames.Contains(output?.Lines.First().Content)) - { - return new HealthCheck(GetType(), HealthCheckResult.Error, string.Format(_localizationService.GetLocalizedString("MonoBSDSupportCheckMessage"), OsInfo.Os), "#mono-support-end-of-life"); - } - - return new HealthCheck(GetType(), - HealthCheckResult.Error, - _localizationService.GetLocalizedString("MonoNotNetCoreCheckMessage"), - "#update-to-net-core-version"); - } - - public override bool CheckOnSchedule => false; - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs deleted file mode 100644 index c434500be..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoTlsCheck.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using NLog; -using NLog.Fluent; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Common.Instrumentation.Extensions; -using NzbDrone.Core.Localization; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoTlsCheck : HealthCheckBase - { - private readonly IPlatformInfo _platformInfo; - private readonly Logger _logger; - - public MonoTlsCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger) - : base(localizationService) - { - _platformInfo = platformInfo; - _logger = logger; - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - var monoVersion = _platformInfo.Version; - - if (monoVersion >= new Version("5.8.0") && Environment.GetEnvironmentVariable("MONO_TLS_PROVIDER") == "legacy") - { - _logger.Debug() - .Message("Mono version {0} and legacy TLS provider is selected, recommending user to switch to btls.", monoVersion) - .WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString()) - .Write(); - - return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("MonoTlsCheckMessage"), "#mono-tls-legacy"); - } - - return new HealthCheck(GetType()); - } - - public override bool CheckOnSchedule => false; - } -} diff --git a/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs b/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs deleted file mode 100644 index ed5a48735..000000000 --- a/src/NzbDrone.Core/HealthCheck/Checks/MonoVersionCheck.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using NLog; -using NzbDrone.Common.EnvironmentInfo; -using NzbDrone.Core.Localization; - -namespace NzbDrone.Core.HealthCheck.Checks -{ - public class MonoVersionCheck : HealthCheckBase - { - private readonly IPlatformInfo _platformInfo; - private readonly Logger _logger; - - public MonoVersionCheck(IPlatformInfo platformInfo, ILocalizationService localizationService, Logger logger) - : base(localizationService) - { - _platformInfo = platformInfo; - _logger = logger; - } - - public override HealthCheck Check() - { - if (!PlatformInfo.IsMono) - { - return new HealthCheck(GetType()); - } - - var monoVersion = _platformInfo.Version; - - // Currently best stable Mono version (5.18 gets us .net 4.7.2 support) - var bestVersion = new Version("5.20"); - var targetVersion = new Version("5.20"); - if (monoVersion >= targetVersion) - { - _logger.Debug("Mono version is {0} or better: {1}", targetVersion, monoVersion); - return new HealthCheck(GetType()); - } - - // Stable Mono versions - var stableVersion = new Version("5.20"); - if (monoVersion >= stableVersion) - { - _logger.Debug("Mono version is {0} or better: {1}", stableVersion, monoVersion); - return new HealthCheck(GetType(), - HealthCheckResult.Notice, - string.Format(_localizationService.GetLocalizedString("MonoVersionCheckUpgradeRecommendedMessage"), monoVersion, bestVersion), - "#currently-installed-mono-version-is-supported-but-upgrading-is-recommended"); - } - - var oldVersion = new Version("5.20"); - if (monoVersion >= oldVersion) - { - return new HealthCheck(GetType(), - HealthCheckResult.Error, - string.Format(_localizationService.GetLocalizedString("MonoVersionCheckUpgradeRecommendedMessage"), monoVersion, bestVersion), - "#currently-installed-mono-version-is-old-and-unsupported"); - } - - return new HealthCheck(GetType(), - HealthCheckResult.Error, - string.Format(_localizationService.GetLocalizedString("MonoVersionCheckUpgradeRecommendedMessage"), monoVersion, bestVersion), - "#currently-installed-mono-version-is-old-and-unsupported"); - } - - public override bool CheckOnSchedule => false; - } -} diff --git a/src/NzbDrone.Core/Radarr.Core.csproj b/src/NzbDrone.Core/Radarr.Core.csproj index ef57d407c..b473e876d 100644 --- a/src/NzbDrone.Core/Radarr.Core.csproj +++ b/src/NzbDrone.Core/Radarr.Core.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 @@ -22,10 +22,6 @@ - - - - Resources\Logo\64.png diff --git a/src/NzbDrone.Host.Test/Radarr.Host.Test.csproj b/src/NzbDrone.Host.Test/Radarr.Host.Test.csproj index 1fd96fbea..1268019ce 100644 --- a/src/NzbDrone.Host.Test/Radarr.Host.Test.csproj +++ b/src/NzbDrone.Host.Test/Radarr.Host.Test.csproj @@ -1,12 +1,9 @@ - net5.0;net472 + net5.0 - - - diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index 15819568c..68b11c351 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -24,11 +24,7 @@ namespace Radarr.Host try { Logger.Info("Starting Radarr - {0} - Version {1}", -#if NETCOREAPP Process.GetCurrentProcess().MainModule.FileName, -#else - Assembly.GetCallingAssembly().Location, -#endif Assembly.GetExecutingAssembly().GetName().Version); if (!PlatformValidation.IsValidate(userAlert)) diff --git a/src/NzbDrone.Host/Radarr.Host.csproj b/src/NzbDrone.Host/Radarr.Host.csproj index df72a9e5c..d23c5e66f 100644 --- a/src/NzbDrone.Host/Radarr.Host.csproj +++ b/src/NzbDrone.Host/Radarr.Host.csproj @@ -1,18 +1,10 @@  - net5.0;net472 + net5.0 Library - - - - - - - - - + @@ -29,7 +21,4 @@ True - - - diff --git a/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs b/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs index 01de0cb6d..f30acb125 100644 --- a/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs +++ b/src/NzbDrone.Host/WebHost/Middleware/SignalRMiddleware.cs @@ -57,17 +57,10 @@ namespace Radarr.Host.Middleware } }); -#if NETCOREAPP appBuilder.UseEndpoints(x => { x.MapHub(URL_BASE + "/signalr/messages"); }); -#else - appBuilder.UseSignalR(x => - { - x.MapHub("/signalr/messages"); - }); -#endif // This is a side effect of haing multiple IoC containers, TinyIoC and whatever // Kestrel/SignalR is using. Ideally we'd have one IoC container, but that's non-trivial with TinyIoC diff --git a/src/NzbDrone.Host/WebHost/WebHostController.cs b/src/NzbDrone.Host/WebHost/WebHostController.cs index 440f938cb..1cc790ef2 100644 --- a/src/NzbDrone.Host/WebHost/WebHostController.cs +++ b/src/NzbDrone.Host/WebHost/WebHostController.cs @@ -108,24 +108,14 @@ namespace Radarr.Host { services .AddSignalR() -#if !NETCOREAPP - .AddJsonProtocol(options => - { - options.PayloadSerializerSettings = Json.GetSerializerSettings(); - }); -#else .AddJsonProtocol(options => { options.PayloadSerializerOptions = STJson.GetSerializerSettings(); }); -#endif - }) .Configure(app => { -#if NETCOREAPP app.UseRouting(); -#endif app.Properties["host.AppName"] = BuildInfo.AppName; app.UsePathBase(_configFileProvider.UrlBase); diff --git a/src/NzbDrone.Integration.Test/Radarr.Integration.Test.csproj b/src/NzbDrone.Integration.Test/Radarr.Integration.Test.csproj index d1f8a10db..3a50f7ee1 100644 --- a/src/NzbDrone.Integration.Test/Radarr.Integration.Test.csproj +++ b/src/NzbDrone.Integration.Test/Radarr.Integration.Test.csproj @@ -1,12 +1,9 @@  - net5.0;net472 + net5.0 Library - - - - + diff --git a/src/NzbDrone.Libraries.Test/Radarr.Libraries.Test.csproj b/src/NzbDrone.Libraries.Test/Radarr.Libraries.Test.csproj index 3a19e7f7a..d9c4c6ebd 100644 --- a/src/NzbDrone.Libraries.Test/Radarr.Libraries.Test.csproj +++ b/src/NzbDrone.Libraries.Test/Radarr.Libraries.Test.csproj @@ -1,6 +1,6 @@ - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Mono.Test/Radarr.Mono.Test.csproj b/src/NzbDrone.Mono.Test/Radarr.Mono.Test.csproj index f8d111e77..e7ce864c4 100644 --- a/src/NzbDrone.Mono.Test/Radarr.Mono.Test.csproj +++ b/src/NzbDrone.Mono.Test/Radarr.Mono.Test.csproj @@ -1,15 +1,12 @@ - net5.0;net472 + net5.0 - - - - + diff --git a/src/NzbDrone.Mono/Radarr.Mono.csproj b/src/NzbDrone.Mono/Radarr.Mono.csproj index b111ef023..6ad39c7fa 100644 --- a/src/NzbDrone.Mono/Radarr.Mono.csproj +++ b/src/NzbDrone.Mono/Radarr.Mono.csproj @@ -1,15 +1,12 @@  - net5.0;net472 + net5.0 - - - - + diff --git a/src/NzbDrone.SignalR/Radarr.SignalR.csproj b/src/NzbDrone.SignalR/Radarr.SignalR.csproj index 34b8f5cbd..25ae75c8c 100644 --- a/src/NzbDrone.SignalR/Radarr.SignalR.csproj +++ b/src/NzbDrone.SignalR/Radarr.SignalR.csproj @@ -1,12 +1,8 @@  - net5.0;net472 + net5.0 Library - - - - diff --git a/src/NzbDrone.SignalR/SignalRMessage.cs b/src/NzbDrone.SignalR/SignalRMessage.cs index 81a0a2b2c..4b468477c 100644 --- a/src/NzbDrone.SignalR/SignalRMessage.cs +++ b/src/NzbDrone.SignalR/SignalRMessage.cs @@ -7,11 +7,7 @@ namespace NzbDrone.SignalR public object Body { get; set; } public string Name { get; set; } -#if !NETCOREAPP - [Newtonsoft.Json.JsonIgnore] -#else [System.Text.Json.Serialization.JsonIgnore] -#endif public ModelAction Action { get; set; } } } diff --git a/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs index 04abf96e9..ecd01a814 100644 --- a/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs +++ b/src/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs @@ -152,9 +152,7 @@ namespace NzbDrone.Test.Common.AutoMoq _registeredMocks = new Dictionary(); AddTheAutoMockingContainerExtensionToTheContainer(container); -#if NETCOREAPP ContainerBuilderBase.RegisterNativeResolver(new[] { "System.Data.SQLite", "Radarr.Core" }); -#endif } private static void AddTheAutoMockingContainerExtensionToTheContainer(IUnityContainer container) diff --git a/src/NzbDrone.Test.Common/NzbDroneRunner.cs b/src/NzbDrone.Test.Common/NzbDroneRunner.cs index 5ad478f40..bf819bee5 100644 --- a/src/NzbDrone.Test.Common/NzbDroneRunner.cs +++ b/src/NzbDrone.Test.Common/NzbDroneRunner.cs @@ -55,8 +55,7 @@ namespace NzbDrone.Test.Common if (BuildInfo.IsDebug) { - var frameworkFolder = PlatformInfo.IsNetCore ? "net5.0" : "net472"; - Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "_output", frameworkFolder, consoleExe)); + Start(Path.Combine(TestContext.CurrentContext.TestDirectory, "..", "..", "_output", "net5.0", consoleExe)); } else { diff --git a/src/NzbDrone.Test.Common/Radarr.Test.Common.csproj b/src/NzbDrone.Test.Common/Radarr.Test.Common.csproj index 97886ca09..ca78ac8b9 100644 --- a/src/NzbDrone.Test.Common/Radarr.Test.Common.csproj +++ b/src/NzbDrone.Test.Common/Radarr.Test.Common.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Test.Dummy/Radarr.Test.Dummy.csproj b/src/NzbDrone.Test.Dummy/Radarr.Test.Dummy.csproj index 0340998df..244fa2aeb 100644 --- a/src/NzbDrone.Test.Dummy/Radarr.Test.Dummy.csproj +++ b/src/NzbDrone.Test.Dummy/Radarr.Test.Dummy.csproj @@ -1,6 +1,6 @@ Exe - net5.0;net472 + net5.0 \ No newline at end of file diff --git a/src/NzbDrone.Update.Test/Radarr.Update.Test.csproj b/src/NzbDrone.Update.Test/Radarr.Update.Test.csproj index 99f1a29d3..69454879d 100644 --- a/src/NzbDrone.Update.Test/Radarr.Update.Test.csproj +++ b/src/NzbDrone.Update.Test/Radarr.Update.Test.csproj @@ -1,6 +1,6 @@ - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Update/Radarr.Update.csproj b/src/NzbDrone.Update/Radarr.Update.csproj index 3b817ef5e..0cf9cb995 100644 --- a/src/NzbDrone.Update/Radarr.Update.csproj +++ b/src/NzbDrone.Update/Radarr.Update.csproj @@ -1,7 +1,7 @@  WinExe - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Windows.Test/Radarr.Windows.Test.csproj b/src/NzbDrone.Windows.Test/Radarr.Windows.Test.csproj index 533eaae66..a0df33019 100644 --- a/src/NzbDrone.Windows.Test/Radarr.Windows.Test.csproj +++ b/src/NzbDrone.Windows.Test/Radarr.Windows.Test.csproj @@ -1,6 +1,6 @@ - net5.0;net472 + net5.0 diff --git a/src/NzbDrone.Windows/Radarr.Windows.csproj b/src/NzbDrone.Windows/Radarr.Windows.csproj index d5a90c741..d73de3665 100644 --- a/src/NzbDrone.Windows/Radarr.Windows.csproj +++ b/src/NzbDrone.Windows/Radarr.Windows.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/NzbDrone/Radarr.csproj b/src/NzbDrone/Radarr.csproj index c0e805297..f9c70c64d 100644 --- a/src/NzbDrone/Radarr.csproj +++ b/src/NzbDrone/Radarr.csproj @@ -1,7 +1,7 @@  WinExe - net5.0-windows;net472 + net5.0-windows win-x64;win-x86 true ..\NzbDrone.Host\Radarr.ico @@ -14,9 +14,6 @@ - - - True diff --git a/src/Radarr.Api.V3/Radarr.Api.V3.csproj b/src/Radarr.Api.V3/Radarr.Api.V3.csproj index f711b51f7..e3ac7c1d2 100644 --- a/src/Radarr.Api.V3/Radarr.Api.V3.csproj +++ b/src/Radarr.Api.V3/Radarr.Api.V3.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/Radarr.Http/Mapping/MappingValidation.cs b/src/Radarr.Http/Mapping/MappingValidation.cs deleted file mode 100644 index 059866919..000000000 --- a/src/Radarr.Http/Mapping/MappingValidation.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Linq; -using System.Reflection; -using NzbDrone.Common.Reflection; -using Radarr.Http.REST; - -namespace Radarr.Http.Mapping -{ - public static class MappingValidation - { - public static void ValidateMapping(Type modelType, Type resourceType) - { - var errors = modelType.GetSimpleProperties().Where(c => !c.GetGetMethod().IsStatic).Select(p => GetError(resourceType, p)).Where(c => c != null).ToList(); - - if (errors.Any()) - { - throw new ResourceMappingException(errors); - } - - PrintExtraProperties(modelType, resourceType); - } - - private static void PrintExtraProperties(Type modelType, Type resourceType) - { - var resourceBaseProperties = typeof(RestResource).GetProperties().Select(c => c.Name); - var resourceProperties = resourceType.GetProperties().Select(c => c.Name).Except(resourceBaseProperties); - var modelProperties = modelType.GetProperties().Select(c => c.Name); - - var extra = resourceProperties.Except(modelProperties); - - foreach (var extraProp in extra) - { - Console.WriteLine("Extra: [{0}]", extraProp); - } - } - - private static string GetError(Type resourceType, PropertyInfo modelProperty) - { - var resourceProperty = resourceType.GetProperties().FirstOrDefault(c => c.Name == modelProperty.Name); - - if (resourceProperty == null) - { - return string.Format("public {0} {1} {{ get; set; }}", modelProperty.PropertyType.Name, modelProperty.Name); - } - - if (resourceProperty.PropertyType != modelProperty.PropertyType && !typeof(RestResource).IsAssignableFrom(resourceProperty.PropertyType)) - { - return string.Format("Expected {0}.{1} to have type of {2} but found {3}", resourceType.Name, resourceProperty.Name, modelProperty.PropertyType, resourceProperty.PropertyType); - } - - return null; - } - } -} diff --git a/src/Radarr.Http/Mapping/ResourceMappingException.cs b/src/Radarr.Http/Mapping/ResourceMappingException.cs deleted file mode 100644 index e200ae678..000000000 --- a/src/Radarr.Http/Mapping/ResourceMappingException.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Radarr.Http.Mapping -{ - public class ResourceMappingException : ApplicationException - { - public ResourceMappingException(IEnumerable error) - : base(Environment.NewLine + string.Join(Environment.NewLine, error.OrderBy(c => c))) - { - } - } -} diff --git a/src/Radarr.Http/Radarr.Http.csproj b/src/Radarr.Http/Radarr.Http.csproj index e235827b6..b7645dcef 100644 --- a/src/Radarr.Http/Radarr.Http.csproj +++ b/src/Radarr.Http/Radarr.Http.csproj @@ -1,6 +1,6 @@  - net5.0;net472 + net5.0 diff --git a/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj index 7aafe20c1..cfe8281cc 100644 --- a/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj +++ b/src/ServiceHelpers/ServiceInstall/ServiceInstall.csproj @@ -1,9 +1,9 @@  WinExe - net5.0;net472 + net5.0 - + diff --git a/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj index 7aafe20c1..cfe8281cc 100644 --- a/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj +++ b/src/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj @@ -1,9 +1,9 @@  WinExe - net5.0;net472 + net5.0 - + diff --git a/src/Targets/FixBindingRedirects.targets b/src/Targets/FixBindingRedirects.targets deleted file mode 100644 index 8b34cfb68..000000000 --- a/src/Targets/FixBindingRedirects.targets +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/Targets/MonoFacades.targets b/src/Targets/MonoFacades.targets deleted file mode 100644 index 7e358209c..000000000 --- a/src/Targets/MonoFacades.targets +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)..\Libraries\Mono\ - - $(ResolveReferencesDependsOn); - SubstituteMonoFacadesBuild - - - - - - - - - - - - - - - - - - %(ReferenceCopyLocalPaths.Identity) - $(MonoFacadesPath)%(Filename)%(Extension) - - - - - - - - - - - - diff --git a/src/Targets/PublishAllRids.targets b/src/Targets/PublishAllRids.targets index e43dd7bfe..98f1b2de9 100644 --- a/src/Targets/PublishAllRids.targets +++ b/src/Targets/PublishAllRids.targets @@ -21,8 +21,6 @@ %(Framework) - - RuntimeIdentifier=%(Renamed.Runtime);TargetFramework=%(Renamed.Framework)