示例#1
0
        public static bool FromXml(string version, XElement config, out Markup markup)
        {
            var nodeId = config.GetAttrValue <ushort>(nameof(Id));

            markup = MarkupManager.Get(nodeId);
            markup.FromXml(version, config);
            return(true);
        }
示例#2
0
        public static void FromXml(XElement config)
        {
            NodesMarkup.Clear();

            var version = config.GetAttrValue("V", Mod.Version);

            foreach (var markupConfig in config.Elements(Markup.XmlName))
            {
                if (Markup.FromXml(version, markupConfig, out Markup markup))
                {
                    NeedUpdate.Add(markup.Id);
                }
            }
        }
示例#3
0
        public static bool FromXml(Version version, XElement config, out Markup markup)
        {
            var nodeId = config.GetAttrValue <ushort>(nameof(Id));

            try
            {
                markup = MarkupManager.Get(nodeId);
                markup.FromXml(version, config);
                return(true);
            }
            catch (Exception error)
            {
                Logger.LogError(() => $"Could load node #{nodeId} markup", error);
                markup = null;
                MarkupManager.LoadErrors += 1;
                return(false);
            }
        }
示例#4
0
        public static void FromXml(XElement config, ObjectsMap map, bool clear = true)
        {
            if (clear)
            {
                Clear();
            }
            LoadErrors = 0;

            var version = config.GetAttrValue("V", Mod.Version);

            foreach (var markupConfig in config.Elements(Markup.XmlName))
            {
                if (Markup.FromXml(version, markupConfig, map, out Markup markup))
                {
                    NeedUpdate.Add(markup.Id);
                }
            }
        }