Ejemplo n.º 1
0
        async Task <string[]> IClient.ListFiles()
        {
            var request = new SrvListRequest();

            var tcpOp = startTcpOp(request);

            await tcpOp.Write(request);

            var response = await tcpOp.Read <SrvListResponse>();

            validate(response);

            return(response.FileNames);
        }
Ejemplo n.º 2
0
        async Task IServer.ListFiles(SrvListRequest request, ITcpOp tcpOp)
        {
            _log.Info(request.TrackingId, request);

            validate(request);

            var user = await getUser(request);

            authenticate(user, request);

            Directory.CreateDirectory(user.Folder);

            var fileList = Directory
                           .GetFiles(user.Folder)
                           .Select(path => Path.GetFileName(path))
                           .ToArray();

            var response = makeResponse <SrvListResponse>(request);

            response.FileNames = fileList;
            await tcpOp.Write(response);

            _log.Info(request.TrackingId, response);
        }