public bool TryAddToCache(string path, Stream stream, IFormatInfo outputFormat, out IAddToCacheResult result)
        {
            var cacheFile = GetCacheFileInfo(path, outputFormat);

            if (!cacheFile.Directory.Exists)
            {
                cacheFile.Directory.Create();
            }

            using (var fileStream = cacheFile.Create())
            {
                stream.CopyTo(fileStream);
            }

            var etag = m_fileInfoETagCalculator.CalculateETag( cacheFile );
            result = new AddToCacheResult(cacheFile.LastWriteTime, etag);
            return true;
        }
 public bool TryAddToCache(string path, Stream stream, IFormatInfo outputFormat, out IAddToCacheResult result)
 {
     result = null;
     return false;
 }
Exemple #3
0
 public bool TryAddToCache(string path, Stream stream, IFormatInfo outputFormat, out IAddToCacheResult result)
 {
     result = null;
     return(false);
 }
        public bool TryAddToCache(string path, Stream stream, IFormatInfo outputFormat, out IAddToCacheResult result)
        {
            var cacheFile = GetCacheFileInfo(path, outputFormat);

            if (!cacheFile.Directory.Exists)
            {
                cacheFile.Directory.Create();
            }

            using (var fileStream = cacheFile.Create())
            {
                stream.CopyTo(fileStream);
            }

            var etag = m_fileInfoETagCalculator.CalculateETag(cacheFile);

            result = new AddToCacheResult(cacheFile.LastWriteTime, etag);
            return(true);
        }