Exemplo n.º 1
0
        async Task IClient.Delete(string fileName)
        {
            var request = new SrvDeleteRequest {
                FileName = fileName
            };

            var tcpOp = startTcpOp(request);

            await tcpOp.Write(request);

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

            validate(response);
        }
Exemplo n.º 2
0
        async Task IServer.DeleteFile(SrvDeleteRequest request, ITcpOp tcpOp)
        {
            _log.Info(request.TrackingId, request);

            validate(request);

            var user = await getUser(request);

            authenticate(user, request);

            var path = makeFilePath(user, request.FileName);

            if (!File.Exists(path))
            {
                throw new ApplicationException($"'{request.FileName}' is not found");
            }

            File.Delete(path);

            var response = makeResponse <SrvDeleteResponse>(request);
            await tcpOp.Write(response);

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