private Task GetPatchesIndex() { return(Task.Run(() => { try { var downloadEntry = new DownloadEntry( Settings.GetRemotePatchesIndexUrl(), Settings.GetRemotePatchesIndexUrl().Replace(Settings.RemoteUrl, string.Empty), null, null, null ); PatchesIndex = Downloader.DownloadJson <PatchIndex>(downloadEntry, Serializer); } catch { PatchesIndex = new PatchIndex() { Patches = new List <PatchIndexEntry>() }; Logger.Warning("No patches index found."); } })); }
public void WriteSVG(XmlWriter w) { w.WriteStartElement("basicChord"); //if(writeMsPosition) // positions are not written to the midiDefs section of an SVG-MIDI file // w.WriteAttributeString("msPosition", MsPosition.ToString()); w.WriteAttributeString("msDuration", _msDuration.ToString()); if (BankIndex != null && BankIndex != M.DefaultBankAndPatchIndex) { w.WriteAttributeString("bank", BankIndex.ToString()); } if (PatchIndex != null) { w.WriteAttributeString("patch", PatchIndex.ToString()); } if (HasChordOff == false) { w.WriteAttributeString("hasChordOff", "0"); } if (Pitches != null) { w.WriteAttributeString("pitches", M.ByteListToString(Pitches)); } if (Velocities != null) { w.WriteAttributeString("velocities", M.ByteListToString(Velocities)); } w.WriteEndElement(); }
private void BuildPatchIndex() { PatchIndex index; if (FilesManager.Exists(_context.Settings.GetPatchesIndexPath())) { index = _context.Serializer.Deserialize <PatchIndex>(File.ReadAllText(_context.Settings.GetPatchesIndexPath())); } else { index = new PatchIndex(); index.Patches = new List <PatchIndexEntry>(); } index.Patches.Add(new PatchIndexEntry() { From = _context.VersionFrom, To = _context.VersionTo }); File.WriteAllText(_context.Settings.GetPatchesIndexPath(), _context.Serializer.Serialize(index)); }