示例#1
0
        /// <summary>
        /// Determine whether this property is equal to another property.
        /// </summary>
        /// <param name="o">The object to compare to.</param>
        /// <returns>True if the objects are equal.</returns>
        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || !(o is EscherComplexProperty))
            {
                return(false);
            }

            EscherComplexProperty escherComplexProperty = (EscherComplexProperty)o;

            if (!Arrays.Equals(_complexData, escherComplexProperty._complexData))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        public void TestPropertyNames()
        {
            EscherProperty p1 = new EscherSimpleProperty(EscherProperties.GROUPSHAPE__SHAPENAME, 0);
            Assert.AreEqual("groupshape.shapename", p1.Name);
            Assert.AreEqual(EscherProperties.GROUPSHAPE__SHAPENAME, p1.PropertyNumber);
            Assert.IsFalse(p1.IsComplex);

            EscherProperty p2 = new EscherComplexProperty(
                    EscherProperties.GROUPSHAPE__SHAPENAME, false, new byte[10]);
            Assert.AreEqual("groupshape.shapename", p2.Name);
            Assert.AreEqual(EscherProperties.GROUPSHAPE__SHAPENAME, p2.PropertyNumber);
            Assert.IsTrue(p2.IsComplex);
            Assert.IsFalse(p2.IsBlipId);

            EscherProperty p3 = new EscherComplexProperty(
                    EscherProperties.GROUPSHAPE__SHAPENAME, true, new byte[10]);
            Assert.AreEqual("groupshape.shapename", p3.Name);
            Assert.AreEqual(EscherProperties.GROUPSHAPE__SHAPENAME, p3.PropertyNumber);
            Assert.IsTrue(p3.IsComplex);
            Assert.IsTrue(p3.IsBlipId);
        }
示例#3
0
        private void CheckFillFieldsComplex()
        {
            String dataStr = "33 00 " +
                    "0B F0 " +
                    "14 00 00 00 " +
                    "BF 00 01 00 00 00 " +
                    "01 80 02 00 00 00 " +
                    "BF 00 01 00 00 00 " +
                    "01 02";

            EscherOptRecord r = new EscherOptRecord();
            r.FillFields(HexRead.ReadFromString(dataStr), new DefaultEscherRecordFactory());
            Assert.AreEqual((short)0x0033, r.Options);
            Assert.AreEqual(unchecked((short)0xF00B), r.RecordId);
            Assert.AreEqual(3, r.EscherProperties.Count);
            EscherBoolProperty prop1 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            EscherComplexProperty prop2 = new EscherComplexProperty((short)1, false, new byte[] { 0x01, 0x02 });
            EscherBoolProperty prop3 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            Assert.AreEqual(prop1, r.GetEscherProperty(0));
            Assert.AreEqual(prop2, r.GetEscherProperty(1));
            Assert.AreEqual(prop3, r.GetEscherProperty(2));

        }
示例#4
0
        private void CheckSerializeComplex()
        {
            //Complex escher record
            EscherOptRecord r = new EscherOptRecord();
            r.Options=(short)0x0033;
            r.RecordId=unchecked((short)0xF00B);
            EscherBoolProperty prop1 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            EscherComplexProperty prop2 = new EscherComplexProperty((short)1, false, new byte[] { 0x01, 0x02 });
            EscherBoolProperty prop3 = new EscherBoolProperty(EscherProperties.TEXT__SIZE_TEXT_TO_FIT_SHAPE, 1);
            r.AddEscherProperty(prop1);
            r.AddEscherProperty(prop2);
            r.AddEscherProperty(prop3);

            byte[] data = new byte[28];
            int bytesWritten = r.Serialize(0, data);
            Assert.AreEqual(28, bytesWritten);
            String dataStr = "[33, 00, " +
                    "0B, F0, " +
                    "14, 00, 00, 00, " +
                    "BF, 00, 01, 00, 00, 00, " +
                    "01, 80, 02, 00, 00, 00, " +
                    "BF, 00, 01, 00, 00, 00, " +
                    "01, 02, ]";
            Assert.AreEqual(dataStr, HexDump.ToHex(data));

        }