コード例 #1
0
        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;
        }