public FileReader(WoWBuild build, Options options)
        {
            Build    = build;
            _options = options;

            _readData     = _options.ParseMode.HasFlag(ParseMode.Data);
            _readFileInfo = _options.ParseMode.HasFlag(ParseMode.FileInfo);


            // create referenced readers
            _readers = new Dictionary <WoWFormat, ReaderFunc>()
            {
                { WoWFormat.DBC, ReadMeta <Structures.Meta.DBCMeta> },
                { WoWFormat.TOC, ReadMeta <Structures.Meta.TOCMeta> },
                { WoWFormat.WDB, ReadMeta <Structures.Meta.WDBMeta> },

                { WoWFormat.BLP, ReadFormat <Structures.BLP.BLP> },
                { WoWFormat.BLS, ReadFormat <Structures.BLS.BLS> },
                { WoWFormat.DB, ReadFormat <Structures.DB.DB> },
                { WoWFormat.DEF, ReadFormat <Structures.DEF.DEF> },
                { WoWFormat.MDX, ReadFormat <Structures.MDX.MDX> },
                { WoWFormat.LIT, ReadFormat <Structures.LIT.LIT> },
                { WoWFormat.M2, ReadFormat <Structures.M2.M2> },
                { WoWFormat.WDL, ReadFormat <Structures.WDL.WDL> },
                { WoWFormat.WLQ, ReadFormat <Structures.WLX.WLQ> },
                { WoWFormat.WLX, ReadFormat <Structures.WLX.WLX> },

                { WoWFormat.WDT, ReadVersioned <Structures.WDT.WDT> },
                { WoWFormat.WDTADT, ReadVersioned <Structures.WDT.WDT> },
                { WoWFormat.ADT, ReadVersioned <Structures.ADT.ADT> },
                { WoWFormat.WMO, ReadVersioned <Structures.WMO.WMO> },
                { WoWFormat.WMOGROUP, ReadVersioned <Structures.WMO.WMOGroup> },
            };
        }
        public WoWFormatParser(string directory, WoWBuild build, Options options = null)
        {
            Directory = directory;
            if (!System.IO.Directory.Exists(Directory))
            {
                throw new ArgumentException("Invalid Directory argument.");
            }

            Build = build;
            if (Build == null)
            {
                throw new ArgumentException("Invalid Build argument.");
            }

            Options = options ?? new Options();

            _directoryReader = new DirectoryReader(Directory, Options, Build);
            _mpqReader       = new MPQReader(Options, Build, _directoryReader.GetPatchArchives());
        }
        /// <summary>
        /// Parses an external file.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="build"></param>
        /// <returns></returns>
        public IFormat ParseFile(string path, WoWBuild build = null)
        {
            var _fileReader = new FileReader(build ?? Build, Options);

            return(_fileReader.Read(path));
        }
 /// <summary>
 /// Parses a one or more external files as the specified type.
 /// </summary>
 /// <param name="build"></param>
 /// <param name="paths"></param>
 /// <returns></returns>
 public IEnumerable <T> ParseFiles <T>(WoWBuild build = null, params string[] paths) where T : Format
 {
     return(ParseFiles(build, paths).Where(x => x.Is <T>()).Cast <T>());
 }
        /// <summary>
        /// Parses a one or more external files.
        /// </summary>
        /// <param name="build"></param>
        /// <param name="paths"></param>
        /// <returns></returns>
        public IEnumerable <IFormat> ParseFiles(WoWBuild build = null, params string[] paths)
        {
            var _fileReader = new FileReader(build ?? Build, Options);

            return(paths.Select(path => _fileReader.Read(path)));
        }
        /// <summary>
        /// Parses an external file as the specified type.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="path"></param>
        /// <param name="build"></param>
        /// <returns></returns>
        public T ParseFile <T>(string path, WoWBuild build = null) where T : Format
        {
            var _fileReader = new FileReader(build ?? Build, Options);

            return(_fileReader.Read(path) as T);
        }