Skip to content

Commit 21f900e

Browse files
committed
Use collection expressions where applicable
1 parent 4002276 commit 21f900e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Patcher/Patcher.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static class Patcher
1616
{
1717
// Without the contents of this region, the patcher will not be loaded by BepInEx - do not remove!
1818
#region BepInEx Patcher Contract
19-
public static IEnumerable<string> TargetDLLs { get; } = Enumerable.Empty<string>();
19+
public static IEnumerable<string> TargetDLLs { get; } = [];
2020
public static void Patch(AssemblyDefinition _) { }
2121
#endregion
2222

@@ -96,7 +96,7 @@ private static bool HasUnityAudioReferences()
9696
}
9797
catch
9898
{ // if we couldn't read the assembly it's probably not a .NET assembly anyway, so just ignore it
99-
return Enumerable.Empty<ModuleDefinition>();
99+
return [];
100100
}
101101
})
102102
.SelectMany(module => module.GetTypeReferences())
@@ -156,10 +156,10 @@ private static void PatchGame()
156156
string tempPath = $"{globalGameManagersPath}.tmp";
157157
using (var writer = new AssetsFileWriter(tempPath))
158158
{
159-
ggmInstance.file.Write(writer, 0, new List<AssetsReplacer>
160-
{
159+
ggmInstance.file.Write(writer, 0,
160+
[
161161
new AssetsReplacerFromMemory(ggmInstance.file, audioManager, baseField)
162-
});
162+
]);
163163
}
164164
ggmInstance.file.Close(); // close the file so we can overwrite it
165165
manager.UnloadAll(); // unload the class package etc. as we're done with them

Plugin/Plugin.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ void logFailure(string missingMemberName, string missingMemberType) =>
155155
yield break;
156156
}
157157

158-
var getContent = downloadHandlerAudioClip.OptionalMethod("GetContent", new[] { unityWebRequestType });
158+
var getContent = downloadHandlerAudioClip.OptionalMethod("GetContent", [unityWebRequestType]);
159159
if (!getContent.MethodExists())
160160
{
161161
logFailure($"{downloadHandlerAudioClip}:GetContent", "static method");
162162
yield break;
163163
}
164164

165-
var getAudioClip = unityWebRequestMultimedia.OptionalMethod("GetAudioClip", new[] { typeof(string), audioTypeType });
165+
var getAudioClip = unityWebRequestMultimedia.OptionalMethod("GetAudioClip", [typeof(string), audioTypeType]);
166166
if (!getAudioClip.MethodExists())
167167
{
168168
logFailure($"{unityWebRequestMultimedia}:GetAudioClip", "static method");

0 commit comments

Comments
 (0)