private static void UpdateSng2014(string songDirectory, Platform targetPlatform) { var xmlFiles = Directory.EnumerateFiles(Path.Combine(songDirectory, "songs", "arr"), "*_*.xml", SearchOption.AllDirectories).ToList(); var sngFolder = Path.Combine(songDirectory, "songs", "bin", targetPlatform.GetPathName()[1]); //-3 or more times re-calculation foreach (var xmlFile in xmlFiles) { if (File.Exists(xmlFile)) { var xmlName = Path.GetFileNameWithoutExtension(xmlFile); bool noShowlights = true; //Update Showlights if (xmlName.ToLower().Contains("_showlights")) { updateShl(xmlFile); } else { var sngFile = Path.Combine(sngFolder, xmlName + ".sng"); var arrType = ArrangementType.Guitar; if (Path.GetFileName(xmlFile).ToLower().Contains("vocal")) { arrType = ArrangementType.Vocal; } // Handle custom fonts string fontSng = null; if (arrType == ArrangementType.Vocal) { var vocSng = Sng2014File.LoadFromFile(sngFile, TryGetPlatformByEndName(songDirectory)); if (vocSng.IsCustomFont()) { vocSng.WriteChartData((fontSng = Path.GetTempFileName()), new Platform(GamePlatform.Pc, GameVersion.None)); } } using (var fs = new FileStream(sngFile, FileMode.Create)) { var sng = Sng2014File.ConvertXML(xmlFile, arrType, fontSng); sng.WriteSng(fs, targetPlatform); } noShowlights &= !xmlFiles.Any(x => Path.GetFileName(x).Contains(xmlName.Split('_')[0].ToLower() + "_showlights")); //Create Showlights if (noShowlights && arrType != ArrangementType.Vocal) { var shlName = Path.Combine(Path.GetDirectoryName(xmlFile), xmlName.Split('_')[0] + "_showlights.xml"); var shl = new RocksmithToolkitLib.DLCPackage.Showlight.Showlights(); if (shl.PopShList(shl.FixShowlights(shl.Genegate(xmlFile).ShowlightList))) { shl.Count = shl.ShowlightList.Count; using (var fs = new FileStream(shlName, FileMode.Create)) shl.Serialize(fs); } } } } } }
private static void UpdateSng2014(string songDirectory, Platform platform) { var xmlFiles = Directory.GetFiles(Path.Combine(songDirectory, "songs", "arr"), "*_*.xml", SearchOption.AllDirectories); var sngFolder = Path.Combine(songDirectory, "songs", "bin", platform.GetPathName()[1]); //-3 or more times re-calculation foreach (var xmlFile in xmlFiles) { if (File.Exists(xmlFile)) { var xmlName = Path.GetFileNameWithoutExtension(xmlFile); bool noShowlights = true; //Update Showlights if (xmlName.ToLower().Contains("_showlights")) { updateShl(xmlFile); } else { var sngFile = Path.Combine(sngFolder, xmlName + ".sng"); var arrType = ArrangementType.Guitar; if (Path.GetFileName(xmlFile).ToLower().Contains("vocal")) { arrType = ArrangementType.Vocal; } using (FileStream fs = new FileStream(sngFile, FileMode.Create)) { Sng2014File sng = Sng2014File.ConvertXML(xmlFile, arrType); sng.WriteSng(fs, platform); } if (xmlFiles.Any(x => Path.GetFileName(x).Contains(xmlName.Split('_')[0].ToLower() + "_showlights"))) { noShowlights = false; } //Create Showlights if (noShowlights && arrType != ArrangementType.Vocal) { var shlName = Path.Combine(Path.GetDirectoryName(xmlFile), xmlName.Split('_')[0] + "_showlights.xml"); var shl = new RocksmithToolkitLib.DLCPackage.Showlight.Showlights(); if (shl.PopShList(shl.FixShowlights(shl.Genegate(xmlFile).ShowlightList))) { shl.Count = shl.ShowlightList.Count; using (var fs = new FileStream(shlName, FileMode.Create)) shl.Serialize(fs); noShowlights = false; } } } } } }
internal static bool updateShl(string shlPath) { var shl = new RocksmithToolkitLib.DLCPackage.Showlight.Showlights(); if (shl.PopShList(shl.FixShowlights(shl.LoadFromFile(shlPath).ShowlightList))) { shl.Count = shl.ShowlightList.Count; using (var fs = new FileStream(shlPath, FileMode.Create)) shl.Serialize(fs); return(false); } return(true); }
private static void UpdateSng2014(string songDirectory, Platform platform) { var xmlFiles = Directory.GetFiles(Path.Combine(songDirectory, "songs", "arr"), "*_*.xml", SearchOption.AllDirectories); var sngFolder = Path.Combine(songDirectory, "songs", "bin", platform.GetPathName()[1]); //-3 or more times re-calculation foreach (var xmlFile in xmlFiles) { if (File.Exists(xmlFile)) { var xmlName = Path.GetFileNameWithoutExtension(xmlFile); bool noShowlights = true; //Update Showlights if (xmlName.ToLower().Contains("_showlights")) updateShl(xmlFile); else { var sngFile = Path.Combine(sngFolder, xmlName + ".sng"); var arrType = ArrangementType.Guitar; if (Path.GetFileName(xmlFile).ToLower().Contains("vocal")) arrType = ArrangementType.Vocal; using (FileStream fs = new FileStream(sngFile, FileMode.Create)) { Sng2014File sng = Sng2014File.ConvertXML(xmlFile, arrType); sng.WriteSng(fs, platform); } if (xmlFiles.Any(x => Path.GetFileName(x).Contains(xmlName.Split('_')[0].ToLower() + "_showlights"))) noShowlights = false; //Create Showlights if (noShowlights && arrType != ArrangementType.Vocal) { var shlName = Path.Combine(Path.GetDirectoryName(xmlFile), xmlName.Split('_')[0] + "_showlights.xml"); var shl = new RocksmithToolkitLib.DLCPackage.Showlight.Showlights(); if (shl.PopShList(shl.FixShowlights(shl.Genegate(xmlFile).ShowlightList))) { shl.Count = shl.ShowlightList.Count; using (var fs = new FileStream(shlName, FileMode.Create)) shl.Serialize(fs); noShowlights = false; } } } } } }
internal static bool updateShl(string shlPath) { var shl = new RocksmithToolkitLib.DLCPackage.Showlight.Showlights(); if (shl.PopShList(shl.FixShowlights(shl.LoadFromFile(shlPath).ShowlightList))) { shl.Count = shl.ShowlightList.Count; using (var fs = new FileStream(shlPath, FileMode.Create)) shl.Serialize(fs); return false; } return true; }