From bb7e5bc02c5a44e4e8d481cd165b5afa54f7c903 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Mon, 2 Jun 2025 10:10:51 +1000 Subject: [PATCH] Add Meziantou.Polyfill --- Directory.Packages.props | 1 + .../D3D11/D3D11GLInterop.cs | 1 - .../KeyMouseInput/RawKeyMouseInput.cs | 1 - .../KeyMouseInput/X11KeyMouseInput.cs | 1 - .../Api/Classes/EmulationApi.cs | 1 - .../Api/Classes/InputApi.cs | 1 - .../Api/Classes/JoypadApi.cs | 1 - .../Api/Classes/UserDataApi.cs | 5 --- .../DisplayManager/Filters/Retro.cs | 1 - .../FilesystemFilterSet.cs | 2 -- src/BizHawk.Client.Common/OpenAdvanced.cs | 2 -- src/BizHawk.Client.Common/config/Binding.cs | 2 -- .../controllers/AutofireController.cs | 1 - .../controllers/SimpleController.cs | 1 - .../lua/NLuaTableHelper.cs | 2 -- .../movie/BasicMovieInfo.cs | 1 - .../movie/MovieConversionExtensions.cs | 1 - .../movie/bk2/Bk2Controller.cs | 2 -- .../movie/bk2/Bk2Header.cs | 2 -- .../movie/import/BkmImport.cs | 3 +- .../movie/import/bkm/BkmControllerAdapter.cs | 1 - .../import/bkm/BkmControllerDefinition.cs | 2 +- .../movie/import/bkm/BkmMovie.cs | 2 -- .../movie/tasproj/TasMovie.Editing.cs | 1 - .../movie/tasproj/TasMovie.IO.cs | 2 -- .../Extensions/ToolExtensions.cs | 1 - src/BizHawk.Client.EmuHawk/Input/Input.cs | 1 - src/BizHawk.Client.EmuHawk/PlatformChooser.cs | 1 - .../config/ControllerConfig.cs | 1 - .../config/FileExtensionPreferences.cs | 2 -- .../config/FileExtensionPreferencesPicker.cs | 1 - .../config/HotkeyConfig.cs | 1 - .../config/NES/DataTableDictionaryBind.cs | 2 -- .../debug/DebugMenuItems.cs | 7 +--- src/BizHawk.Client.EmuHawk/tools/CDL.cs | 1 - .../tools/Debugger/RegisterBoxControl.cs | 1 - .../tools/TAStudio/TAStudio.ListView.cs | 1 - .../Extensions/CollectionExtensions.cs | 34 ------------------- src/BizHawk.Common/Extensions/IOExtensions.cs | 5 --- .../Extensions/StringExtensions.cs | 21 ------------ src/BizHawk.Common/Util.cs | 8 ----- .../Base Implementations/Bk2MnemonicLookup.cs | 1 - .../Base Implementations/CodeDataLog.cs | 2 -- .../ControllerDefinition.cs | 1 - .../ControllerDefinitionMerger.cs | 2 -- src/BizHawk.Emulation.Common/N3DSHasher.cs | 1 - .../SaveController.cs | 3 -- src/BizHawk.Emulation.Common/VSystemID.cs | 2 -- .../Consoles/Nintendo/NDS/MelonDS.cs | 1 - .../DiscFormats/CCD_format.cs | 2 +- .../Movie/ZwinderStateManagerTests.cs | 3 -- .../config/CorePickerStabilityTests.cs | 1 - .../config/SerializationStabilityTests.cs | 3 -- .../Database/FirmwareDatabaseTests.cs | 3 -- src/MainSlnCommon.props | 2 ++ 55 files changed, 7 insertions(+), 148 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 439384498f..1985150c37 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,6 +9,7 @@ + diff --git a/src/BizHawk.Bizware.Graphics/D3D11/D3D11GLInterop.cs b/src/BizHawk.Bizware.Graphics/D3D11/D3D11GLInterop.cs index 1ac313bf75..9aa9a4d86a 100644 --- a/src/BizHawk.Bizware.Graphics/D3D11/D3D11GLInterop.cs +++ b/src/BizHawk.Bizware.Graphics/D3D11/D3D11GLInterop.cs @@ -7,7 +7,6 @@ using Vortice.Direct3D11; using Vortice.DXGI; using BizHawk.Common.CollectionExtensions; -using BizHawk.Common.StringExtensions; using static SDL2.SDL; diff --git a/src/BizHawk.Bizware.Input/KeyMouseInput/RawKeyMouseInput.cs b/src/BizHawk.Bizware.Input/KeyMouseInput/RawKeyMouseInput.cs index 3968cbc45b..e3aa9433be 100644 --- a/src/BizHawk.Bizware.Input/KeyMouseInput/RawKeyMouseInput.cs +++ b/src/BizHawk.Bizware.Input/KeyMouseInput/RawKeyMouseInput.cs @@ -5,7 +5,6 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BizHawk.Common; -using BizHawk.Common.CollectionExtensions; using static BizHawk.Common.RawInputImports; using static BizHawk.Common.WmImports; diff --git a/src/BizHawk.Bizware.Input/KeyMouseInput/X11KeyMouseInput.cs b/src/BizHawk.Bizware.Input/KeyMouseInput/X11KeyMouseInput.cs index be57eff14c..bf94e00bca 100644 --- a/src/BizHawk.Bizware.Input/KeyMouseInput/X11KeyMouseInput.cs +++ b/src/BizHawk.Bizware.Input/KeyMouseInput/X11KeyMouseInput.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Runtime.InteropServices; using BizHawk.Common; -using BizHawk.Common.CollectionExtensions; using static BizHawk.Common.XInput2Imports; using static BizHawk.Common.XlibImports; diff --git a/src/BizHawk.Client.Common/Api/Classes/EmulationApi.cs b/src/BizHawk.Client.Common/Api/Classes/EmulationApi.cs index b65f421bc3..6a55b209d8 100644 --- a/src/BizHawk.Client.Common/Api/Classes/EmulationApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/EmulationApi.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using BizHawk.Common; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES; using BizHawk.Emulation.Cores.Consoles.Sega.gpgx; diff --git a/src/BizHawk.Client.Common/Api/Classes/InputApi.cs b/src/BizHawk.Client.Common/Api/Classes/InputApi.cs index 3ad03edee8..b4ba83563e 100644 --- a/src/BizHawk.Client.Common/Api/Classes/InputApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/InputApi.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common; using BizHawk.Common.CollectionExtensions; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs index d508d926da..1bfbba7315 100644 --- a/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/JoypadApi.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; -using BizHawk.Common; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/Api/Classes/UserDataApi.cs b/src/BizHawk.Client.Common/Api/Classes/UserDataApi.cs index 03f9e2ba71..0fc959b340 100644 --- a/src/BizHawk.Client.Common/Api/Classes/UserDataApi.cs +++ b/src/BizHawk.Client.Common/Api/Classes/UserDataApi.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using System.Linq; #if NET5_0_OR_GREATER using KeyCollectionType = System.Collections.Generic.IReadOnlySet; @@ -18,11 +17,7 @@ namespace BizHawk.Client.Common get { ICollection keys = _movieSession.UserBag.Keys; -#if NET5_0_OR_GREATER return (keys as KeyCollectionType) ?? keys.ToHashSet(); -#else - return (keys as KeyCollectionType) ?? keys.ToList(); -#endif } } diff --git a/src/BizHawk.Client.Common/DisplayManager/Filters/Retro.cs b/src/BizHawk.Client.Common/DisplayManager/Filters/Retro.cs index 3f0eef1ab7..3348e09932 100644 --- a/src/BizHawk.Client.Common/DisplayManager/Filters/Retro.cs +++ b/src/BizHawk.Client.Common/DisplayManager/Filters/Retro.cs @@ -10,7 +10,6 @@ using System.Numerics; using System.Text.RegularExpressions; using BizHawk.Bizware.Graphics; -using BizHawk.Common; using BizHawk.Common.StringExtensions; using BizHawk.Client.Common.FilterManager; diff --git a/src/BizHawk.Client.Common/FilesystemFilterSet.cs b/src/BizHawk.Client.Common/FilesystemFilterSet.cs index f29314e55c..f1a41b07ff 100644 --- a/src/BizHawk.Client.Common/FilesystemFilterSet.cs +++ b/src/BizHawk.Client.Common/FilesystemFilterSet.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common.CollectionExtensions; - namespace BizHawk.Client.Common { public sealed class FilesystemFilterSet diff --git a/src/BizHawk.Client.Common/OpenAdvanced.cs b/src/BizHawk.Client.Common/OpenAdvanced.cs index 490422d9d2..71c09fd390 100644 --- a/src/BizHawk.Client.Common/OpenAdvanced.cs +++ b/src/BizHawk.Client.Common/OpenAdvanced.cs @@ -1,7 +1,5 @@ using System.IO; -using BizHawk.Common.StringExtensions; - using Newtonsoft.Json; //this file contains some cumbersome self-"serialization" in order to gain a modicum of control over what the serialized output looks like diff --git a/src/BizHawk.Client.Common/config/Binding.cs b/src/BizHawk.Client.Common/config/Binding.cs index b756ec5805..7989f8fcd2 100644 --- a/src/BizHawk.Client.Common/config/Binding.cs +++ b/src/BizHawk.Client.Common/config/Binding.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common; - namespace BizHawk.Client.Common { public class HotkeyInfo diff --git a/src/BizHawk.Client.Common/controllers/AutofireController.cs b/src/BizHawk.Client.Common/controllers/AutofireController.cs index affc7ddb7b..c04b5054f5 100644 --- a/src/BizHawk.Client.Common/controllers/AutofireController.cs +++ b/src/BizHawk.Client.Common/controllers/AutofireController.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common; using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; diff --git a/src/BizHawk.Client.Common/controllers/SimpleController.cs b/src/BizHawk.Client.Common/controllers/SimpleController.cs index fe99315390..2b698878a2 100644 --- a/src/BizHawk.Client.Common/controllers/SimpleController.cs +++ b/src/BizHawk.Client.Common/controllers/SimpleController.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs b/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs index 67d60b0e41..1346ac76d1 100644 --- a/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs +++ b/src/BizHawk.Client.Common/lua/NLuaTableHelper.cs @@ -3,8 +3,6 @@ using System.Drawing; using System.Globalization; using System.Linq; -using BizHawk.Common; - using NLua; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/BasicMovieInfo.cs b/src/BizHawk.Client.Common/movie/BasicMovieInfo.cs index b9172fa585..ebc7571938 100644 --- a/src/BizHawk.Client.Common/movie/BasicMovieInfo.cs +++ b/src/BizHawk.Client.Common/movie/BasicMovieInfo.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using BizHawk.Common.StringExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs b/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs index 04cb68792c..f249710468 100644 --- a/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs +++ b/src/BizHawk.Client.Common/movie/MovieConversionExtensions.cs @@ -1,7 +1,6 @@ using System.IO; using System.Linq; -using BizHawk.Common; using BizHawk.Common.PathExtensions; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Controller.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Controller.cs index 62b9c0f5e3..f2c6a342e6 100755 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Controller.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Controller.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common; -using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Header.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Header.cs index 4a6bd55d59..01717f85ed 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Header.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Header.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.Text; -using BizHawk.Common; - namespace BizHawk.Client.Common { public class Bk2Header : Dictionary diff --git a/src/BizHawk.Client.Common/movie/import/BkmImport.cs b/src/BizHawk.Client.Common/movie/import/BkmImport.cs index d45dc2fc63..4831e13006 100644 --- a/src/BizHawk.Client.Common/movie/import/BkmImport.cs +++ b/src/BizHawk.Client.Common/movie/import/BkmImport.cs @@ -1,5 +1,4 @@ -using BizHawk.Common; -using BizHawk.Emulation.Common; +using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores; namespace BizHawk.Client.Common.movie.import diff --git a/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerAdapter.cs b/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerAdapter.cs index 9e164cafa5..c7979d9f03 100644 --- a/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerAdapter.cs +++ b/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerAdapter.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerDefinition.cs b/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerDefinition.cs index 97e181015b..184b51f202 100644 --- a/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerDefinition.cs +++ b/src/BizHawk.Client.Common/movie/import/bkm/BkmControllerDefinition.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using BizHawk.Common; + using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs b/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs index b7b5952283..f9b0a3bec4 100644 --- a/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs +++ b/src/BizHawk.Client.Common/movie/import/bkm/BkmMovie.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.IO; -using BizHawk.Common.StringExtensions; - namespace BizHawk.Client.Common { internal class BkmMovie diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs index 4917ea1007..9b72f80127 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; -using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs index 492b3fe07c..64f61c65a5 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs @@ -1,7 +1,5 @@ using System.IO; -using BizHawk.Common.StringExtensions; - using Newtonsoft.Json; namespace BizHawk.Client.Common diff --git a/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs b/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs index 94afebcbe5..7d76132743 100644 --- a/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs +++ b/src/BizHawk.Client.EmuHawk/Extensions/ToolExtensions.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Windows.Forms; using BizHawk.Common; -using BizHawk.Common.StringExtensions; using BizHawk.Emulation.Common; using BizHawk.Client.Common; diff --git a/src/BizHawk.Client.EmuHawk/Input/Input.cs b/src/BizHawk.Client.EmuHawk/Input/Input.cs index 750f90c169..23c47126f9 100644 --- a/src/BizHawk.Client.EmuHawk/Input/Input.cs +++ b/src/BizHawk.Client.EmuHawk/Input/Input.cs @@ -4,7 +4,6 @@ using System.Threading; using System.Windows.Forms; using BizHawk.Bizware.Input; -using BizHawk.Common; using BizHawk.Client.Common; using BizHawk.Common.CollectionExtensions; diff --git a/src/BizHawk.Client.EmuHawk/PlatformChooser.cs b/src/BizHawk.Client.EmuHawk/PlatformChooser.cs index 7767ffb66e..ab7329b52c 100644 --- a/src/BizHawk.Client.EmuHawk/PlatformChooser.cs +++ b/src/BizHawk.Client.EmuHawk/PlatformChooser.cs @@ -4,7 +4,6 @@ using System.Windows.Forms; using BizHawk.Emulation.Common; using BizHawk.Client.Common; -using BizHawk.Common; namespace BizHawk.Client.EmuHawk { diff --git a/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs b/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs index 5ce917070f..cacc90d73b 100644 --- a/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/ControllerConfig.cs @@ -7,7 +7,6 @@ using System.Windows.Forms; using BizHawk.Bizware.Input; using BizHawk.Client.Common; -using BizHawk.Common; using BizHawk.Common.CollectionExtensions; using BizHawk.Emulation.Common; diff --git a/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferences.cs b/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferences.cs index f8d2330b81..63a7b4ce4c 100644 --- a/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferences.cs +++ b/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferences.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -using BizHawk.Common; - namespace BizHawk.Client.EmuHawk { public partial class FileExtensionPreferences : Form diff --git a/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferencesPicker.cs b/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferencesPicker.cs index d1032bce46..f557219e80 100644 --- a/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferencesPicker.cs +++ b/src/BizHawk.Client.EmuHawk/config/FileExtensionPreferencesPicker.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -using BizHawk.Common; using BizHawk.Emulation.Common; namespace BizHawk.Client.EmuHawk diff --git a/src/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs b/src/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs index 6174fef822..05cb11b014 100644 --- a/src/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs +++ b/src/BizHawk.Client.EmuHawk/config/HotkeyConfig.cs @@ -5,7 +5,6 @@ using System.Windows.Forms; using BizHawk.Bizware.Input; using BizHawk.Client.Common; -using BizHawk.Common; using BizHawk.Common.CollectionExtensions; using BizHawk.Common.StringExtensions; diff --git a/src/BizHawk.Client.EmuHawk/config/NES/DataTableDictionaryBind.cs b/src/BizHawk.Client.EmuHawk/config/NES/DataTableDictionaryBind.cs index 6439914eae..ec366ad3a9 100644 --- a/src/BizHawk.Client.EmuHawk/config/NES/DataTableDictionaryBind.cs +++ b/src/BizHawk.Client.EmuHawk/config/NES/DataTableDictionaryBind.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.Data; -using BizHawk.Common; - namespace BizHawk.Client.EmuHawk { public class DataTableDictionaryBind diff --git a/src/BizHawk.Client.EmuHawk/debug/DebugMenuItems.cs b/src/BizHawk.Client.EmuHawk/debug/DebugMenuItems.cs index b87977a3cc..a99412ebf7 100644 --- a/src/BizHawk.Client.EmuHawk/debug/DebugMenuItems.cs +++ b/src/BizHawk.Client.EmuHawk/debug/DebugMenuItems.cs @@ -27,12 +27,7 @@ namespace BizHawk.Client.EmuHawk.ForDebugging public DebugVSystemMenuItem(string sysID, params string[] extraSysIDs) { - SysIDs = new[] { sysID }.Concat(extraSysIDs) -#if NET472_OR_GREATER || NETCOREAPP2_0_OR_GREATER - .ToHashSet(); -#else // Meziantou.Polyfill covers `IEnumerable<>.ToHashSet` but we're not using that at time of writing --yoshi - .ToArray(); -#endif + SysIDs = extraSysIDs.Prepend(sysID).ToHashSet(); Text = sysID; } } diff --git a/src/BizHawk.Client.EmuHawk/tools/CDL.cs b/src/BizHawk.Client.EmuHawk/tools/CDL.cs index a67d7f673d..5c12ce5572 100644 --- a/src/BizHawk.Client.EmuHawk/tools/CDL.cs +++ b/src/BizHawk.Client.EmuHawk/tools/CDL.cs @@ -7,7 +7,6 @@ using BizHawk.Emulation.Common; using BizHawk.Client.Common; using BizHawk.Client.EmuHawk.Properties; using BizHawk.Client.EmuHawk.ToolExtensions; -using BizHawk.Common; // TODO - select which memorydomains go out to the CDL file. will this cause a problem when re-importing it? // perhaps missing domains shouldn't fail a check diff --git a/src/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs b/src/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs index 241de16c28..293b626ce6 100644 --- a/src/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/Debugger/RegisterBoxControl.cs @@ -2,7 +2,6 @@ using System.Drawing; using System.Linq; using System.Windows.Forms; -using BizHawk.Common; using BizHawk.Common.NumberExtensions; using BizHawk.Emulation.Common; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 6d09877b73..770481fe4c 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -8,7 +8,6 @@ using BizHawk.Common.NumberExtensions; using BizHawk.Client.Common; using BizHawk.Common; using BizHawk.Common.CollectionExtensions; -using BizHawk.Common.StringExtensions; namespace BizHawk.Client.EmuHawk { diff --git a/src/BizHawk.Common/Extensions/CollectionExtensions.cs b/src/BizHawk.Common/Extensions/CollectionExtensions.cs index 354fa32e31..ff80ee2192 100644 --- a/src/BizHawk.Common/Extensions/CollectionExtensions.cs +++ b/src/BizHawk.Common/Extensions/CollectionExtensions.cs @@ -220,24 +220,6 @@ namespace BizHawk.Common.CollectionExtensions ? countable.Count == n : collection.Take(n + 1).Count() == n; -#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_0_OR_GREATER) - /// - /// Returns the value at . - /// If the key is not present, returns default(TValue). - /// backported from .NET Core 2.0 - /// - public static TValue? GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key) - => dictionary.TryGetValue(key, out var found) ? found : default; - - /// - /// Returns the value at . - /// If the key is not present, returns . - /// backported from .NET Core 2.0 - /// - public static TValue? GetValueOrDefault(this IReadOnlyDictionary dictionary, TKey key, TValue defaultValue) - => dictionary.TryGetValue(key, out var found) ? found : defaultValue; -#endif - /// /// Returns the value at . /// If the key is not present, stores the result of defaultValue(key) in the dict, and then returns that. @@ -392,18 +374,6 @@ namespace BizHawk.Common.CollectionExtensions return null; } -#if !NET7_0_OR_GREATER - /// shorthand for this.OrderBy(static e => e), backported from .NET 7 - public static IOrderedEnumerable Order(this IEnumerable source) - where T : IComparable - => source.OrderBy(ReturnSelf); - - /// shorthand for this.OrderByDescending(static e => e), backported from .NET 7 - public static IOrderedEnumerable OrderDescending(this IEnumerable source) - where T : IComparable - => source.OrderByDescending(ReturnSelf); -#endif - /// iff any removed public static bool RemoveAll(this ICollection collection, T item) { @@ -455,10 +425,6 @@ namespace BizHawk.Common.CollectionExtensions return c - list.Count; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static T ReturnSelf(this T self) - => self; - public static bool ReversedSequenceEqual(this ReadOnlySpan a, ReadOnlySpan b) where T : IEquatable { diff --git a/src/BizHawk.Common/Extensions/IOExtensions.cs b/src/BizHawk.Common/Extensions/IOExtensions.cs index 841d819bf2..08982f8ef3 100644 --- a/src/BizHawk.Common/Extensions/IOExtensions.cs +++ b/src/BizHawk.Common/Extensions/IOExtensions.cs @@ -13,11 +13,6 @@ namespace BizHawk.Common.IOExtensions public static Span GetBufferAsSpan(this MemoryStream ms) => ms.GetBuffer().AsSpan().Slice(start: 0, length: (int) ms.Length); - public static unsafe string GetString(this Encoding encoding, ReadOnlySpan bytes) - { - fixed (byte* p = bytes) return encoding.GetString(p, bytes.Length); - } - /// does NOT seek to beginning public static byte[] ReadAllBytes(this Stream stream) { diff --git a/src/BizHawk.Common/Extensions/StringExtensions.cs b/src/BizHawk.Common/Extensions/StringExtensions.cs index 05b87ecb32..9fee6c9856 100644 --- a/src/BizHawk.Common/Extensions/StringExtensions.cs +++ b/src/BizHawk.Common/Extensions/StringExtensions.cs @@ -14,14 +14,6 @@ namespace BizHawk.Common.StringExtensions return new(a); } -#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER) - public static bool Contains(this string haystack, char needle) - => haystack.IndexOf(needle) >= 0; - - public static bool Contains(this string haystack, string needle, StringComparison comparisonType) - => haystack.IndexOf(needle, comparisonType) != -1; -#endif - /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool ContainsIgnoreCase(this string haystack, string needle) @@ -35,11 +27,6 @@ namespace BizHawk.Common.StringExtensions public static bool ContainsOrdinal(this string haystack, string needle) => haystack.Contains(needle); // already ordinal -#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER) - public static bool EndsWith(this string haystack, char needle) - => haystack.Length >= 1 && haystack[^1] == needle; -#endif - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool EndsWithOrdinal(this string haystack, char needle) => haystack.EndsWith(needle); // already ordinal @@ -140,14 +127,6 @@ namespace BizHawk.Common.StringExtensions /// public static string RemoveSuffix(this string str, string suffix, string notFoundValue) => str.EndsWith(suffix, StringComparison.Ordinal) ? str.Substring(0, str.Length - suffix.Length) : notFoundValue; - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool StartsWith(this ReadOnlySpan str, char c) - => str.Length >= 1 && str[0] == c; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool StartsWith(this string str, char c) - => str.Length >= 1 && str[0] == c; - /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool StartsWithIgnoreCase(this string haystack, string needle) diff --git a/src/BizHawk.Common/Util.cs b/src/BizHawk.Common/Util.cs index d8aaab16a8..c65f1b8b16 100644 --- a/src/BizHawk.Common/Util.cs +++ b/src/BizHawk.Common/Util.cs @@ -66,14 +66,6 @@ namespace BizHawk.Common return data; } -#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_0_OR_GREATER) - public static void Deconstruct(this KeyValuePair kvp, out TKey key, out TValue value) - { - key = kvp.Key; - value = kvp.Value; - } -#endif - /// adapted from https://stackoverflow.com/a/3928856/7467292, values are compared using EqualityComparer.Default public static bool DictionaryEqual(IDictionary a, IDictionary b) where TKey : notnull diff --git a/src/BizHawk.Emulation.Common/Base Implementations/Bk2MnemonicLookup.cs b/src/BizHawk.Emulation.Common/Base Implementations/Bk2MnemonicLookup.cs index 1e6122d617..45705ea21d 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/Bk2MnemonicLookup.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/Bk2MnemonicLookup.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Diagnostics; -using BizHawk.Common; using BizHawk.Common.StringExtensions; namespace BizHawk.Emulation.Common diff --git a/src/BizHawk.Emulation.Common/Base Implementations/CodeDataLog.cs b/src/BizHawk.Emulation.Common/Base Implementations/CodeDataLog.cs index 729a489ad2..3a5b434676 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/CodeDataLog.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/CodeDataLog.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; -using BizHawk.Common; - namespace BizHawk.Emulation.Common { /// diff --git a/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs b/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs index bb2a6608a9..996ff3286e 100644 --- a/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs +++ b/src/BizHawk.Emulation.Common/Base Implementations/ControllerDefinition.cs @@ -3,7 +3,6 @@ using System.Collections.Immutable; using System.Linq; using System.Text.RegularExpressions; -using BizHawk.Common; using BizHawk.Common.CollectionExtensions; using BizHawk.Common.StringExtensions; diff --git a/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs b/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs index 402d220233..bdb934c19e 100644 --- a/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs +++ b/src/BizHawk.Emulation.Common/ControllerDefinitionMerger.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; -using BizHawk.Common; - namespace BizHawk.Emulation.Common { // the idea here is that various connected peripherals have their controls all merged diff --git a/src/BizHawk.Emulation.Common/N3DSHasher.cs b/src/BizHawk.Emulation.Common/N3DSHasher.cs index c9bdc57c52..f65d277b1d 100644 --- a/src/BizHawk.Emulation.Common/N3DSHasher.cs +++ b/src/BizHawk.Emulation.Common/N3DSHasher.cs @@ -8,7 +8,6 @@ using System.Text; using BizHawk.Common; using BizHawk.Common.BufferExtensions; -using BizHawk.Common.IOExtensions; using BizHawk.Common.NumberExtensions; using BizHawk.Common.StringExtensions; diff --git a/src/BizHawk.Emulation.Common/SaveController.cs b/src/BizHawk.Emulation.Common/SaveController.cs index e9b251dc96..92ba307fcb 100644 --- a/src/BizHawk.Emulation.Common/SaveController.cs +++ b/src/BizHawk.Emulation.Common/SaveController.cs @@ -3,9 +3,6 @@ using System.Collections.Generic; using System.IO; -using BizHawk.Common; -using BizHawk.Common.CollectionExtensions; - namespace BizHawk.Emulation.Common { /// diff --git a/src/BizHawk.Emulation.Common/VSystemID.cs b/src/BizHawk.Emulation.Common/VSystemID.cs index 88fda12860..f3936b68f5 100644 --- a/src/BizHawk.Emulation.Common/VSystemID.cs +++ b/src/BizHawk.Emulation.Common/VSystemID.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using BizHawk.Common.CollectionExtensions; - namespace BizHawk.Emulation.Common { /// diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs index fc0d4e1a1d..c046e72fc1 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs @@ -12,7 +12,6 @@ using BizHawk.BizInvoke; using BizHawk.Common; using BizHawk.Common.IOExtensions; using BizHawk.Common.NumberExtensions; -using BizHawk.Common.StringExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Properties; using BizHawk.Emulation.Cores.Waterbox; diff --git a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs index e8b6b7b00b..9f1757554d 100644 --- a/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs +++ b/src/BizHawk.Emulation.DiscSystem/DiscFormats/CCD_format.cs @@ -2,7 +2,7 @@ using System.IO; using System.Globalization; using System.Collections.Generic; using System.Linq; -using BizHawk.Common; + using BizHawk.Common.StringExtensions; //check out ccd2iso linux program? diff --git a/src/BizHawk.Tests/Client.Common/Movie/ZwinderStateManagerTests.cs b/src/BizHawk.Tests/Client.Common/Movie/ZwinderStateManagerTests.cs index d6a14241a1..0f863a7904 100644 --- a/src/BizHawk.Tests/Client.Common/Movie/ZwinderStateManagerTests.cs +++ b/src/BizHawk.Tests/Client.Common/Movie/ZwinderStateManagerTests.cs @@ -26,9 +26,6 @@ namespace BizHawk.Tests.Client.Common.Movie public static void Write(this BinaryWriter bw, ReadOnlySpan buf) => bw.Write(buf.ToArray()); - - public static void Write(this Stream stream, ReadOnlySpan buf) - => stream.Write(buf.ToArray(), offset: 0, count: buf.Length); } #endif diff --git a/src/BizHawk.Tests/Client.Common/config/CorePickerStabilityTests.cs b/src/BizHawk.Tests/Client.Common/config/CorePickerStabilityTests.cs index 38f8ef1afc..81d33b6905 100644 --- a/src/BizHawk.Tests/Client.Common/config/CorePickerStabilityTests.cs +++ b/src/BizHawk.Tests/Client.Common/config/CorePickerStabilityTests.cs @@ -2,7 +2,6 @@ using System.Linq; using BizHawk.Client.Common; -using BizHawk.Common; using BizHawk.Emulation.Cores; namespace BizHawk.Tests.Client.Common.config diff --git a/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs b/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs index bf49fed205..64d6d0bbcc 100644 --- a/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs +++ b/src/BizHawk.Tests/Client.Common/config/SerializationStabilityTests.cs @@ -3,9 +3,6 @@ using System.Drawing; using System.Reflection; using BizHawk.Client.Common; -#if !(NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_0_OR_GREATER) -using BizHawk.Common; -#endif using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs b/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs index 916d1d6996..602923868d 100644 --- a/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs +++ b/src/BizHawk.Tests/Emulation.Common/Database/FirmwareDatabaseTests.cs @@ -1,9 +1,6 @@ using System.Collections.Generic; using System.Linq; -#if !NET7_0_OR_GREATER -using BizHawk.Common.CollectionExtensions; -#endif using BizHawk.Common.StringExtensions; using BizHawk.Emulation.Common; diff --git a/src/MainSlnCommon.props b/src/MainSlnCommon.props index 1ea37b1559..93c41dbd54 100644 --- a/src/MainSlnCommon.props +++ b/src/MainSlnCommon.props @@ -8,6 +8,7 @@ false embedded $(DefineConstants);AVI_SUPPORT + T:System.Diagnostics.CodeAnalysis.ExperimentalAttribute|T:System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute|T:System.Diagnostics.CodeAnalysis.StringSyntaxAttribute|T:System.Diagnostics.CodeAnalysis.UnscopedRefAttribute|T:System.Index|T:System.Range|T:System.Runtime.CompilerServices.CallerArgumentExpressionAttribute|T:System.Runtime.CompilerServices.CollectionBuilderAttribute|T:System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute|T:System.Runtime.CompilerServices.InterpolatedStringHandlerArgumentAttribute|T:System.Runtime.CompilerServices.InterpolatedStringHandlerAttribute|T:System.Runtime.CompilerServices.IsExternalInit|T:System.Runtime.CompilerServices.ModuleInitializerAttribute|T:System.Runtime.CompilerServices.OverloadResolutionPriorityAttribute|T:System.Runtime.CompilerServices.RequiredMemberAttribute|T:System.Runtime.CompilerServices.SkipLocalsInitAttribute|T:System.Runtime.Versioning.RequiresPreviewFeaturesAttribute en-US $(NoWarn);CS1573;NU1702 BizHawk @@ -18,6 +19,7 @@ $(SolutionDir)=/ +