mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
using IsDerivedFrom instead of while loop (#1739)
This commit is contained in:
parent
a86d1cdfff
commit
f17cea771e
@ -417,38 +417,20 @@ static bool WeaveSyncObject(TypeDefinition td)
|
||||
|
||||
bool modified = false;
|
||||
|
||||
// are ANY parent classes SyncListStruct
|
||||
TypeReference parent = td.BaseType;
|
||||
while (parent != null)
|
||||
if (td.IsDerivedFrom(SyncListType))
|
||||
{
|
||||
if (parent.FullName.StartsWith(SyncListType.FullName, StringComparison.Ordinal))
|
||||
{
|
||||
SyncListProcessor.Process(td);
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
if (parent.FullName.StartsWith(SyncSetType.FullName, StringComparison.Ordinal))
|
||||
{
|
||||
SyncListProcessor.Process(td);
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
if (parent.FullName.StartsWith(SyncDictionaryType.FullName, StringComparison.Ordinal))
|
||||
{
|
||||
SyncDictionaryProcessor.Process(td);
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
parent = parent.Resolve().BaseType;
|
||||
}
|
||||
catch (AssemblyResolutionException)
|
||||
{
|
||||
// this can happen for pluins.
|
||||
//Console.WriteLine("AssemblyResolutionException: "+ ex.ToString());
|
||||
break;
|
||||
}
|
||||
SyncListProcessor.Process(td);
|
||||
modified = true;
|
||||
}
|
||||
else if (td.IsDerivedFrom(SyncSetType))
|
||||
{
|
||||
SyncListProcessor.Process(td);
|
||||
modified = true;
|
||||
}
|
||||
else if (td.IsDerivedFrom(SyncDictionaryType))
|
||||
{
|
||||
SyncDictionaryProcessor.Process(td);
|
||||
modified = true;
|
||||
}
|
||||
|
||||
// check for embedded types
|
||||
|
Loading…
Reference in New Issue
Block a user