public void ReadFromFile(string fileName, bool isBigEndian) { using (var fileStream = new MemoryStream(File.ReadAllBytes(fileName))) { EntityType = (ActorEDSTypes)fileStream.ReadInt32(isBigEndian); if (EntityType == ActorEDSTypes.C_Train) { MessageBox.Show(string.Format("Detected unsupported entity. The EntityStorageData will not load."), "Toolkit", MessageBoxButton.OK, MessageBoxImage.Error); return; } Hash = fileStream.ReadUInt64(isBigEndian); TableSize = fileStream.ReadInt32(isBigEndian); uint numTables = fileStream.ReadUInt32(isBigEndian); TableHashes = new ulong[numTables]; Tables = new IActorExtraDataInterface[numTables]; for (int i = 0; i < numTables; i++) { TableHashes[i] = fileStream.ReadUInt64(isBigEndian); } for (int i = 0; i < numTables; i++) { using (MemoryStream stream = new MemoryStream(fileStream.ReadBytes(TableSize))) { var item = ActorFactory.LoadEntityDataStorage(EntityType, stream, isBigEndian); Tables[i] = item; } } } }