Ejemplo n.º 1
0
        private void ParseBinary(PListDictionary dict, Stream stream)
        {
            using (BinaryReader reader = new BinaryReader(stream))
            {
                stream.Position = 0;
                int bpli    = reader.ReadInt32();
                int version = reader.ReadInt32();

                // Read the trailer.
                // The first six bytes of the first eight-byte block are unused, so offset by 26 instead of 32.
                stream.Position = stream.Length - 26;
                //this.offsetIntSize =
                reader.ReadByte();
                //this.objectRefSize =
                reader.ReadByte();
                int objectCount = (int)reader.ReadInt64();
                //this.topLevelObjectOffset = (int)reader.ReadInt64().ToBigEndianConditional();
                //this.offsetTableOffset = (int)reader.ReadInt64().ToBigEndianConditional();
                //int offsetTableSize = this.offsetIntSize * this.objectCount;
            }
        }
Ejemplo n.º 2
0
 public PListDictionary AddDictionary(string key, PListDictionary dictionary)
 {
     dictionary.Key = key;
     AddElement(dictionary);
     return(dictionary);
 }
Ejemplo n.º 3
0
        private PListElement CreateElement(XElement key, XElement val)
        {
            PListElement element = null;

            switch (val.Name.ToString())
            {
            case "data":
                if (key == null)
                {
                    element = new PListDataElement(val.Value);
                }
                else
                {
                    element = new PListDataElement(key.Value, val.Value);
                }
                break;

            case "string":
                if (key == null)
                {
                    element = new PListStringElement(val.Value);
                }
                else
                {
                    element = new PListStringElement(key.Value, val.Value);
                }
                break;

            case "integer":
                if (key == null)
                {
                    element = new PListIntegerElement(int.Parse(val.Value));
                }
                else
                {
                    element = new PListIntegerElement(key.Value, int.Parse(val.Value));
                }
                break;

            case "real":
                element = new PListRealElement(key.Value, float.Parse(val.Value));
                break;

            case "true":
                element = new PListBoolElement(key.Value, true);
                break;

            case "false":
                element = new PListBoolElement(key.Value, false);
                break;

            case "dict":
                if (key == null)
                {
                    element = new PListDictionary();
                }
                else
                {
                    element = new PListDictionary(key.Value);
                }
                ParseDictionary((PListDictionary)element, val.Elements());
                break;

            case "array":
                element = new PListArray(key.Value);
                ParseArray((PListArray)element, val.Elements());
                break;
            }

            return(element);
        }