コード例 #1
0
        private ControllerParameter(LinkConnectionType connectionType, LinkClient client, byte[] buffer, IPEndPoint endpoint, NetworkStream stream, CancellationToken cancellationToken)
        {
            Debug.Assert(endpoint != null);
            Debug.Assert(connectionType != LinkConnectionType.Tcp || stream != null);
            this.endpoint = endpoint;

            ConnectionType    = connectionType;
            Client            = client;
            Stream            = stream;
            Packet            = new LinkPacket(client.Generator, buffer);
            CancellationToken = cancellationToken;
            SenderProfile     = client.Contracts.FindProfile(Packet.SenderId);
        }
コード例 #2
0
        public static void Invoke(LinkPacket arg)
        {
            var dic = s_ins._dic;

            if (dic.TryGetValue(arg.Path, out var act))
            {
                act.Invoke(arg.Buffer);
            }
            else
            {
                Log.Info($"Path \"{arg.Path}\" not supported.");
            }
            return;
        }
コード例 #3
0
ファイル: LinkModule.cs プロジェクト: hnjm/messenger
        private static async Task _RequestHandler(Socket socket, LinkPacket packet)
        {
            var pth = packet.Path;

            if (pth == "share.directory" || pth == "share.file")
            {
                var src = packet.Source;
                var key = packet.Data.GetValue <Guid>();
                await Share.Notify(src, key, socket);
            }
            else
            {
                Log.Info($"Path \"{pth}\" not supported.");
            }
        }