private void AddSongFromBins(PlatformData data, SongData song, string dtapath, string contentpath, ProgressIndicator progress, bool replace = false) { if (File.Exists(contentpath) && File.Exists(dtapath)) { Stream contentfile = null; Stream dtafile = null; if (IterateBins) { contentfile = new DelayedStream(data.Cache.GenerateFileStream(contentpath, FileMode.Open)); DlcBin content = new DlcBin(contentfile); U8 u8 = new U8(content.Data); // Read album art from the preview bin dtafile = new DelayedStream(data.Cache.GenerateFileStream(dtapath, FileMode.Open)); DlcBin dtabin = new DlcBin(dtafile); U8 dtau8 = new U8(dtabin.Data); string genpath = "/content/songs/" + song.ID + "/gen"; DirectoryNode dtagen = dtau8.Root.Navigate(genpath) as DirectoryNode; if (dtagen != null) { DirectoryNode contentgen = u8.Root.Navigate(genpath) as DirectoryNode; if (contentgen != null) { contentgen.AddChildren(dtagen.Files); } } data.Session["songdir"] = u8.Root; } if (replace) { foreach (FormatData formatdata in data.Songs) { if (formatdata.Song.ID == song.ID) { base.DeleteSong(data, formatdata, progress); break; } } } AddSong(data, song, progress); // TODO: Add dta bin to songdir for album art if (IterateBins) { data.Session.Remove("songdir"); contentfile.Close(); dtafile.Close(); } } }