BiliRanking.Core.Download.HttpDownloadClient.WriteCacheToFile C# (CSharp) Метод

WriteCacheToFile() статический приватный Метод

Write the data in cache to local file.
static private WriteCacheToFile ( MemoryStream downloadCache, int cachedSize ) : void
downloadCache System.IO.MemoryStream
cachedSize int
Результат void
        void WriteCacheToFile(MemoryStream downloadCache, int cachedSize)
        {
            // Lock other threads or processes to prevent from writing data to the file.
            lock (fileLocker)
            {
                using (FileStream fileStream = new FileStream(DownloadPath, FileMode.Open))
                {
                    byte[] cacheContent = new byte[cachedSize];
                    downloadCache.Seek(0, SeekOrigin.Begin);
                    downloadCache.Read(cacheContent, 0, cachedSize);
                    fileStream.Seek(DownloadedSize + StartPoint, SeekOrigin.Begin);
                    fileStream.Write(cacheContent, 0, cachedSize);
                }
            }
        }