public RPCData(RPCPeer peer, Serializer serializer) : this() { Serializer = serializer; Peer = peer; Header = new RPCDataHeader(Serializer); }
public T GetCreateProxy <T>(RPCPeer peer, int implId) { var tuple = new Tuple <RPCPeer, int>(peer, implId); RPCProxy proxy; if (proxies.TryGetValue(tuple, out proxy)) { return((T)(object)proxy); } var serviceType = typeof(T); var serviceAssembly = serviceType.Assembly; var implType = serviceAssembly.GetType(Helper.GetStubsClassName(serviceType, true)); var proxyType = implType.GetNestedType("Proxy"); var proxyId = GetNextStubId(); var stub = Activator.CreateInstance(proxyType, peer, implId, proxyId); proxy = (RPCProxy)stub; stubs.Add(proxyId, proxy); proxies.Add(tuple, proxy); proxy.RPCManager = this; return((T)stub); }
public RPCData(RPCPeer peer, RPCManager rpcManager, Serializer serializer) { Serializer = serializer; Peer = peer; RPCManager = rpcManager; Header = new RPCDataHeader(Serializer); Flags = RPCFlags.None; }
internal Call(int id, int methodId, RPCPeer peer, int localId, int remoteId) { Id = id; MethodId = methodId; Data = RPCData.Create(peer, localId, remoteId, RPCDataType.Call); Data.Serializer.WriteI32(id); Data.Serializer.WriteI32(methodId); }
public RPCData(RPCPeer peer, RPCManager rpcManager, int localId, int remoteId, RPCDataType type, RPCFlags flags = RPCFlags.None) : this(peer, rpcManager) { Flags = flags; Header.CallType = type; Header.RemoteId = remoteId; Header.LocalId = localId; Header.Write(); }
protected RPCProxy(RPCPeer peer, int remoteId, int id) : base(id) { Peer = peer; RemoteId = remoteId; callProcessor = new RPCCallProcessor(); eventIdsDelegates = new Dictionary <int, int>(); }
internal DelegateCall(int id, int localDelegateId, int remoteDelegateId, RPCPeer peer, int localId, int remoteId) { Id = id; LocalDelegateId = localDelegateId; RemoteDelegateId = remoteDelegateId; Data = RPCData.Create(peer, localId, remoteId, RPCDataType.DelegateCall); Data.Serializer.WriteI32(Id); Data.Serializer.WriteI32(LocalDelegateId); Data.Serializer.WriteI32(RemoteDelegateId); }
public static RPCData Create(RPCPeer peer, int localId, int remoteId, RPCDataType type, RPCFlags flags = RPCFlags.None) { var data = new RPCData(peer); data.Peer = peer; data.Flags = flags; data.Header.CallType = type; data.Header.RemoteId = remoteId; data.Header.LocalId = localId; data.Header.Write(); return(data); }
public void Process(byte[] data, RPCPeer peer) { var serializer = new BinarySerializer(); serializer.Buffer.Write(data, 0, data.Length); serializer.Buffer.Position = 0; var rpcData = new RPCData(peer, serializer); rpcData.Header.Read(); Process(rpcData); }
public RPCDelegate CreateDelegateImpl <T>(RPCPeer peer, int remoteId, Delegate del) where T : RPCDelegateImpl, new() { var delegateId = Interlocked.Increment(ref delegateIdCounter); var delegateImpl = Activator.CreateInstance <T>(); delegateImpl.Id = delegateId; delegateImpl.Delegate = del; delegateImpl.Stub = this; delegates.Add(delegateId, delegateImpl); return(delegateImpl); }
public RPCDelegate CreateDelegateProxy <T>(RPCPeer peer, int remoteId, int remoteDelegateId) where T : RPCDelegateProxy, new() { var delegateId = Interlocked.Increment(ref delegateIdCounter); var delegateProxy = Activator.CreateInstance <T>(); delegateProxy.Peer = peer; delegateProxy.LocalId = Id; delegateProxy.RemoteId = remoteId; delegateProxy.Id = delegateId; delegateProxy.RemoteDelegateId = remoteDelegateId; delegateProxy.Stub = this; delegates.Add(delegateId, delegateProxy); return(delegateProxy); }
internal DelegateCall(int id, RPCPeer peer, RPCManager rpcManager, int localId, int remoteId) { Id = id; Data = new RPCData(peer, rpcManager, localId, remoteId, RPCDataType.DelegateCall); Data.Serializer.WriteI32(id); }
public RPCData(RPCPeer peer) : this(peer, peer.CreateSerializer()) { }
internal Call(int id, int methodId, RPCPeer peer, RPCManager rpcManager, int localId, int remoteId) { Id = id; MethodId = methodId; Data = new RPCData(peer, rpcManager, localId, remoteId, RPCDataType.Call); Data.Serializer.WriteI32(id); Data.Serializer.WriteI32(methodId); if (remoteId == 0) { GlobalServiceId = rpcManager.ServiceManager.GetGlobalServiceId(localId); GlobalServiceId.Write(Data); } else { GlobalServiceId = default(GlobalServiceId); } }
public Subscription(RPCPeer peer, int remoteId) { Peer = peer; RemoteId = remoteId; }
public void Subscribe(IObservableDataObject dataObject, RPCPeer peer, int remoteId) { Reference reference; if (!dataObjectToReference.TryGetValue(dataObject, out reference)) reference = CreateReference(dataObject); reference.Subscription = new Subscription(peer, remoteId); subscriptionToReference.Add(reference.Subscription, reference); var data = new RPCData(peer, RPCManager, reference.LocalId, remoteId, RPCDataType.ReferenceSubscribe); data.Dispatch(); }
private RPCData(RPCPeer peer, RPCManager rpcManager) : this(peer, rpcManager, peer.CreateSerializer()) { }