Example #1
0
        private static XDocument CreateOldConfig(ReportingSettings reportingSettings, bool?updateGlobalWSStore, string localKeyboards,
                                                 string webonaryUser, string webonaryPass)
        {
            var settingsElem = new XElement("SIL.CoreImpl.Properties.Settings",
                                            CreateStringSettingElement("IsBTE", false),
                                            CreateStringSettingElement("CheckForBetaUpdates", false),
                                            CreateStringSettingElement("AutoCheckForUpdates", true));

            if (reportingSettings != null)
            {
                settingsElem.Add(new XElement("setting", new XAttribute("name", "Reporting"), new XAttribute("serializeAs", "Xml"),
                                              new XElement("value", XElement.Parse(XmlSerializationHelper.SerializeToString(reportingSettings)))));
            }

            // Leave this obsolete value in in the old config to test that it doesn't cause problems
            if (updateGlobalWSStore != null)
            {
                settingsElem.Add(CreateStringSettingElement("UpdateGlobalWSStore", updateGlobalWSStore));
            }

            if (localKeyboards != null)
            {
                settingsElem.Add(CreateStringSettingElement("LocalKeyboards", localKeyboards));
            }

            if (webonaryUser != null)
            {
                settingsElem.Add(CreateStringSettingElement("WebonaryUser", webonaryUser));
            }

            if (webonaryPass != null)
            {
                settingsElem.Add(CreateStringSettingElement("WebonaryPass", webonaryPass));
            }

            return(new XDocument(new XDeclaration("1.0", "utf-8", "yes"),
                                 new XElement("configuration",
                                              new XElement("configSections",
                                                           new XElement("sectionGroup", new XAttribute("name", "userSettings"),
                                                                        new XElement("section", new XAttribute("name", "SIL.CoreImpl.Properties.Settings")))),
                                              new XElement("userSettings", settingsElem))));
        }
Example #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Loads the specified XML source.
 /// </summary>
 /// <param name="xmlSource">The XML source.</param>
 /// <returns>information about the styles deserialized from the XML source</returns>
 /// ------------------------------------------------------------------------------------
 public static StylePropsInfo Load(string xmlSource)
 {
     return(XmlSerializationHelper.DeserializeFromString <StylePropsInfo>(xmlSource));
 }