Ejemplo n.º 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);
 }
Ejemplo n.º 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;
     });
 }
Ejemplo n.º 3
0
 public TreeArchiveFileSystem(ArcFile arc)
     : base(arc)
 {
     m_cwd = "";
     PathDelimiter = "/";
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 5
0
 public FlatArchiveFileSystem(ArcFile arc)
     : base(arc)
 {
 }
Ejemplo n.º 6
0
 public FlatArchiveFileSystem(ArcFile arc) : base(arc)
 {
 }
Ejemplo n.º 7
0
 public TreeArchiveFileSystem(ArcFile arc) : base(arc)
 {
     m_cwd         = "";
     PathDelimiter = "/";
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 11
0
 public virtual void CopyEntry(ArcFile arc, Stream input, Entry entry)
 {
     using (var output = CreateFile(entry.Name))
         input.CopyTo(output);
 }
Ejemplo n.º 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);
 }