Esempio n. 1
0
        private static GameDef LoadFromXml(XElement xml, PackagePart part)
        {
            if (xml.Name != Defs.XmlnsOctgn + "game")
            {
                throw new InvalidFormatException("The root document element must be <game>.");
            }

            return(new GameDef
            {
                Id = xml.Attr <Guid>("id"),
                Name = xml.Attr <string>("name"),
                Version = xml.Attr <Version>("version"),
                OctgnVersion = xml.Attr <Version>("octgnVersion"),
                MarkerSize = xml.Attr <int>("markersize"),
                CardsRevertToOriginalOnGroupChange = xml.Attr <bool>("cardsRevertToOriginalOnGroupChange"),
                CardDefinition = CardDef.LoadFromXml(xml.Child("card"), part),
                DeckDefinition = DeckDef.LoadFromXml(xml.Child("deck")),
                SharedDeckDefinition = DeckDef.LoadFromXml(xml.Child("sharedDeck")),
                TableDefinition = GroupDef.LoadFromXml(xml.Child("table"), part, 0),
                PlayerDefinition = PlayerDef.LoadFromXml(xml.Child("player"), part),
                GlobalDefinition = SharedDef.LoadFromXml(xml.Child("shared"), part),
                GlobalVariables = GlobalVariableDef.LoadAllFromXml(xml.Child("globalvariables")),
                Variables = VariableDef.LoadAllFromXml(xml.Child("variables")),
                Scripts = ScriptDef.LoadAllFromXml(xml.Child("scripts"), part),
                Fonts = FontDef.LoadAllFromXml(xml.Child("fonts"), part),
                Icons = IconDef.LoadAllFromXml(xml.Child("iconreplacements"), part)
            });
        }
Esempio n. 2
0
        internal static SharedDef LoadFromXml(XElement xml, PackagePart part)
        {
            if (xml == null) return null;

            var res = new SharedDef();
            res.LoadBaseXml(xml, part);
            return res;
        }
Esempio n. 3
0
        internal static SharedDef LoadFromXml(XElement xml, PackagePart part)
        {
            if (xml == null)
            {
                return(null);
            }

            var res = new SharedDef();

            res.LoadBaseXml(xml, part);
            return(res);
        }