public static Manifest LoadFromFile(string manifestToneFile)
 {
     var manifest = new Manifest();
     using (var reader = new StreamReader(manifestToneFile)) {
         manifest = JsonConvert.DeserializeObject<Manifest>(reader.ReadToEnd());
     }
     return manifest;
 }
 private static void generateManifest(Stream outManifest, Tone.Tone tone)
 {
     var manifest = new 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);
 }
        private static void generateManifest(Stream outManifest, Tone.Tone tone)
        {
            var manifest = new 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);
        }
 private static Tone.Tone readManifest(string manifestPath)
 {
     using (var reader = new StreamReader(manifestPath))
     {
         var manifest = new Tone.Manifest();
         manifest = JsonConvert.DeserializeObject<Tone.Manifest>(reader.ReadToEnd());
         // Remove unecessary information
         manifest.Entries[0].BlockAsset = null;
         manifest.Entries[0].ExclusiveBuild = null;
         manifest.Entries[0].Key = null;
         manifest.Entries[0].PersistentID = null;
         manifest.Entries[0].UnlockKey = null;
         return manifest.Entries[0];
     }
 }
        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];
        }