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