public override PlatformData Create(string path, Game game, ProgressIndicator progress) { PlatformData data = new PlatformData(this, game); DirectoryNode maindir = data.GetDirectoryStructure(path); List <DirectoryNode> dirs = new List <DirectoryNode>(maindir.Directories); dirs.Add(maindir); progress.NewTask(dirs.Count); foreach (DirectoryNode dir in dirs) { SongData song = new SongData(data); song.Name = dir.Name; try { data.Session["songdir"] = dir; AddSong(data, song, progress); data.Session.Remove("songdir"); } catch (Exception exception) { Exceptions.Warning(exception, "Unable to parse the Frets on Fire song from " + song.Name); } progress.Progress(); } progress.EndTask(); return(data); }
public override PlatformData Create(string path, Game game, ProgressIndicator progress) { PlatformData data = new PlatformData(this, game); DirectoryNode dir = data.GetDirectoryStructure(path); data.Game = Platform.DetermineGame(data); FileNode tracklist = dir.Navigate("/Common/AUDIO/Audiotracks/TrackListing.xml") as FileNode; XmlReader reader = XmlReader.Create(tracklist.Data); tracklist.Data.Close(); XmlDocument doc = new XmlDocument(); doc.Load(reader); var elements = doc.DocumentElement.GetElementsByTagName("Track"); progress.NewTask(elements.Count); foreach (XmlElement element in elements) { SongData song = FreeStyleGamesMetadata.GetSongData(element); AddSong(data, song, progress); progress.Progress(); } return(data); }
public static Ark GetHarmonixArk(this PlatformData data, string path) { DirectoryNode dir = null; try { dir = data.GetDirectoryStructure(path); } catch { if (File.Exists(path)) { path = Path.GetDirectoryName(path); } if (!Directory.Exists(path)) { throw new FormatException(); } dir = DirectoryNode.FromPath(path, data.Cache); } try { Ark ark = GetHarmonixArk(dir); data.Session["ark"] = ark; return(ark); } catch (Exception exception) { Exceptions.Error(exception, "Unable to open the ark file at " + path); } return(null); }
public override PlatformData Create(string path, Game game, ProgressIndicator progress) { PlatformData data = new PlatformData(this, game); DirectoryNode dir = data.GetDirectoryStructure(path); data.Game = Platform.DetermineGame(data); FileNode qbpak = dir.Navigate("pak/qb.pak.ngc") as FileNode; if (qbpak == null) { Exceptions.Error("Couldn't find qb.pak.ngc on Guitar Hero 3 Wii disc."); } try { Pak qb = new Pak(new EndianReader(qbpak.Data, Endianness.BigEndian)); FileNode songlistfile = qb.Root.Find("songlist.qb.ngc", SearchOption.AllDirectories) as FileNode; FileNode albumfile = dir.Navigate("pak/album_covers/album_covers.pak.ngc", false, true) as FileNode; QbFile songlist = new QbFile(songlistfile.Data, PakFormat); QbItemStruct list = songlist.FindItem(QbKey.Create(NeversoftMetadata.SonglistKeys[0]), true) as QbItemStruct; data.Session["rootdir"] = dir; data.Session["rootqb"] = qb; if (albumfile != null) { data.Session["albumpak"] = new Pak(new EndianReader(albumfile.Data, Endianness.BigEndian)); } var items = list.Items; progress.NewTask(items.Count); foreach (QbItemStruct item in items) { SongData song = NeversoftMetadata.GetSongData(data, item); try { AddSong(data, song, progress); } catch (Exception exception) { Exceptions.Warning(exception, "Unable to properly parse " + song.Name); } progress.Progress(); } progress.EndTask(); } catch (Exception exception) { Exceptions.Error(exception, "An error occurred while parsing the Guitar Hero 3 Wii disc."); } return(data); }
public override PlatformData Create(string path, Game game, ProgressIndicator progress) { PlatformData data = new PlatformData(this, game); DirectoryNode dir = data.GetDirectoryStructure(path); List <DirectoryNode> dirs = new List <DirectoryNode>(); dirs.Add(dir); dirs.AddRange(dir.Directories); progress.NewTask(dirs.Count); foreach (DirectoryNode songdir in dirs) { data.Session["songdir"] = songdir; FileNode datafile = songdir.Navigate("data", false, true) as FileNode; FileNode newdatafile = songdir.Navigate("songdata", false, true) as FileNode; if (datafile == null && newdatafile == null) { Exceptions.Warning("Unable to find a custom in " + songdir.Filename); continue; } try { SongData song = null; if (datafile != null) { song = HarmonixMetadata.GetSongData(data, DTB.Create(new EndianReader(datafile.Data, Endianness.LittleEndian))); datafile.Data.Close(); AddSongOld(data, song, progress); } else { song = SongData.Create(newdatafile.Data); newdatafile.Data.Close(); AddSongNew(data, song, progress); } } catch (Exception exception) { Exceptions.Error(exception, "Unable to open the custom from " + songdir.Filename); } progress.Progress(); } progress.EndTask(); return(data); }
public override PlatformData Create(string path, Game game, ProgressIndicator progress) { PlatformData data = new PlatformData(this, game); DirectoryNode dir = data.GetDirectoryStructure(path); data.Game = Platform.DetermineGame(data); try { FileNode qbpak = dir.Navigate("pak/qb.pak.ngc") as FileNode; if (qbpak == null) { throw new FormatException("Couldn't find qb.pak on Guitar Hero Wii disc."); } FileNode qspak = dir.Navigate("pak/qs.pak.ngc") as FileNode; if (qspak == null) { throw new FormatException("Couldn't find qs.pak on Guitar Hero Wii disc."); } Pak qs = new Pak(new EndianReader(qspak.Data, Endianness.BigEndian)); StringList strings = new StringList(); foreach (Pak.Node node in qs.Nodes) { strings.ParseFromStream(node.Data); } Pak qb = new Pak(new EndianReader(qbpak.Data, Endianness.BigEndian)); FileNode songlistfile = qb.FindFile(@"scripts\guitar\songlist.qb.ngc"); if (songlistfile == null) { songlistfile = qb.FindFile(@"scripts\guitar\songlist.qb"); } if (songlistfile == null) { throw new FormatException("Couldn't find the songlist on the Guitar Hero Wii disc pak."); } QbFile songlist = new QbFile(songlistfile.Data, PakFormat); data.Session["rootdir"] = dir; List <QbKey> listkeys = new List <QbKey>(); foreach (uint songlistkey in NeversoftMetadata.SonglistKeys) { QbKey key = QbKey.Create(songlistkey); QbItemStruct list = songlist.FindItem(key, true) as QbItemStruct; if (list != null && list.Items.Count > 0) { listkeys.Add(key); } } progress.NewTask(listkeys.Count); List <string> songsadded = new List <string>(); foreach (QbKey songlistkey in listkeys) { QbItemStruct list = songlist.FindItem(songlistkey, true) as QbItemStruct; progress.NewTask(list.Items.Count); foreach (QbItemArray item in list.Items.OfType <QbItemArray>()) { item.Items[0].ItemQbKey = item.ItemQbKey; SongData song = NeversoftMetadata.GetSongData(data, item.Items[0] as QbItemStruct, strings); progress.Progress(); if (songsadded.Contains(song.ID)) { continue; } try { if (AddSong(data, song, progress)) { songsadded.Add(song.ID); } } catch (Exception exception) { Exceptions.Warning(exception, "Unable to properly parse " + song.Name); } } progress.EndTask(); progress.Progress(); } progress.EndTask(); qbpak.Data.Close(); qspak.Data.Close(); } catch (Exception exception) { Exceptions.Error(exception, "An error occurred while parsing the Guitar Hero Wii disc."); } return(data); }
public override PlatformData Create(string path, Game game, ProgressIndicator progress) { PlatformData data = new PlatformData(this, game); DirectoryNode dir = data.GetDirectoryStructure(path); FileNode binfile = dir.Navigate("001.bin") as FileNode; if (binfile == null) { Exceptions.Error("Unable to open Guitar Hero World Tour DLC because 001.bin is missing."); } data.Session["rootdir"] = dir; try { DlcBin bin = new DlcBin(binfile.Data); U8 u8 = new U8(bin.Data); FileNode listfile = u8.Root.Navigate("DLC1.pak.ngc") as FileNode; Pak qb = new Pak(new EndianReader(listfile.Data, Endianness.BigEndian)); FileNode songlistfile = qb.Root.Find("catalog_info.qb.ngc", SearchOption.AllDirectories) as FileNode; QbFile songlist = new QbFile(songlistfile.Data, PakFormat); StringList strings = new StringList(); foreach (Pak.Node node in qb.Nodes) { if (!node.Filename.HasValue()) { strings.ParseFromStream(node.Data); } } List <QbKey> listkeys = new List <QbKey>(); foreach (uint songlistkey in NeversoftMetadata.SonglistKeys) { QbKey key = QbKey.Create(songlistkey); QbItemStruct list = songlist.FindItem(key, true) as QbItemStruct; if (list != null && list.Items.Count > 0) { listkeys.Add(key); } } Stream str = new FileStream(@"C:\ghwt.xml", FileMode.Create); StreamWriter writer = new StreamWriter(str); progress.NewTask(listkeys.Count); foreach (QbKey songlistkey in listkeys) { QbItemStruct list = songlist.FindItem(songlistkey, true) as QbItemStruct; progress.NewTask(list.Items.Count); foreach (QbItemArray item in list.Items.OfType <QbItemArray>()) { item.Items[0].ItemQbKey = item.ItemQbKey; SongData song = NeversoftMetadata.GetSongData(data, item.Items[0] as QbItemStruct, strings); writer.WriteLine("\t<song id=\"" + song.ID + "\">"); writer.WriteLine("\t\t<pack>Guitar Hero World Tour DLC</pack>"); writer.WriteLine("\t\t<nameprefix>[GHWT DLC]</nameprefix>"); writer.WriteLine("\t\t<name>" + song.Name + "</name>"); writer.WriteLine("\t\t<artist>" + song.Artist + "</artist>"); writer.WriteLine("\t\t<album>" + song.Album + "</album>"); writer.WriteLine("\t\t<genre>" + song.Genre + "</genre>"); writer.WriteLine("\t\t<track>" + song.AlbumTrack.ToString() + "</track>"); writer.WriteLine("\t\t<difficulty instrument=\"band\" rank=\"1\" />"); writer.WriteLine("\t\t<difficulty instrument=\"guitar\" rank=\"1\" />"); writer.WriteLine("\t\t<difficulty instrument=\"bass\" rank=\"1\" />"); writer.WriteLine("\t\t<difficulty instrument=\"drum\" rank=\"1\" />"); writer.WriteLine("\t\t<difficulty instrument=\"vocals\" rank=\"1\" />"); writer.WriteLine("\t</song>"); try { AddSong(data, song, progress); } catch (Exception exception) { Exceptions.Warning(exception, "Unable to properly parse " + song.Name); } progress.Progress(); } progress.EndTask(); progress.Progress(); } progress.EndTask(); writer.Close(); binfile.Data.Close(); } catch (Exception exception) { Exceptions.Error(exception, "An error occurred while parsing the Guitar Hero World Tour DLC list."); } return(data); }