fix cs filter metadata bug

This commit is contained in:
Oiltanker
2022-04-17 19:55:45 +03:00
parent e52f762861
commit 22f82c7cb2
2 changed files with 23 additions and 11 deletions
@@ -11,15 +11,7 @@ namespace Barotrauma {
{
private static readonly string[] typesPermitted = new string[] {
// Basics
"System.Runtime.CompilerServices.CompilationRelaxationsAttribute",
"System.Runtime.CompilerServices.RuntimeCompatibilityAttribute",
"System.Diagnostics.DebuggableAttribute",
"System.Object",
"System.String",
"System.Collections",
"System",
// Some roslyn magic
".DebuggingModes",
// Barotrauma
"Barotrauma",
// Lua
@@ -76,7 +68,18 @@ namespace Barotrauma {
reader.TypeReferences.ToList().ForEach(t =>
{
var tRef = reader.GetTypeReference(t);
var typeName = $"{reader.GetString(tRef.Namespace)}.{reader.GetString(tRef.Name)}";
var typeName = $"{reader.GetString(tRef.Name)}";
EntityHandle handle = tRef.ResolutionScope;
TypeReference tr = tRef;
while (!handle.IsNil && handle.Kind == HandleKind.TypeReference)
{
tr = reader.GetTypeReference((TypeReferenceHandle)handle);
handle = tr.ResolutionScope;
typeName = $"{reader.GetString(tr.Name)}.{typeName}";
}
typeName = $"{reader.GetString(tr.Namespace)}.{typeName}";
if (!IsTypeAllowed(typeName)) conflictingTypes.Add(typeName);
});