示例#1
0
        // Token: 0x06000158 RID: 344 RVA: 0x00007844 File Offset: 0x00006844
        private static object DecodeRKInt(Bytes.Bits bits, bool div100)
        {
            object obj = bits.Get(2, 30).ToInt32();

            if (div100)
            {
                obj = Convert.ToDouble(obj) / 100.0;
            }
            return(obj);
        }
示例#2
0
        public void DoubleIsLittleEndian()
        {
            double dbl   = 123.4567;
            Bytes  bytes = new Bytes(BitConverter.GetBytes(dbl));

            Bytes.Bits bits        = bytes.GetBits();
            Bytes.Bits mostSigBits = bits.Get(2, 62);
            double     newDbl      = mostSigBits.ToDouble();

            Assert.AreEqual(dbl, newDbl, 0.000001, "Values are different");
        }
示例#3
0
        public void ChoppedDoubleIsValidDecimalRK()
        {
            double dbl   = 123.4567;
            Bytes  bytes = new Bytes(BitConverter.GetBytes(dbl));

            Bytes.Bits bits        = bytes.GetBits();
            Bytes.Bits mostSigBits = bits.Get(34, 30);
            double     newDbl      = mostSigBits.ToDouble();

            Assert.AreEqual(dbl, newDbl, 0.001, "Values are too different");
        }
示例#4
0
        // Token: 0x060001EA RID: 490 RVA: 0x000096B8 File Offset: 0x000086B8
        private void ReadXF_3(Bytes bytes)
        {
            Bytes.Bits bits = bytes.GetBits();
            ushort     num  = bits.Get(4, 12).ToUInt16();

            if (num != 4095)
            {
                this.ReadStyleXfIndex = new ushort?(num);
            }
            this.ReadXF_TYPE_PROT(bits.Get(4));
        }
示例#5
0
文件: Cell.cs 项目: neao2002/RS.Core
        private static int DecodeRKInt(Bytes.Bits bits, bool div100)
        {
            int val = bits.Get(2, 30).ToInt32();

            if (div100)
            {
                val /= 10; //do it this way in case we get the same behavior as
                           //above when multiplying by 100
                val /= 10;
            }
            return(val);
        }
示例#6
0
        // Token: 0x06000156 RID: 342 RVA: 0x00007774 File Offset: 0x00006774
        private void DecodeRK(Bytes bytes)
        {
            Bytes.Bits bits = bytes.GetBits();
            bool       div  = bits.Values[0];
            bool       flag = bits.Values[1];

            if (flag)
            {
                this.Value = Cell.DecodeRKInt(bits, div);
                this._type = ((this.Value is int) ? CellTypes.Integer : CellTypes.Float);
                return;
            }
            this.Value = Cell.DecodeRKFloat(bits, div);
            this._type = CellTypes.Float;
        }
示例#7
0
        // Token: 0x06000157 RID: 343 RVA: 0x000077DC File Offset: 0x000067DC
        private static double DecodeRKFloat(Bytes.Bits bits, bool div100)
        {
            Bytes.Bits bits2 = bits.Get(2, 30);
            bits2.Prepend(false);
            bits2.Prepend(false);
            byte[] array = new byte[8];
            bits2.GetBytes().ByteArray.CopyTo(array, 4);
            BitConverter.GetBytes(1.0);
            double num = BitConverter.ToDouble(array, 0);

            if (div100)
            {
                num /= 100.0;
            }
            return(num);
        }
示例#8
0
        private static double DecodeRKFloat(Bytes.Bits bits, bool div100)
        {
            Bytes.Bits floatBits = bits.Get(2, 30);
            floatBits.Prepend(false); //right-shift to full 8 bytes
            floatBits.Prepend(false);
            byte[] floatBytes = new byte[8];
            floatBits.GetBytes().ByteArray.CopyTo(floatBytes, 4);
            byte[] double1Bytes = BitConverter.GetBytes((double)1);
            double val          = BitConverter.ToDouble(floatBytes, 0);

            if (div100)
            {
                val /= 100.0;
            }
            return(val);
        }
示例#9
0
        private void DecodeRK(Bytes bytes)
        {
            Bytes.Bits bits   = bytes.GetBits();
            bool       div100 = bits.Values[0];
            bool       isInt  = bits.Values[1];

            if (isInt)
            {
                Value = DecodeRKInt(bits, div100);
                _type = (Value is Int32) ? CellTypes.Integer : CellTypes.Float;
            }
            else
            {
                Value = DecodeRKFloat(bits, div100);
                _type = CellTypes.Float;
            }
        }
示例#10
0
        private void ReadXF_3(Bytes bytes)
        {
            Bytes.Bits bits = bytes.GetBits();

            ushort parentStyleXfIndex = bits.Get(4, 12).ToUInt16();

            if (parentStyleXfIndex == 4095)
            {
                //this is a Style XF -- do nothing
            }
            else
            {
                ReadStyleXfIndex = parentStyleXfIndex; //we'll assign the style xf index later using the xfIdxLookups collected by Workbook.ReadBytes()
            }

            ReadXF_TYPE_PROT(bits.Get(4));
        }
示例#11
0
文件: Cell.cs 项目: neao2002/RS.Core
        private static double DecodeRKFloat(Bytes.Bits bits, bool div100)
        {
            Bytes.Bits floatBits = bits.Get(2, 30);
            floatBits.Prepend(false); //right-shift to full 8 bytes
            floatBits.Prepend(false);
            byte[] floatBytes = new byte[8];
            floatBits.GetBytes().ByteArray.CopyTo(floatBytes, 4);
            byte[] double1Bytes = BitConverter.GetBytes((double)1);
            double val          = BitConverter.ToDouble(floatBytes, 0);

            if (div100)
            {
                val /= 10.0; //do it this way in case we get the same behavior as
                             //above when multiplying by 100
                val /= 10.0;
            }
            return(val);
        }
示例#12
0
 private void ReadXF_TYPE_PROT(Bytes.Bits bits)
 {
 }