Exemplo n.º 1
0
 public static void Init(RPCObject obj)
 {
     if (Objects.ContainsKey(obj.DynamicId))
         throw new Exception("Given object was already initialized");
     ulong id = Next();
     obj.DynamicId = id;
     Objects.Add(id, obj);
 }
Exemplo n.º 2
0
        public static void Init(RPCObject obj)
        {
            if (Objects.ContainsKey(obj.DynamicId))
            {
                throw new Exception("Given object was already initialized");
            }
            ulong id = Next();

            obj.DynamicId = id;
            Objects.Add(id, obj);
        }
Exemplo n.º 3
0
        public void SendStateChangeNotification(RPCObject target, bnet.protocol.presence.ChannelState state)
        {
            var channelState = bnet.protocol.channel.ChannelState.CreateBuilder().SetExtension(bnet.protocol.presence.ChannelState.Presence, state);
            var notification = bnet.protocol.channel.UpdateChannelStateNotification.CreateBuilder().SetStateChange(channelState).Build();

            this.MakeTargetedRPC(target, () =>
                bnet.protocol.channel.ChannelSubscriber.CreateStub(this).NotifyUpdateChannelState(null, notification, callback => { }));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Allows you target an RPCObject while issuing a RPC.
        /// </summary>
        /// <param name="targetObject"><see cref="RPCObject"/></param>
        /// <param name="rpc">The rpc action.</param>
        public void MakeTargetedRPC(RPCObject targetObject, Action rpc)
        {
            this._listenerId = this.GetRemoteObjectId(targetObject.DynamicId);
            Logger.Trace("[RPC: {0}] Method: {1} Target: {2} [localId: {3}, remoteId: {4}].", this, rpc.Method,
                         targetObject.ToString(), targetObject.DynamicId, this._listenerId);

            rpc();
        }
Exemplo n.º 5
0
 public static void Release(RPCObject obj)
 {
     Logger.Trace("Releasing object {0}", obj.DynamicId);
     Objects.Remove(obj.DynamicId);
 }
Exemplo n.º 6
0
 public static void Release(RPCObject obj)
 {
     Logger.Trace("Releasing object {0}", obj.DynamicId);
     Objects.Remove(obj.DynamicId);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Allows you target an RPCObject while issuing a RPC.
        /// </summary>
        /// <param name="targetObject"><see cref="RPCObject"/></param>
        /// <param name="rpc">The rpc action.</param>
        public void MakeTargetedRPC(RPCObject targetObject, Action rpc)
        {
            this._listenerId = this.GetRemoteObjectID(targetObject.DynamicId);
            Logger.Warn("[RPC] Targeted object: {0} [localId: {1}, remoteId: {2}].", targetObject.ToString(),
                         targetObject.DynamicId, this._listenerId);

            rpc();
        }