Files
sbox-public/engine/Sandbox.Access/AssemblyAccess.Rules.cs
Matt Stevens 20213e5881 Load precompiled dlls from the manifest, no longer load clls (#5038)
When games are published we compile them our backend and load those instead of compiling on the client.

This greatly improves loading times in games, anywhere from 5-60 seconds depending on game complexity.
2026-06-10 15:22:14 +01:00

29 lines
747 B
C#

using Microsoft.CodeAnalysis;
using System.Threading.Tasks;
namespace Sandbox;
internal partial class AssemblyAccess
{
bool CheckPassesRules()
{
Parallel.ForEach( Touched, touch =>
{
// Any and all user code is a package, all assemblies are prefixed with this
// And any code calling to within a package or across packages is free game
if ( touch.Key.StartsWith( "package." ) )
return;
if ( Global.Rules.IsInWhitelist( touch.Key ) )
return;
var locations = string.Join( "\n", touch.Value.Locations.Select( x => $"\t{x.Text}" ) );
Result.Errors.Add( $"{touch.Key}\n{locations}" );
Result.WhitelistErrors.Add( (touch.Key, touch.Value.Locations.ToArray()) );
} );
return Result.Errors.Count == 0;
}
}