예제 #1
0
        private bool UpdateSettingsXml(XDocument xml)
        {
            bool changed = false;

            foreach (var section in SettingsSection.FromXmlSettingsFile(xml.Root))
            {
                Properties container;
                try {
                    container = dte.Properties(section.Item1);
                } catch (Exception ex) {
                    logger.Log("Warning: Not saving unsupported category " + section.Item1 + " in existing settings file; you may be missing an extension.  Error: " + ex.Message);
                    continue;
                }

                // Single (bitwise) or to avoid short-circuiting & always run merge
                changed = changed | XmlMerger.MergeElements(
                    section.Item2,
                    container.Cast <Property>().Select(p => XmlValue(section.Item1, p)).Where(x => x != null),
                    x => x.Attribute("name").Value
                    );
            }
            return(changed);
        }
예제 #2
0
 static bool MergeElements(XElement container, params XElement[] newItems)
 {
     return(XmlMerger.MergeElements(container, newItems, x => x.Name.LocalName));
 }