Пример #1
0
        /// <summary>
        /// Reads this element binary from the reader.
        /// </summary>
        /// <param name="reader">The <see cref="T:CE.iPhone.PListBinaryReader"/> from which the element is read.</param>
        /// <remarks>Provided for internal use only.</remarks>
        public void ReadBinary(PListBinaryReader reader)
        {
            Byte[] bufKeys = new Byte[reader.CurrentElementLength * reader.ElementIdxSize];
            Byte[] bufVals = new Byte[reader.CurrentElementLength * reader.ElementIdxSize];
            if (reader.BaseStream.Read(bufKeys, 0, bufKeys.Length) != bufKeys.Length)
            {
                throw new PListFormatException();
            }

            if (reader.BaseStream.Read(bufVals, 0, bufVals.Length) != bufVals.Length)
            {
                throw new PListFormatException();
            }

            for (int i = 0; i < reader.CurrentElementLength; i++)
            {
                IPListElement plKey = reader.ReadInternal(reader.ElementIdxSize == 1 ?
                                                          bufKeys[i] : IPAddress.NetworkToHostOrder(BitConverter.ToInt16(bufKeys, 2 * i)));

                if (!(plKey is PListString))
                {
                    throw new PListFormatException("Key is no String");
                }

                IPListElement plVal = reader.ReadInternal(reader.ElementIdxSize == 1 ?
                                                          bufVals[i] : IPAddress.NetworkToHostOrder(BitConverter.ToInt16(bufVals, 2 * i)));

                Add((PListString)plKey, plVal);
            }
        }
Пример #2
0
 public void ReadBinary(PListBinaryReader reader)
 {
     byte[] buffer = new byte[reader.CurrentElementLength * (int)reader.ElementIdxSize];
     if (reader.BaseStream.Read(buffer, 0, buffer.Length) != buffer.Length)
     {
         throw new PListFormatException();
     }
     for (int index = 0; index < reader.CurrentElementLength; ++index)
     {
         this.Add(reader.ReadInternal((int)reader.ElementIdxSize == 1 ? (int)buffer[index] : (int)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(buffer, 2 * index))));
     }
 }
Пример #3
0
 public void ReadBinary(PListBinaryReader reader)
 {
     byte[] buffer1 = new byte[reader.CurrentElementLength * (int)reader.ElementIdxSize];
     byte[] buffer2 = new byte[reader.CurrentElementLength * (int)reader.ElementIdxSize];
     if (reader.BaseStream.Read(buffer1, 0, buffer1.Length) != buffer1.Length)
     {
         throw new PListFormatException();
     }
     if (reader.BaseStream.Read(buffer2, 0, buffer2.Length) != buffer2.Length)
     {
         throw new PListFormatException();
     }
     for (int index = 0; index < reader.CurrentElementLength; ++index)
     {
         IPListElement plistElement1 = reader.ReadInternal((int)reader.ElementIdxSize == 1 ? (int)buffer1[index] : (int)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(buffer1, 2 * index)));
         if (!(plistElement1 is PListString))
         {
             throw new PListFormatException("Key is no String");
         }
         IPListElement plistElement2 = reader.ReadInternal((int)reader.ElementIdxSize == 1 ? (int)buffer2[index] : (int)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(buffer2, 2 * index)));
         this.Add((string)((PListElement <string>)plistElement1), plistElement2);
     }
 }
Пример #4
0
        /// <summary>
        /// Reads this element binary from the reader.
        /// </summary>
        /// <param name="reader">The <see cref="T:CE.iPhone.PListBinaryReader"/> from which the element is read.</param>
        /// <remarks>Provided for internal use only.</remarks>
        public void ReadBinary(PListBinaryReader reader)
        {
            Byte[] buf = new Byte[reader.CurrentElementLength * reader.ElementIdxSize];
            if (reader.BaseStream.Read(buf, 0, buf.Length) != buf.Length)
            {
                throw new PListFormatException();
            }

            for (int i = 0; i < reader.CurrentElementLength; i++)
            {
                Add(reader.ReadInternal(reader.ElementIdxSize == 1 ?
                                        buf[i] : IPAddress.NetworkToHostOrder(BitConverter.ToInt16(buf, 2 * i))));
            }
        }