Exemplo n.º 1
0
 public LzStream(string path, bool useCreateFile = true)
 {
     _handle = useCreateFile
         ? CompressionMethods.LzCreateFile(path, out string uncompressedName)
         : CompressionMethods.LzOpenFile(path, out uncompressedName);
     UncompressedName = uncompressedName;
 }
Exemplo n.º 2
0
 public void CreateFile_OverMaxPathLongPath()
 {
     // Unlike OpenFile, CreateFile handles > 128 character paths. Unfortunately it is
     // constrained by MAX_PATH internal buffers, so it cant go over 260.
     using (var cleaner = new TestFileCleaner())
     {
         string path = @"\\?\" + PathGenerator.CreatePathOfLength(cleaner.TempFolder, 300);
         FileHelper.EnsurePathDirectoryExists(path);
         FileHelper.WriteAllBytes(path, CompressedFile1);
         Action action = () => CompressionMethods.LzCreateFile(path);
         action.ShouldThrow <LzException>().And.Error.Should().Be(LzError.BadValue);
     }
 }
Exemplo n.º 3
0
 public void CreateFile_LongPath()
 {
     // Unlike OpenFile, CreateFile handles > 128 character paths.
     using (var cleaner = new TestFileCleaner())
     {
         string path = PathGenerator.CreatePathOfLength(cleaner.TempFolder, 160);
         FileHelper.WriteAllBytes(path, CompressedFile1);
         using (var handle = CompressionMethods.LzCreateFile(path))
         {
             handle.RawHandle.Should().BeGreaterThan(0);
         }
     }
 }