/// <summary>
        /// Returns <c>true</c> if the <c>PropertySet</c> is equal
        /// To the specified parameter, else <c>false</c>.
        /// </summary>
        /// <param name="o">the object To Compare this
        /// <c>PropertySet</c>
        ///  with</param>
        /// <returns><c>true</c>
        ///  if the objects are equal,
        /// <c>false</c>
        /// if not</returns>
        public override bool Equals(Object o)
        {
            if (o == null || !(o is PropertySet))
            {
                return(false);
            }
            PropertySet ps            = (PropertySet)o;
            int         byteOrder1    = ps.ByteOrder;
            int         byteOrder2    = ByteOrder;
            ClassID     classID1      = ps.ClassID;
            ClassID     classID2      = ClassID;
            int         format1       = ps.Format;
            int         format2       = Format;
            int         osVersion1    = ps.OSVersion;
            int         osVersion2    = OSVersion;
            int         sectionCount1 = ps.SectionCount;
            int         sectionCount2 = SectionCount;

            if (byteOrder1 != byteOrder2 ||
                !classID1.Equals(classID2) ||
                format1 != format2 ||
                osVersion1 != osVersion2 ||
                sectionCount1 != sectionCount2)
            {
                return(false);
            }

            /* Compare the sections: */
            return(Util.AreEqual(Sections, ps.Sections));
        }
Exemple #2
0
 public void TestEquals()
 {
     ClassID clsidTest1 = new ClassID(
           new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                   0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
         , 0
     );
     ClassID clsidTest2 = new ClassID(
           new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                   0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10}
         , 0
     );
     ClassID clsidTest3 = new ClassID(
           new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                   0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x11 }
         , 0
     );
     Assert.AreEqual(clsidTest1, clsidTest1);
     Assert.AreEqual(clsidTest1, clsidTest2);
     Assert.IsFalse(clsidTest1.Equals(clsidTest3));
     Assert.IsFalse(clsidTest1.Equals(null));
 }
Exemple #3
0
        public void Test47920()
        {
            POIFSFileSystem fs1    = new POIFSFileSystem(POIDataSamples.GetSpreadSheetInstance().OpenResourceAsStream("47920.xls"));
            IWorkbook       wb     = new HSSFWorkbook(fs1);
            ClassID         clsid1 = fs1.Root.StorageClsid;

            MemoryStream out1 = new MemoryStream(4096);

            wb.Write(out1);
            byte[]          bytes  = out1.ToArray();
            POIFSFileSystem fs2    = new POIFSFileSystem(new MemoryStream(bytes));
            ClassID         clsid2 = fs2.Root.StorageClsid;

            Assert.IsTrue(clsid1.Equals(clsid2));
        }