From c6b73306b43c8d620d8bfeec4e5841d71f70da08 Mon Sep 17 00:00:00 2001 From: MapleWheels Date: Fri, 6 Dec 2024 19:12:14 -0500 Subject: [PATCH] - Moved assembly extensions to ModUtils.cs --- .../LuaCs/Services/AssemblyManager.cs | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/AssemblyManager.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/AssemblyManager.cs index c7aad0c2db..e2017fbee0 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/AssemblyManager.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/AssemblyManager.cs @@ -756,35 +756,4 @@ public FluentResults.Result Reset() } } -public static class AssemblyExtensions -{ - /// - /// Gets all types in the given assembly. Handles invalid type scenarios. - /// - /// The assembly to scan - /// An enumerable collection of types. - public static IEnumerable GetSafeTypes(this Assembly assembly) - { - // Based on https://github.com/Qkrisi/ktanemodkit/blob/master/Assets/Scripts/ReflectionHelper.cs#L53-L67 - try - { - return assembly.GetTypes(); - } - catch (ReflectionTypeLoadException re) - { - try - { - return re.Types.Where(x => x != null)!; - } - catch (InvalidOperationException) - { - return new List(); - } - } - catch (Exception) - { - return new List(); - } - } -}