From 51ead23bfb30abd87e6084676a61d4fb933191cd Mon Sep 17 00:00:00 2001 From: Aptivi Date: Sun, 28 Jul 2024 17:52:50 +0300 Subject: [PATCH] chg - Restored fix for .NET Framework --- Type: chg Breaking: False Doc Required: False Backport Required: False Part: 1/1 --- BassBoom.Basolia/File/FileTools.cs | 6 +++--- BassBoom.Basolia/Radio/RadioTools.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BassBoom.Basolia/File/FileTools.cs b/BassBoom.Basolia/File/FileTools.cs index e3ea834..3ae3766 100644 --- a/BassBoom.Basolia/File/FileTools.cs +++ b/BassBoom.Basolia/File/FileTools.cs @@ -24,6 +24,7 @@ using BassBoom.Native.Interop.Play; using System.Linq; using System.Net.Http; +using System.Runtime.InteropServices; using System.Threading.Tasks; namespace BassBoom.Basolia.File @@ -124,9 +125,8 @@ public static async Task OpenUrlAsync(string path) throw new BasoliaException("Provide a path to a music file or a radio station", mpg123_errors.MPG123_BAD_FILE); // Check to see if the radio station exists -#if NET48 - RadioTools.client = new(); -#endif + if (RuntimeInformation.FrameworkDescription.Contains("Framework")) + RadioTools.client = new(); RadioTools.client.DefaultRequestHeaders.Add("Icy-MetaData", "1"); var reply = await RadioTools.client.GetAsync(path, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); RadioTools.client.DefaultRequestHeaders.Remove("Icy-MetaData"); diff --git a/BassBoom.Basolia/Radio/RadioTools.cs b/BassBoom.Basolia/Radio/RadioTools.cs index 5abbf76..0ed05ed 100644 --- a/BassBoom.Basolia/Radio/RadioTools.cs +++ b/BassBoom.Basolia/Radio/RadioTools.cs @@ -20,6 +20,7 @@ using System; using System.Linq; using System.Net.Http; +using System.Runtime.InteropServices; using System.Threading.Tasks; namespace BassBoom.Basolia.Radio @@ -52,9 +53,8 @@ public static async Task GetRadioInfoAsync(string radioUrl) var uri = new Uri(radioUrl); // Check to see if the radio station exists -#if NET48 - client = new(); -#endif + if (RuntimeInformation.FrameworkDescription.Contains("Framework")) + client = new(); client.DefaultRequestHeaders.Add("Icy-MetaData", "1"); var reply = await client.GetAsync(radioUrl, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); client.DefaultRequestHeaders.Remove("Icy-MetaData");