예제 #1
0
        private JArray GetJArray(PListXmlItemArray array)
        {
            JArray jArr = new JArray();

            foreach (var item in array.Value)
            {
                jArr.Add(GetJToken(item));
            }

            return(jArr);
        }
예제 #2
0
        public static IPlistXmlItem LoadXmlNode(XElement node)
        {
            IPlistXmlItem tempItem = null;

            switch (node.Name.LocalName)
            {
            case "string":
            case "ustring":
                tempItem = new PListXmlItemString();
                break;

            case "dict":
                tempItem = new PListXmlItemDict();
                break;

            case "integer":
                tempItem = new PListXmlItemInteger();
                break;

            case "array":
                tempItem = new PListXmlItemArray();
                break;

            case "uid":
                tempItem = new PListXmlItemUid();
                break;

            case "false":
                tempItem = new PListXmlItemFalse();
                break;

            case "true":
                tempItem = new PListXmlItemTrue();
                break;

            default:
                tempItem = null;
                break;
            }
            if (null != tempItem)
            {
                tempItem.Load(node);
            }

            return(tempItem);
        }
예제 #3
0
        private JToken GetJToken(PListXmlItemArray keys, PListXmlItemArray values)
        {
            if (keys.Value.Count != values.Value.Count)
            {
                return(string.Empty);
            }

            JObject res = new JObject();

            for (int pos = 0; pos < keys.Value.Count; pos++)
            {
                res.Add((this.Items[(keys.Value[pos] as PListXmlItemUid).Value] as PListXmlItemString).Value,
                        GetJToken(values.Value[pos]));
            }

            return(res);
        }