public Stream GetReadStream(string domain, string path, bool withDecription)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }
            var target = GetTarget(domain, path);

            if (File.Exists(target))
            {
                return(withDecription ? crypt.GetReadStream(target) : File.OpenRead(target));
            }
            throw new FileNotFoundException("File not found", Path.GetFullPath(target));
        }
Пример #2
0
 private void ReadFile(string filePath)
 {
     using (var stream = Crypt.GetReadStream(filePath))
     {
         byte[] array = new byte[81920];
         while (stream.Read(array, 0, array.Length) != 0)
         {
         }
     }
 }
Пример #3
0
 private void GetReadStream(CommonFileInfo fileInfo)
 {
     using (var stream = Crypt.GetReadStream(fileInfo.Path))
     {
         stream.Position = 0;
         if (stream.CanSeek)
         {
             stream.Seek(0, SeekOrigin.Begin);
         }
         Assert.AreEqual(fileInfo.Content, new StreamReader(stream).ReadToEnd());
         Assert.AreEqual(fileInfo.Size, stream.Length);
     }
 }