Exemple #1
0
        public object Get(GetLogFile request)
        {
            var file = _fileSystem.GetFiles(_appPaths.LogDirectoryPath)
                       .First(i => string.Equals(i.Name, request.Name, StringComparison.OrdinalIgnoreCase));

            return(ResultFactory.GetStaticFileResult(Request, file.FullName, FileShare.ReadWrite));
        }
Exemple #2
0
        public object Get(GetLogFile request)
        {
            var file = new DirectoryInfo(_appPaths.LogDirectoryPath)
                       .EnumerateFiles("*", SearchOption.AllDirectories)
                       .First(i => string.Equals(i.Name, request.Name, global::System.StringComparison.OrdinalIgnoreCase));

            return(ResultFactory.GetStaticFileResult(Request, file.FullName, FileShare.ReadWrite));
        }
Exemple #3
0
        public Task <object> Get(GetLogFile request)
        {
            var file = _fileSystem.GetFiles(_appPaths.LogDirectoryPath)
                       .First(i => string.Equals(i.Name, request.Name, StringComparison.OrdinalIgnoreCase));

            // For older files, assume fully static
            var fileShare = file.LastWriteTimeUtc < DateTime.UtcNow.AddHours(-1) ? FileShare.Read : FileShare.ReadWrite;

            return(ResultFactory.GetStaticFileResult(Request, file.FullName, fileShare));
        }