コード例 #1
0
        public static XElement ToXElement(this FullDictionary <char, CharacterInfo> dict)
        {
            XElement result = new XElement(strCharacterInfoDict,
                                           from item in dict
                                           select KeyValuePairHelper.ToXElement(item));

            return(result);
        }
コード例 #2
0
        public static FullDictionary <char, CharacterInfo> Parse(XElement xElement)
        {
            FullDictionary <char, CharacterInfo> result = new FullDictionary <char, CharacterInfo>(
                new CharacterInfo()
            {
                width = 0, height = 0, xoffset = 0, yoffset = 0,
            });

            foreach (var item in xElement.Elements(KeyValuePairHelper.strKeyValuePair))
            {
                KeyValuePair <char, CharacterInfo> pair = KeyValuePairHelper.Parse(item);
                result.Add(pair.Key, pair.Value);
            }

            return(result);
        }