public static Wave ReadFromDat(uint fileId) { // Check the FileCache so we don't need to hit the FileSystem repeatedly if (DatManager.PortalDat.FileCache.ContainsKey(fileId)) { return((Wave)DatManager.PortalDat.FileCache[fileId]); } else { DatReader datReader = DatManager.PortalDat.GetReaderForFile(fileId); Wave obj = new Wave(); obj.Id = datReader.ReadUInt32(); int headerSize = datReader.ReadInt32() - 2; // not sure why this is required, it just is. int dataSize = datReader.ReadInt32(); obj.Header = datReader.ReadBytes(headerSize); obj.Data = datReader.ReadBytes(dataSize); // Store this object in the FileCache DatManager.PortalDat.FileCache[fileId] = obj; return(obj); } }