Exemplo n.º 1
0
        /**
         * Constructs a Style record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public StyleRecord(RecordInputStream in1)
        {
            fHighByte = BitFieldFactory.GetInstance(0x01); //have to init here, since we are being called
            //from base, and class level init hasnt been done.
            field_1_xf_index = in1.ReadShort();
            if (Type == STYLE_BUILT_IN)
            {
                field_2_builtin_style       = (byte)in1.ReadByte();
                field_3_outline_style_level = (byte)in1.ReadByte();
            }
            else if (Type == STYLE_USER_DEFINED)
            {
                field_2_name_length = in1.ReadShort();

                // Some files from Crystal Reports lack
                //  the remaining fields, which Is naughty
                if (in1.Remaining > 0)
                {
                    field_3_string_options = (byte)in1.ReadByte();

                    byte[] str = in1.ReadRemainder();
                    if (fHighByte.IsSet(field_3_string_options))
                    {
                        field_4_name = StringUtil.GetFromUnicodeBE(str, 0, field_2_name_length);
                    }
                    else
                    {
                        field_4_name = StringUtil.GetFromCompressedUnicode(str, 0, field_2_name_length);
                    }
                }
            }

            // todo sanity Check exception to make sure we're one or the other
        }
Exemplo n.º 2
0
        public void TestByte()
        {
            Assert.AreEqual(1, BitFieldFactory.GetInstance(1).SetByteBoolean((byte)0, true));
            Assert.AreEqual(2, BitFieldFactory.GetInstance(2).SetByteBoolean((byte)0, true));
            Assert.AreEqual(4, BitFieldFactory.GetInstance(4).SetByteBoolean((byte)0, true));
            Assert.AreEqual(8, BitFieldFactory.GetInstance(8).SetByteBoolean((byte)0, true));
            Assert.AreEqual(16, BitFieldFactory.GetInstance(16).SetByteBoolean((byte)0, true));
            Assert.AreEqual(32, BitFieldFactory.GetInstance(32).SetByteBoolean((byte)0, true));
            Assert.AreEqual(64, BitFieldFactory.GetInstance(64).SetByteBoolean((byte)0, true));
            Assert.AreEqual(128, BitFieldFactory.GetInstance(128).SetByteBoolean((byte)0, true));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(1).SetByteBoolean((byte)1, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(2).SetByteBoolean((byte)2, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(4).SetByteBoolean((byte)4, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(8).SetByteBoolean((byte)8, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(16).SetByteBoolean((byte)16, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(32).SetByteBoolean((byte)32, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(64).SetByteBoolean((byte)64, false));
            Assert.AreEqual(0, BitFieldFactory.GetInstance(127).SetByteBoolean((byte)127, false));
            Assert.AreEqual(254, BitFieldFactory.GetInstance(1).SetByteBoolean((byte)254, false));
            byte clearedBit = BitFieldFactory.GetInstance(0x40).SetByteBoolean(unchecked ((byte)-63), false);

            Assert.AreEqual(false, BitFieldFactory.GetInstance(0x40).IsSet(clearedBit));
        }
Exemplo n.º 3
0
        private static BitField alignTextDir     = bf(unchecked ((int)0x80000000)); // 0 = Text direction modified


        private static BitField bf(int i)
        {
            return(BitFieldFactory.GetInstance(i));
        }
Exemplo n.º 4
0
        internal static BitField alignTextDir     = bf(0x80000000); // 0 = Text direction modified

        private static BitField bf(long i)
        {
            return(BitFieldFactory.GetInstance((int)i));
        }