mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Weaver NetworkBehaviourProcessor: ValidateRemoteCallAndParameters function added to be used from Command/Rpc/TargetRpcProcessors
This commit is contained in:
parent
fbad5d2401
commit
2e178b7eaf
@ -133,8 +133,7 @@ public static bool ValidateCommand(MethodDefinition md)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
return NetworkBehaviourProcessor.ValidateFunction(md) &&
|
return NetworkBehaviourProcessor.ValidateRemoteCallAndParameters(md, RemoteCallType.Command);
|
||||||
NetworkBehaviourProcessor.ValidateParameters(md, RemoteCallType.Command);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -874,8 +874,15 @@ public static void AddInvokeParameters(ICollection<ParameterDefinition> collecti
|
|||||||
collection.Add(new ParameterDefinition("senderConnection", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(WeaverTypes.NetworkConnectionType)));
|
collection.Add(new ParameterDefinition("senderConnection", ParameterAttributes.None, Weaver.CurrentAssembly.MainModule.ImportReference(WeaverTypes.NetworkConnectionType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if a Command/TargetRpc/Rpc function & parameters are valid for weaving
|
||||||
|
public static bool ValidateRemoteCallAndParameters(MethodReference method, RemoteCallType callType)
|
||||||
|
{
|
||||||
|
return ValidateFunction(method) &&
|
||||||
|
ValidateParameters(method, callType);
|
||||||
|
}
|
||||||
|
|
||||||
// check if a Command/TargetRpc/Rpc function is valid for weaving
|
// check if a Command/TargetRpc/Rpc function is valid for weaving
|
||||||
public static bool ValidateFunction(MethodReference md)
|
static bool ValidateFunction(MethodReference md)
|
||||||
{
|
{
|
||||||
if (md.ReturnType.FullName == WeaverTypes.IEnumeratorType.FullName)
|
if (md.ReturnType.FullName == WeaverTypes.IEnumeratorType.FullName)
|
||||||
{
|
{
|
||||||
@ -896,7 +903,7 @@ public static bool ValidateFunction(MethodReference md)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if all Command/TargetRpc/Rpc function's parameters are valid for weaving
|
// check if all Command/TargetRpc/Rpc function's parameters are valid for weaving
|
||||||
public static bool ValidateParameters(MethodReference method, RemoteCallType callType)
|
static bool ValidateParameters(MethodReference method, RemoteCallType callType)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < method.Parameters.Count; ++i)
|
for (int i = 0; i < method.Parameters.Count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -111,8 +111,7 @@ public static bool ValidateRpc(MethodDefinition md)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
return NetworkBehaviourProcessor.ValidateFunction(md) &&
|
return NetworkBehaviourProcessor.ValidateRemoteCallAndParameters(md, RemoteCallType.ClientRpc);
|
||||||
NetworkBehaviourProcessor.ValidateParameters(md, RemoteCallType.ClientRpc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -140,8 +140,7 @@ public static bool ValidateTargetRpc(MethodDefinition md)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
return NetworkBehaviourProcessor.ValidateFunction(md) &&
|
return NetworkBehaviourProcessor.ValidateRemoteCallAndParameters(md, RemoteCallType.TargetRpc);
|
||||||
NetworkBehaviourProcessor.ValidateParameters(md, RemoteCallType.TargetRpc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user