Skip to content

Commit cd1e199

Browse files
- Moved assembly extensions to ModUtils.cs
1 parent 1af9dc1 commit cd1e199

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/AssemblyManager.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -756,35 +756,4 @@ public FluentResults.Result Reset()
756756
}
757757
}
758758

759-
public static class AssemblyExtensions
760-
{
761-
/// <summary>
762-
/// Gets all types in the given assembly. Handles invalid type scenarios.
763-
/// </summary>
764-
/// <param name="assembly">The assembly to scan</param>
765-
/// <returns>An enumerable collection of types.</returns>
766-
public static IEnumerable<Type> GetSafeTypes(this Assembly assembly)
767-
{
768-
// Based on https://github.com/Qkrisi/ktanemodkit/blob/master/Assets/Scripts/ReflectionHelper.cs#L53-L67
769759

770-
try
771-
{
772-
return assembly.GetTypes();
773-
}
774-
catch (ReflectionTypeLoadException re)
775-
{
776-
try
777-
{
778-
return re.Types.Where(x => x != null)!;
779-
}
780-
catch (InvalidOperationException)
781-
{
782-
return new List<Type>();
783-
}
784-
}
785-
catch (Exception)
786-
{
787-
return new List<Type>();
788-
}
789-
}
790-
}

0 commit comments

Comments
 (0)