Example #1
0
        public override bool Equals(object obj)
        {
            PlistData other = obj as PlistData;

            if (other == null)
            {
                return(false);
            }

            return(_value.SequenceEqual(other._value));
        }
        internal IPlistElement ParseObject(long obj)
        {
            this.BaseStream.Seek(ObjectOffsets[obj], SeekOrigin.Begin);
            byte type = this.ReadByte();

            switch (type & 0xF0)
            {
            case 0x00:
                switch (type)
                {
                case 0x00:
                    return(new PlistNull());

                case 0x08:
                    return(new PlistBool(false));

                case 0x09:
                    return(new PlistBool(true));

                //case 0x0C:
                //case 0x0D:
                //    return new PlistUrl.ReadBinary(this, type);
                case 0x0E:
                    return(PlistUid.ReadBinary(this, type));

                case 0x0F:
                    return(null);
                }
                break;

            case 0x10:
                return(PlistInteger.ReadBinary(this, type));

            case 0x20:
                return(PlistReal.ReadBinary(this, type));

            case 0x30:
                return(PlistDate.ReadBinary(this, type));

            case 0x40:
                return(PlistData.ReadBinary(this, type));

            case 0x50:
            case 0x60:
            case 0x70:
                return(PlistString.ReadBinary(this, type));

            //case 0x80:
            //    return PlistUuid.ReadBinary(this, type);
            case 0xA0:
                return(PlistArray.ReadBinary(this, type));

            //case 0xB0:
            //case 0xC0:
            //    return PlistSet.ReadBinary(this, type);
            case 0xD0:
                return(PlistDict.ReadBinary(this, type));
            }

            throw new PlistException(String.Format(
                                         "Unknown binary Plist object encountered. Object {0} at offset 0x{1:x} has a tag of 0x{2:x}",
                                         obj,
                                         this.BaseStream.Position - 1,
                                         type));
        }