public override void Read(BinaryReader reader) { base.Read(reader); byte[] body = reader.ReadBytes(this.HeaderOne - 12); unknownOne = ToInt32(body, 0); unknownTwo = ToInt32(body, 4); int numChildren = ToInt32(body, 8); unknownThree = ToInt32(body, 12); NextId = ToInt32(body, 16); unknownFive = ToInt64(body, 20); unknownSix = ToInt64(body, 28); unknownSeven = ToInt32(body, 36); unknownEight = ToInt32(body, 40); unknownNine = ToInt32(body, 44); unknownTen = ToInt32(body, 48); unknownEleven = ToInt32(body, 52); recordPadding = body.Length - 56; children.Clear(); for (int i = 0; i < numChildren; i++) { PhotoDataSetRecord ds = new PhotoDataSetRecord(IsBE); ds.Read(reader); children.Add(ds); } }
public void Reload(bool createFresh) { photos.Clear(); albums.Clear(); CloseTempFile(); dfr = new DataFileRecord(device.IsBE); if (isPhoto) { // create a default master album if this is a photo database masterAlbum = CreateAlbum(); masterAlbum.Name = "My Pictures"; masterAlbum.Record.IsMaster = true; } if (createFresh || !File.Exists(PhotoDbPath)) { return; } using (BinaryReader reader = new BinaryReader(File.OpenRead(PhotoDbPath))) { dfr.Read(reader); PhotoDataSetRecord albumSet = dfr[PhotoDataSetIndex.AlbumList]; ImageListRecord imageList = dfr[PhotoDataSetIndex.ImageList].Data as ImageListRecord; foreach (ImageItemRecord item in imageList.Items) { Photo photo = new Photo(item, this); photos[item.Id] = photo; if (item.TrackId != 0) { trackPhotos[item.TrackId] = photo; } } foreach (AlbumRecord albumRecord in (albumSet.Data as AlbumListRecord).Albums) { Album album = new Album(albumRecord, this); if (album.IsMaster) { masterAlbum = album; } else { albums.Add(album); } } } }