Skip to content

Commit

Permalink
Use collection expressions where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
toebeann committed Oct 2, 2024
1 parent 4002276 commit 21f900e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions Patcher/Patcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> TargetDLLs { get; } = Enumerable.Empty<string>();
public static IEnumerable<string> TargetDLLs { get; } = [];
public static void Patch(AssemblyDefinition _) { }
#endregion

Expand Down Expand Up @@ -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<ModuleDefinition>();
return [];
}
})
.SelectMany(module => module.GetTypeReferences())
Expand Down Expand Up @@ -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<AssetsReplacer>
{
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
Expand Down
4 changes: 2 additions & 2 deletions Plugin/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 21f900e

Please sign in to comment.