/// <summary> /// Parses the .dat file contents from inStream. /// </summary> /// <param name="inStream">Unicode binary reader containing ONLY the contents of a single .dat file and nothing more</param> /// <param name="fileName">Name of the dat file (with extension)</param> public DatContainer(Stream inStream, string fileName) { DatName = Path.GetFileNameWithoutExtension(fileName); RecordInfo = RecordFactory.GetRecordInfo(DatName); DataEntries = new Dictionary <int, AbstractData>(); DataPointers = new Dictionary <int, PointerData>(); using (var br = new BinaryReader(inStream, Encoding.Unicode)) { Read(br); } }
/// <summary> /// Parses the .dat file found at path 'fileName' /// </summary> /// <param name="filePath">Path of .dat file to parse</param> public DatContainer(string filePath) { DatName = Path.GetFileNameWithoutExtension(filePath); RecordInfo = RecordFactory.GetRecordInfo(DatName); DataEntries = new Dictionary <int, AbstractData>(); DataPointers = new Dictionary <int, PointerData>(); var fileBytes = File.ReadAllBytes(filePath); using (var ms = new MemoryStream(fileBytes)) { using (var br = new BinaryReader(ms, Encoding.Unicode)) { Read(br); } } }