/// <summary>
/// Prepare the NetworkingStream to be used
/// </summary>
/// <param name="socket">The NetWorker socket to be used</param>
/// <param name="identifierType">The type of Identifier it is going to prepare</param>
/// <param name="networkedBehavior">NetworkedBehavior to use</param>
/// <param name="extra">Extra parameters to prepare</param>
/// <param name="receivers">Who shall be receiving this NetworkingStream</param>
/// <param name="bufferedRPC">To know if this is a Buffered RPC</param>
/// <param name="customidentifier">A custom Identifier to be passed through</param>
/// <returns></returns>
public NetworkingStream Prepare(NetWorker socket, IdentifierType identifierType, ulong networkBehaviorId, BMSByte extra = null, NetworkReceivers receivers = NetworkReceivers.All, bool bufferedRPC = false, uint customidentifier = 0, ulong senderId = 0, bool noBehavior = false)
{
if (noBehavior)
{
NetworkedBehavior = null;
}
else
{
lock (networkedObjectMutex)
{
NetworkedBehavior = SimpleNetworkedMonoBehavior.Locate(networkBehaviorId);
}
}
if (ReferenceEquals(NetworkedBehavior, null) && (extra == null || extra.Size == 0))
{
throw new NetworkException(9, "Prepare was called but nothing was sent to write");
}
NetworkedBehaviorId = networkBehaviorId;
return(PrepareFinal(socket, identifierType, networkBehaviorId, extra, receivers, bufferedRPC, customidentifier, senderId));
}