Ejemplo n.º 1
0
 public void MarkAsReadOnly()
 {
     ReadOnly = true;
     ChordiousSettings.MarkAsReadOnly();
     DiagramStyle.MarkAsReadOnly();
     Instruments.MarkAsReadOnly();
     ChordQualities.MarkAsReadOnly();
     Scales.MarkAsReadOnly();
 }
Ejemplo n.º 2
0
        public ConfigFile(string level)
        {
            Level = level;

            ChordiousSettings = new ChordiousSettings(level);
            DiagramStyle      = new DiagramStyle(level);
            Instruments       = new InstrumentSet(level);
            ChordQualities    = new ChordQualitySet(level);
            Scales            = new ScaleSet(level);
            DiagramLibrary    = new DiagramLibrary(DiagramStyle);
        }
Ejemplo n.º 3
0
 public ScaleFinderOptions(ConfigFile configFile, ChordiousSettings chordiousSettings = null) : base(configFile, "scale")
 {
     if (null != chordiousSettings)
     {
         Settings = chordiousSettings;
     }
     else
     {
         string settingsLevel = "ScaleFinderOptions";
         Settings = new ChordiousSettings(_configFile.ChordiousSettings, settingsLevel);
     }
     _cachedScale = null;
 }
Ejemplo n.º 4
0
        public ChordiousSettings Clone()
        {
            ChordiousSettings cs = new ChordiousSettings(Level);

            if (null != Parent)
            {
                cs.Parent = Parent;
            }

            cs.CopyFrom(this);

            return(cs);
        }
Ejemplo n.º 5
0
        public ChordFinderOptions(ConfigFile configFile, ChordiousSettings chordiousSettings = null) : base(configFile, "chord")
        {
            if (null != chordiousSettings)
            {
                Settings = chordiousSettings;
            }
            else
            {
                string settingsLevel = "ChordFinderOptions";
                Settings = new ChordiousSettings(_configFile.ChordiousSettings, settingsLevel);
            }

            _cachedChordQuality = null;
        }
Ejemplo n.º 6
0
        public void LoadFile(Stream inputStream, ConfigParts configParts)
        {
            if (null == inputStream)
            {
                throw new ArgumentNullException(nameof(inputStream));
            }

            using (XmlReader reader = XmlReader.Create(inputStream))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        if (reader.Name == "settings" && ((configParts & ConfigParts.Settings) == ConfigParts.Settings))
                        {
                            ChordiousSettings.Read(reader.ReadSubtree());
                        }
                        else if (reader.Name == "styles" && ((configParts & ConfigParts.Styles) == ConfigParts.Styles))
                        {
                            DiagramStyle.Read(reader.ReadSubtree());
                        }
                        else if (reader.Name == "instruments" && ((configParts & ConfigParts.Instruments) == ConfigParts.Instruments))
                        {
                            Instruments.Read(reader.ReadSubtree());
                        }
                        else if (reader.Name == "qualities" && ((configParts & ConfigParts.Qualities) == ConfigParts.Qualities))
                        {
                            ChordQualities.Read(reader.ReadSubtree());
                        }
                        else if (reader.Name == "scales" && ((configParts & ConfigParts.Scales) == ConfigParts.Scales))
                        {
                            Scales.Read(reader.ReadSubtree());
                        }
                        else if (reader.Name == "library" && ((configParts & ConfigParts.Library) == ConfigParts.Library))
                        {
                            DiagramLibrary.Read(reader.ReadSubtree());
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void ImportConfig(ConfigFile configFile, ConfigParts configParts)
        {
            if (null == configFile)
            {
                throw new ArgumentNullException(nameof(configFile));
            }

            if ((configParts & ConfigParts.Settings) == ConfigParts.Settings)
            {
                ChordiousSettings.CopyFrom(configFile.ChordiousSettings);
            }

            if ((configParts & ConfigParts.Styles) == ConfigParts.Styles)
            {
                DiagramStyle.CopyFrom(configFile.DiagramStyle);
            }

            if ((configParts & ConfigParts.Instruments) == ConfigParts.Instruments)
            {
                Instruments.CopyFrom(configFile.Instruments);
            }

            if ((configParts & ConfigParts.Qualities) == ConfigParts.Qualities)
            {
                ChordQualities.CopyFrom(configFile.ChordQualities);
            }

            if ((configParts & ConfigParts.Scales) == ConfigParts.Scales)
            {
                Scales.CopyFrom(configFile.Scales);
            }

            if ((configParts & ConfigParts.Library) == ConfigParts.Library)
            {
                DiagramLibrary.CopyFrom(configFile.DiagramLibrary);
            }
        }
Ejemplo n.º 8
0
 public ChordiousSettings(ChordiousSettings parentSettings, string level) : base(parentSettings, level)
 {
 }
Ejemplo n.º 9
0
 public ChordiousSettings(ChordiousSettings parentSettings) : base(parentSettings)
 {
 }
Ejemplo n.º 10
0
        public void SaveFile(Stream outputStream, ConfigParts configParts)
        {
            if (null == outputStream)
            {
                throw new ArgumentNullException(nameof(outputStream));
            }

            XmlWriterSettings settings = new XmlWriterSettings
            {
                Indent = true
            };

            using (XmlWriter writer = XmlWriter.Create(outputStream, settings))
            {
                writer.WriteStartElement("chordious");

                writer.WriteAttributeString("version", AppInfo.ProgramTitle);
                writer.WriteAttributeString("date", DateTime.UtcNow.ToString());

                if ((configParts & ConfigParts.Settings) == ConfigParts.Settings)
                {
                    writer.WriteStartElement("settings");
                    ChordiousSettings.Write(writer);
                    writer.WriteEndElement();
                }

                if ((configParts & ConfigParts.Styles) == ConfigParts.Styles)
                {
                    writer.WriteStartElement("styles");
                    DiagramStyle.Write(writer);
                    writer.WriteEndElement();
                }

                if ((configParts & ConfigParts.Instruments) == ConfigParts.Instruments)
                {
                    writer.WriteStartElement("instruments");
                    Instruments.Write(writer);
                    writer.WriteEndElement();
                }

                if ((configParts & ConfigParts.Qualities) == ConfigParts.Qualities)
                {
                    writer.WriteStartElement("qualities");
                    ChordQualities.Write(writer);
                    writer.WriteEndElement();
                }

                if ((configParts & ConfigParts.Scales) == ConfigParts.Scales)
                {
                    writer.WriteStartElement("scales");
                    Scales.Write(writer);
                    writer.WriteEndElement();
                }

                if ((configParts & ConfigParts.Library) == ConfigParts.Library)
                {
                    writer.WriteStartElement("library");
                    DiagramLibrary.Write(writer);
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }
        }