Beispiel #1
0
        public static RRSettings DeserializeXml(XElement settingsXml)
        {
            var settings = new RRSettings();

            if (settingsXml.HasElements)
            {
                int xmlPort;
                var preEles = settingsXml.Element("presets").Elements("rrpreset");

                if (int.TryParse(settingsXml.Element("port").Value, out xmlPort))
                {
                    settings.Port = xmlPort;
                }

                settings.Name = settingsXml.Element("name").Value;
                settings.Deck1ArtistPointer = settingsXml.Element("d1aptr").Value;
                settings.Deck1TitlePointer  = settingsXml.Element("d1tptr").Value;
                settings.Deck2ArtistPointer = settingsXml.Element("d2aptr").Value;
                settings.Deck2TitlePointer  = settingsXml.Element("d2tptr").Value;
                settings.Deck3ArtistPointer = settingsXml.Element("d3aptr").Value;
                settings.Deck3TitlePointer  = settingsXml.Element("d3tptr").Value;
                settings.Deck4ArtistPointer = settingsXml.Element("d4aptr").Value;
                settings.Deck4TitlePointer  = settingsXml.Element("d4tptr").Value;
                settings.MasterDeckPointer  = settingsXml.Element("mdptr").Value;

                foreach (var pre in preEles)
                {
                    var preset = RRPreset.DeserializeXml(pre);
                    settings.Presets[preset.Name] = preset;
                }
            }

            return(settings);
        }
Beispiel #2
0
        public static new RRPreset DeserializeXml(XElement presetXml)
        {
            var preset = new RRPreset();

            if (presetXml.HasElements)
            {
                preset.Name = presetXml.Element("name").Value;
                preset.Deck1ArtistPointer = presetXml.Element("d1aptr").Value;
                preset.Deck1TitlePointer  = presetXml.Element("d1tptr").Value;
                preset.Deck2ArtistPointer = presetXml.Element("d2aptr").Value;
                preset.Deck2TitlePointer  = presetXml.Element("d2tptr").Value;
                preset.Deck3ArtistPointer = presetXml.Element("d3aptr").Value;
                preset.Deck3TitlePointer  = presetXml.Element("d3tptr").Value;
                preset.Deck4ArtistPointer = presetXml.Element("d4aptr").Value;
                preset.Deck4TitlePointer  = presetXml.Element("d4tptr").Value;
                preset.MasterDeckPointer  = presetXml.Element("mdptr").Value;
            }

            return(preset);
        }
Beispiel #3
0
 public void SavePreset()
 {
     Presets[Name] = new RRPreset(this);
 }