public static bool FindBGMEntryIndex(BGMSoundEntry soundEntry) { if (soundEntry.title == currentMyMusicSoundTitle) { return(true); } else { return(false); } }
static void GenerateEntries() { string soundDBFile = @"c:\Ilir\Games\WooU\Mod\Title\vol\content\Sm4shBundle\Sm4shExplorer\V0.07.1\SoundDB.csv"; string soundEntriesBGMFile = @"c:\Ilir\Games\WooU\Mod\Title\vol\content\Sm4shBundle\Sm4shExplorer\V0.07.1\SoundEntriesBGMs.csv"; string outFileName = @"c:\Ilir\Games\WooU\Mod\Title\vol\content\Sm4shBundle\Sm4shExplorer\V0.07.1\SoundEntriesOutput.txt"; List <MyMusicSoundEntry> MyMusic = new List <MyMusicSoundEntry>(); List <BGMSoundEntry> BGMEntries = new List <BGMSoundEntry>(); using (StreamReader srSE = new StreamReader(soundEntriesBGMFile)) { srSE.ReadLine(); for (int i = 2; i <= 1676; i++) { string[] row = srSE.ReadLine().Split(",".ToCharArray()); BGMSoundEntry BGMentry = new BGMSoundEntry(); BGMentry.BGMID = row[0]; Console.WriteLine(i); BGMentry.title = row[1]; BGMEntries.Add(BGMentry); } } using (StreamReader sr = new StreamReader(soundDBFile)) { int i = 1; while (i <= 1046) { string[] line = sr.ReadLine().Split(",".ToCharArray()); MyMusicSoundEntry entry = new MyMusicSoundEntry(); entry.ID = line[0]; Console.WriteLine(entry.ID); entry.SoundLab = line[1]; Console.WriteLine(entry.SoundLab); entry.BGM1 = line[2]; entry.BGM2 = line[3]; entry.BGM3 = line[4]; entry.BGM4 = line[5]; entry.BGM5 = line[6]; entry.InSoundTest = line[7]; entry.byte2 = line[8]; entry.byte3 = line[9]; entry.byte4 = line[10]; entry.InRegionJPN = line[11]; entry.InRegionEUUS = line[12]; entry.SoundSource = line[13]; entry.SoundMixType = line[14]; entry.IconID = ConvertToID(line[15]); entry.SoundTestBackImageBehaviour = line[16]; entry.AssociatedFighters = line[17].Split("|".ToCharArray()); if (entry.AssociatedFighters[0] != "") { for (int p = 0; p < entry.AssociatedFighters.Length; p++) { entry.AssociatedFighters[p] = ConvertToFighterID(entry.AssociatedFighters[p].Trim()); Console.WriteLine(entry.AssociatedFighters[p]); } } entry.SoundTestOrder = line[18]; entry.StageCreationOrder = line[19]; entry.StageCreationGroup = ConvertToID(line[20]); entry.short17 = line[21]; entry.Title = line[22]; entry.SoundTestTitle = line[23]; entry.Description1 = line[24]; entry.Description2 = line[25]; entry.Source = line[26]; Console.WriteLine("done"); //now find BGMID in SoundEntriesDB currentMyMusicSoundTitle = entry.BGM1; int idx = BGMEntries.FindIndex(FindBGMEntryIndex); if (idx != -1) { Console.WriteLine(BGMEntries[idx].BGMID); entry.BGMID = BGMEntries[idx].BGMID; MyMusic.Add(entry); } i++; } } using (StreamWriter sw = new StreamWriter(outFileName)) { foreach (MyMusicSoundEntry m in MyMusic) { sw.WriteLine(" <se>"); sw.WriteLine(" <sid>{0}</sid>", m.ID); sw.WriteLine(" <BGMFiles>"); sw.WriteLine(" <seb>"); sw.WriteLine(" <bid>{0}</bid>", m.BGMID); sw.WriteLine(" </seb>"); sw.WriteLine(" </BGMFiles>"); sw.WriteLine(" <b1>true</b1>"); sw.WriteLine(" <b2>true</b2>"); sw.WriteLine(" <b3>true</b3>"); sw.WriteLine(" <b4>false</b4>"); sw.WriteLine(" <b5>true</b5>"); sw.WriteLine(" <b6>true</b6>"); sw.WriteLine(" <source>CoreGameSound</source>"); sw.WriteLine(" <mix>{0}</mix>", m.SoundMixType); sw.WriteLine(" <icon>{0}</icon>", m.IconID); sw.WriteLine(" <back>{0}</back>", m.SoundTestBackImageBehaviour); if (m.AssociatedFighters[0] != "") { sw.WriteLine(" <AssociatedFightersIDs>"); for (int i = 0; i < m.AssociatedFighters.Length; i++) { sw.WriteLine(" <int>{0}</int>", m.AssociatedFighters[i]); } sw.WriteLine(" </AssociatedFightersIDs>"); } else { sw.WriteLine(" <AssociatedFightersIDs />"); } sw.WriteLine(" <storder>999</storder>"); sw.WriteLine(" <scorder>999</scorder>"); sw.WriteLine(" <scgid>{0}</scgid>", m.StageCreationGroup); sw.WriteLine(" <sho>0</sho>"); sw.WriteLine(" <t1>{0}</t1>", m.Title); sw.WriteLine(" <t2>{0}</t2>", m.SoundTestTitle); if (m.Description1 == "") { sw.WriteLine(" <d1 />"); } else { sw.WriteLine(" <d1>{0}</d1>", m.Description1); } if (m.Description2 == "") { sw.WriteLine(" <d2 />"); } else { sw.WriteLine(" <d2>{0}</d2>", m.Description2); } sw.WriteLine(" <so>{0}</so>", m.Source); sw.WriteLine(" </se>"); } } //foreach (MyMusicSoundEntry m in ) //write in XML format }