예제 #1
0
 public static void WriteEntryTo(this RarReader reader, FileInfo filePath, CancellationToken cancellation)
 {
     using (Stream stream = filePath.Open(FileMode.Create))
     {
         reader.WriteEntryTo(stream, cancellation);
     }
 }
예제 #2
0
 public static void WriteEntryTo(this RarReader reader, string filePath, CancellationToken cancellation)
 {
     using (Stream stream = File.Open(filePath, FileMode.Create, FileAccess.Write))
     {
         reader.WriteEntryTo(stream, cancellation);
     }
 }
예제 #3
0
        /// <summary>
        /// Extract to specific file
        /// </summary>
        public static void WriteEntryToFile(this RarReader reader, string destinationFileName, CancellationToken cancellation,
                                            ExtractOptions options = ExtractOptions.Overwrite)
        {
            FileMode fm = FileMode.Create;

            if (!options.HasFlag(ExtractOptions.Overwrite))
            {
                fm = FileMode.CreateNew;
            }
            using (FileStream fs = File.Open(destinationFileName, fm))
            {
                reader.WriteEntryTo(fs, cancellation);
            }
        }