/// <summary>
        /// This method deSerializes the record from a byte array.
        /// </summary>
        /// <param name="data">The byte array containing the escher record information</param>
        /// <param name="offset">The starting offset into data</param>
        /// <param name="recordFactory">May be null since this is not a container record.</param>
        /// <returns>The number of bytes Read from the byte array.</returns>
        public override int FillFields(byte[] data, int offset, EscherRecordFactory recordFactory)
        {
            int bytesRemaining = ReadHeader(data, offset);
            int pos = offset + 8;

            EscherPropertyFactory f = new EscherPropertyFactory();
            properties = (ArrayList)f.CreateProperties(data, pos, GetInstance());
            return bytesRemaining + 8;
        }
Exemple #2
0
        /// <summary>
        /// This method deSerializes the record from a byte array.
        /// </summary>
        /// <param name="data">The byte array containing the escher record information</param>
        /// <param name="offset">The starting offset into data</param>
        /// <param name="recordFactory">May be null since this is not a container record.</param>
        /// <returns>The number of bytes Read from the byte array.</returns>
        public override int FillFields(byte[] data, int offset, EscherRecordFactory recordFactory)
        {
            int bytesRemaining = ReadHeader(data, offset);
            int pos            = offset + 8;

            EscherPropertyFactory f = new EscherPropertyFactory();

            properties = (ArrayList)f.CreateProperties(data, pos, GetInstance());
            return(bytesRemaining + 8);
        }
        public override int FillFields(byte[] data, int offset,
                                       IEscherRecordFactory recordFactory)
        {
            int   bytesRemaining  = ReadHeader(data, offset);
            short propertiesCount = ReadInstance(data, offset);
            int   pos             = offset + 8;

            EscherPropertyFactory f = new EscherPropertyFactory();

            properties = f.CreateProperties(data, pos, propertiesCount);
            return(bytesRemaining + 8);
        }
        public void TestCreateProperties()
        {
            String dataStr = "41 C1 " +     // propid, complex ind
                    "03 00 00 00 " +         // size of complex property
                    "01 00 " +              // propid, complex ind
                    "00 00 00 00 " +         // value
                    "41 C1 " +              // propid, complex ind
                    "03 00 00 00 " +         // size of complex property
                    "01 02 03 " +
                    "01 02 03 "
                    ;
            byte[] data = HexRead.ReadFromString(dataStr);
            EscherPropertyFactory f = new EscherPropertyFactory();
            IList props = f.CreateProperties(data, 0, (short)3);
            EscherComplexProperty p1 = (EscherComplexProperty)props[0];
            Assert.AreEqual(unchecked((short)0xC141), p1.Id);
            Assert.AreEqual("[01, 02, 03]", HexDump.ToHex(p1.ComplexData));

            EscherComplexProperty p3 = (EscherComplexProperty)props[2];
            Assert.AreEqual(unchecked((short)0xC141), p3.Id);
            Assert.AreEqual("[01, 02, 03]", HexDump.ToHex(p3.ComplexData));


        }