Beispiel #1
0
 void ExtractFile(ArcFile arc, string name)
 {
     Entry entry = arc.Dir.FirstOrDefault (e => e.Name.Equals (name, StringComparison.OrdinalIgnoreCase));
     if (null == entry)
     {
         Console.Error.WriteLine ("'{0}' not found within {1}", name, m_arc_name);
         return;
     }
     Console.WriteLine ("Extracting {0} ...", entry.Name);
     arc.Extract (entry);
 }
Beispiel #2
0
 void ExtractAll(ArcFile arc)
 {
     arc.ExtractFiles ((i, entry, msg) => {
         if (null != entry)
         {
             Console.WriteLine ("Extracting {0} ...", entry.Name);
         }
         else if (null != msg)
         {
             Console.WriteLine (msg);
         }
         return ArchiveOperation.Continue;
     });
 }
Beispiel #3
0
 public TreeArchiveFileSystem(ArcFile arc)
     : base(arc)
 {
     m_cwd = "";
     PathDelimiter = "/";
 }
Beispiel #4
0
 public ArchiveFileSystem(ArcFile arc)
 {
     m_arc = arc;
     m_dir = new Dictionary<string, Entry> (arc.Dir.Count, StringComparer.InvariantCultureIgnoreCase);
     foreach (var entry in arc.Dir)
     {
         if (!m_dir.ContainsKey (entry.Name))
             m_dir.Add (entry.Name, entry);
     }
 }
Beispiel #5
0
 public FlatArchiveFileSystem(ArcFile arc)
     : base(arc)
 {
 }
Beispiel #6
0
 public FlatArchiveFileSystem(ArcFile arc) : base(arc)
 {
 }
Beispiel #7
0
 public TreeArchiveFileSystem(ArcFile arc) : base(arc)
 {
     m_cwd         = "";
     PathDelimiter = "/";
 }
Beispiel #8
0
        /// <summary>
        /// Open <paramref name="entry"> as image. Throws InvalidFormatException if entry is not an image.
        /// </summary>
        public virtual IImageDecoder OpenImage(ArcFile arc, Entry entry)
        {
            var input = arc.OpenBinaryEntry(entry);

            return(ImageFormatDecoder.Create(input));
        }
Beispiel #9
0
 /// <summary>
 /// Extract file referenced by <paramref name="entry"/> into current directory.
 /// </summary>
 public void Extract(ArcFile file, Entry entry)
 {
     using (var input = OpenEntry(file, entry))
         using (var output = PhysicalFileSystem.CreateFile(entry.Name))
             input.CopyTo(output);
 }
Beispiel #10
0
 /// <summary>
 /// Open file referenced by <paramref name="entry"/> as Stream.
 /// </summary>
 public virtual Stream OpenEntry(ArcFile arc, Entry entry)
 {
     return(arc.File.CreateStream(entry.Offset, entry.Size, entry.Name));
 }
Beispiel #11
0
 public virtual void CopyEntry(ArcFile arc, Stream input, Entry entry)
 {
     using (var output = CreateFile(entry.Name))
         input.CopyTo(output);
 }
Beispiel #12
0
 /// <summary>
 /// Extract file referenced by <paramref name="entry"/> into current directory.
 /// </summary>
 public void Extract(ArcFile file, Entry entry)
 {
     using (var reader = OpenEntry(file, entry))
         CopyEntry(file, reader, entry);
 }