public void SerializeAndGet()
        {
            var shortcut = new KeyShortcut
            {
                AddSpace       = true,
                AlignFromCaret = true,
                Alignment      = " = ",
                Language       = "CSharp",
                UseRegex       = true,
                Value          = Key.EqualsPlus
            };

            var xml        = KeyShortcut.Serialize(new[] { shortcut });
            var cloneArray = KeyShortcut.Get(xml);
            Assert.Equal(1, cloneArray.Length);

            var clone = cloneArray[0];

            Assert.Equal(shortcut.AddSpace,       clone.AddSpace);
            Assert.Equal(shortcut.AlignFromCaret, clone.AlignFromCaret);
            Assert.Equal(shortcut.Alignment     , clone.Alignment     );
            Assert.Equal(shortcut.Language      , clone.Language      );
            Assert.Equal(shortcut.UseRegex      , clone.UseRegex      );
            Assert.Equal(shortcut.Value         , clone.Value         );
        }
 public static string Serialize(KeyShortcut[] shortcuts)
 {
     var serializer = new XmlSerializer(shortcuts.GetType());
     var writer     = new StringWriter();
     serializer.Serialize(writer, shortcuts);
     return writer.ToString();
 }
Beispiel #3
0
        public void ResetShortcuts()
        {
            var xml = (string)Settings.Default.Properties["Shortcuts"].DefaultValue;

            Shortcuts = KeyShortcut.Get(xml).ToList();
            FirePropertyChanged("Shortcuts");
        }
Beispiel #4
0
 void Reload()
 {
     Shortcuts = KeyShortcut.Get(m_settings.Shortcuts).ToList();
     XmlTypes  = m_settings.XmlTypes.Cast <string>().ToArray();
     ScopeSelectorLineValues = m_settings.ScopeSelectorLineValues;
     ScopeSelectorLineEnds   = m_settings.ScopeSelectorLineEnds;
     UseIdeTabSettings       = m_settings.UseIdeTabSettings;
 }
Beispiel #5
0
 public void Save()
 {
     m_settings.Shortcuts = KeyShortcut.Serialize(Shortcuts.ToArray());
     m_settings.XmlTypes.Clear();
     m_settings.XmlTypes.AddRange(XmlTypes);
     m_settings.ScopeSelectorLineValues = ScopeSelectorLineValues;
     m_settings.ScopeSelectorLineEnds   = ScopeSelectorLineEnds;
     m_settings.UseIdeTabSettings       = UseIdeTabSettings;
     m_settings.Save();
 }