File tree Expand file tree Collapse file tree
Source/Stationeers.Addons/PluginCompiler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,6 +186,34 @@ private bool IsPropertyWhitelisted(IPropertySymbol symbol)
186186 return false ;
187187 }
188188
189+ public void WhitelistAssembly ( Type baseAssemblyType , params Type [ ] excludedTypes )
190+ {
191+ var excludedNamespaces = new List < string > ( ) ;
192+ foreach ( var type in excludedTypes )
193+ {
194+ Debug . Assert ( type != null , "type is null!" ) ;
195+ var symbol = GetNamedTypeSymbol ( type ) ;
196+ excludedNamespaces . Add ( symbol . ContainingNamespace . ToDisplayString ( ) ) ;
197+ }
198+
199+ var assembly = baseAssemblyType . Assembly ;
200+
201+ // Whitelist all namespaces from the assembly
202+ foreach ( var type in assembly . GetTypes ( ) )
203+ {
204+ var symbol = GetNamedTypeSymbol ( type ) ;
205+ if ( symbol != null )
206+ {
207+ var namespaceName = symbol . ContainingNamespace . ToDisplayString ( ) ;
208+
209+ if ( excludedNamespaces . Contains ( namespaceName ) )
210+ continue ;
211+
212+ _namespaceWhitelist . Add ( namespaceName ) ;
213+ }
214+ }
215+ }
216+
189217 public void WhitelistTypesNamespaces ( params Type [ ] types )
190218 {
191219 foreach ( var type in types )
You can’t perform that action at this time.
0 commit comments