示例#1
0
        // Exported to Overwatch
        public static bool ImportSettings(XmlElement element)
        {
            Lookup settings = new Lookup(Logger.sLogger);

            string nameSpace = VersionStamp.sNamespace.Replace("NRaas.", "");

            if (!ParseSection(element, new string[] { nameSpace, "Settings" }, settings))
            {
                return(false);
            }

            foreach (IPersistence helper in Common.DerivativeSearch.Find <IPersistence>())
            {
                string prefix = helper.PersistencePrefix;
                if (prefix == null)
                {
                    continue;
                }

                using (Lookup.Pusher pusher = new Lookup.Pusher(settings, prefix))
                {
                    helper.Import(settings);
                }
            }

            return(settings.WasFound);
        }
示例#2
0
        // Must have different name than above function
        public static string CreateExportString2(string parentName)
        {
            Lookup settings = new Lookup(Logger.sLogger);

            foreach (IPersistence helper in Common.DerivativeSearch.Find <IPersistence>())
            {
                string prefix = helper.PersistencePrefix;
                if (prefix == null)
                {
                    continue;
                }

                using (Lookup.Pusher pusher = new Lookup.Pusher(settings, prefix))
                {
                    helper.Export(settings);
                }
            }

            StringBuilder builder = new StringBuilder();

            builder.Append(Common.NewLine + "<" + parentName + ">");

            builder.Append(settings.ToString());

            builder.Append(Common.NewLine + "</" + parentName + ">");

            return(builder.ToString());
        }