public IrosArc(string filename, bool patchable = false, Action <int, int> progressAction = null) { _source = filename; var sw = new System.Diagnostics.Stopwatch(); sw.Start(); if (patchable) { _data = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite); } else { _data = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read); } _header = new ArcHeader(); _header.Open(_data); int numfiles; _data.Position = _header.Directory; do { numfiles = _data.ReadInt(); if (numfiles == -1) { _data.Position = _data.ReadLong(); } } while (numfiles < 0); _entries = new List <DirectoryEntry>(); _lookup = new Dictionary <string, DirectoryEntry>(StringComparer.InvariantCultureIgnoreCase); _folderNames = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase); for (int i = 0; i < numfiles; i++) { progressAction?.Invoke(i, numfiles); DirectoryEntry e = new DirectoryEntry(); e.Open(_data, _header.Version); #if !RUDE if ((e.Flags & FileFlags.RudeFlags) != 0) { throw new IrosArcException(String.Format("Archive {0} entry {1} has invalid flags", filename, e.Filename)); } #endif _entries.Add(e); _lookup[e.Filename] = e; int lpos = e.Filename.LastIndexOf('\\'); if (lpos > 0) { _folderNames.Add(e.Filename.Substring(0, lpos)); } } sw.Stop(); System.Diagnostics.Debug.WriteLine("IrosArc: opened {0}, contains {1} files, took {2} ms to parse", filename, _lookup.Count, sw.ElapsedMilliseconds); }