From 21f900e93d0e4d9a71718dab245314a41ba1555e Mon Sep 17 00:00:00 2001 From: Tobey Blaber Date: Wed, 2 Oct 2024 12:37:12 +0100 Subject: [PATCH] Use collection expressions where applicable --- Patcher/Patcher.cs | 10 +++++----- Plugin/Plugin.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Patcher/Patcher.cs b/Patcher/Patcher.cs index 16a7417..6c14089 100644 --- a/Patcher/Patcher.cs +++ b/Patcher/Patcher.cs @@ -16,7 +16,7 @@ public static class Patcher { // Without the contents of this region, the patcher will not be loaded by BepInEx - do not remove! #region BepInEx Patcher Contract - public static IEnumerable TargetDLLs { get; } = Enumerable.Empty(); + public static IEnumerable TargetDLLs { get; } = []; public static void Patch(AssemblyDefinition _) { } #endregion @@ -96,7 +96,7 @@ private static bool HasUnityAudioReferences() } catch { // if we couldn't read the assembly it's probably not a .NET assembly anyway, so just ignore it - return Enumerable.Empty(); + return []; } }) .SelectMany(module => module.GetTypeReferences()) @@ -156,10 +156,10 @@ private static void PatchGame() string tempPath = $"{globalGameManagersPath}.tmp"; using (var writer = new AssetsFileWriter(tempPath)) { - ggmInstance.file.Write(writer, 0, new List - { + ggmInstance.file.Write(writer, 0, + [ new AssetsReplacerFromMemory(ggmInstance.file, audioManager, baseField) - }); + ]); } ggmInstance.file.Close(); // close the file so we can overwrite it manager.UnloadAll(); // unload the class package etc. as we're done with them diff --git a/Plugin/Plugin.cs b/Plugin/Plugin.cs index da71171..ba9fa30 100644 --- a/Plugin/Plugin.cs +++ b/Plugin/Plugin.cs @@ -155,14 +155,14 @@ void logFailure(string missingMemberName, string missingMemberType) => yield break; } - var getContent = downloadHandlerAudioClip.OptionalMethod("GetContent", new[] { unityWebRequestType }); + var getContent = downloadHandlerAudioClip.OptionalMethod("GetContent", [unityWebRequestType]); if (!getContent.MethodExists()) { logFailure($"{downloadHandlerAudioClip}:GetContent", "static method"); yield break; } - var getAudioClip = unityWebRequestMultimedia.OptionalMethod("GetAudioClip", new[] { typeof(string), audioTypeType }); + var getAudioClip = unityWebRequestMultimedia.OptionalMethod("GetAudioClip", [typeof(string), audioTypeType]); if (!getAudioClip.MethodExists()) { logFailure($"{unityWebRequestMultimedia}:GetAudioClip", "static method");