private static void generateManifest(Stream outManifest, Tone tone) { var manifest = new Manifest.Tone.Manifest(); manifest.Entries.Add(tone); var data = JsonConvert.SerializeObject(manifest, Formatting.Indented); var writer = new StreamWriter(outManifest); writer.Write(data); writer.Flush(); outManifest.Seek(0, SeekOrigin.Begin); }
// this may hurt your brain public static List<AgGraphMap> ProjectMap(List<AgGraphNt> agGraphNt, XblockX songsXblock, Manifest.Tone.Manifest toneManifest) { List<AgGraphMap> agGraphRef = new List<AgGraphMap>(); foreach (var xmlFile in agGraphNt) { if (xmlFile.AgType.ToLower() != "logpath") continue; var valueXmlFile = xmlFile.AgValue; var valueUuid = xmlFile.AgUrn; foreach (var id in agGraphNt) // aggregateGraph { if (id.AgType == "llid" && id.AgUrn == valueUuid) { var tonesList = new List<string>(); var expandedLLID = String.Format("{0}{1}", "urn:llid:", id.AgValue); foreach (var entity in songsXblock.entitySet) // songsXblock { string songXmlLLID = String.Empty; string effectChainName = String.Empty; foreach (var property in entity.property) // songsXblock { if (property.name == "SongXml") songXmlLLID = property.set.value; if (property.name == "EffectChainName") effectChainName = property.set.value; if (String.IsNullOrEmpty(effectChainName) || String.IsNullOrEmpty(songXmlLLID)) continue; if (songXmlLLID == expandedLLID) { foreach (var entry in toneManifest.Entries) // toneManifest if (entry.Key == effectChainName) tonesList.Add(entry.Key); if (!tonesList.Any()) tonesList.Add("Default"); agGraphRef.Add(new AgGraphMap() { UUID = id.AgUrn, LLID = id.AgValue.Split(new Char[] { '-' })[0], SongXmlPath = valueXmlFile, Tones = tonesList // RS1 should only have one tone }); break; } } } } } } return agGraphRef; }
private static Tone ReadFromRocksmithExportedXml(string TonePathXML) { var manifest = new Manifest(); var doc = XDocument.Load(TonePathXML); manifest.Entries.AddRange( from e in doc.Descendants("song") select new Tone { //Cleaning BlockAsset = null, Key = null, PersistentID = null, UnlockKey = null, Name = (string)e.Attribute("name"), Volume = (float)e.Attribute("volume"), PedalList = (//key = amp or cabinet or pedal; value = type of Tone.Pedal from p in e.Elements("pedal") select new Pedal { PedalKey = (string)p.Attribute("name"), //string from pedal list KnobValues = p.Descendants("rtpc").ToDictionary(r => r.Attribute("name").Value, r => Convert.ToDecimal(r .Attribute("value").Value)) }) .ToDictionary(x => Transform(x.PedalKey.Split("_".ToCharArray())[0].ToString())) }); Keys.Clear(); num = 0; return manifest.Entries[0]; }