예제 #1
0
        public void DeleteFile(File file)
        {
            _dbContext.Files.Remove(file);
            var path = _configuration["StoragePath"] + $@"{_}Storage{_}{file.Id}.dat";

            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
            }
        }
예제 #2
0
        private long GetFileSize(File file)
        {
            var path = _configuration["StoragePath"] + $@"{_}Storage{_}{file.Id}.dat";

            if (System.IO.File.Exists(path))
            {
                return(new FileInfo(path).Length);
            }
            else
            {
                return(0);
            }
        }
예제 #3
0
 private long GetFileSizeWithCache(File file)
 {
     return(_cache.GetAndCache($"file-size-cache-id-{file.Id}", () => GetFileSize(file)));
 }