Exemplo n.º 1
0
        private void writeInt64()
        {
            DataWriter        dw  = initPofWriter("Int64");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteInt64(0, -1L);
            psw.WriteInt64(0, Int64.MaxValue);

            dw.Flush();
            dw.Close();
        }
Exemplo n.º 2
0
        private void writeChar()
        {
            DataWriter        dw  = initPofWriter("Char");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteChar(0, 'f');
            psw.WriteChar(0, '0');

            dw.Flush();
            dw.Close();
        }
Exemplo n.º 3
0
        private void writeDecimal32()
        {
            DataWriter        dw  = initPofWriter("Dec32");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteDecimal(0, new Decimal(99999, 0, 0, false, 0));
            psw.WriteDecimal(0, new Decimal(9999999, 0, 0, false, 0));
            psw.WriteDecimal(0, new Decimal(9999999, 0, 0, false, 28));

            dw.Flush();
            dw.Close();
        }
Exemplo n.º 4
0
        /*---------Utility methods for writing POF data----------------------*/

        private void writeByte()
        {
            DataWriter        dw  = initPofWriter("Byte");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteByte(0, 1);
            psw.WriteByte(0, 0);
            psw.WriteByte(0, 200);
            psw.WriteByte(0, 255);

            dw.Flush();
            dw.Close();
        }
Exemplo n.º 5
0
        private void writeDecimal64()
        {
            DataWriter        dw  = initPofWriter("Dec64");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteDecimal(0, new Decimal(9999999999));

            Decimal d2 = new Decimal(9999999999999999);

            psw.WriteDecimal(0, d2);

            int[] value = Decimal.GetBits(d2);
            psw.WriteDecimal(0, new Decimal(value[0], value[1], value[3], false, 28));

            dw.Flush();
            dw.Close();
        }
Exemplo n.º 6
0
        private void writeDecimal128()
        {
            DataWriter        dw  = initPofWriter("Dec128");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            psw.WriteDecimal(0, Decimal.MaxValue);

            Decimal d1 = Decimal.Add(new Decimal(Int64.MaxValue), Decimal.One);

            psw.WriteDecimal(0, d1);

            // Scale the maximum integer plus one value
            int[] value = Decimal.GetBits(d1);
            psw.WriteDecimal(0, new Decimal(value[0], value[1], value[3], false, 28));

            dw.Flush();
            dw.Close();
        }
Exemplo n.º 7
0
        private void writeInt128()
        {
            DataWriter        dw  = initPofWriter("Int128");
            WritingPofHandler wfh = new WritingPofHandler(dw);
            PofStreamWriter   psw = new PofStreamWriter(wfh, new SimplePofContext());

            // Test data:
            //   First byte array is equivalent to BigInteger.TEN
            byte[] b1 = { 0x0a };

            //   Second byte array is equivalent to BigInteger("55 5555 5555 5555 5555")
            //   (spaces are there for human parsing).
            //   Equivalent to hex: 0x 07 b5 ba d5 95 e2 38 e3
            byte[] b2 = { 0x07, 0xb5, 0xba, 0xd5, 0x95, 0xe2, 0x38, 0xe3 };

            RawInt128 rawInt1 = new RawInt128(b1);
            RawInt128 rawInt2 = new RawInt128(b2);

            psw.WriteRawInt128(0, rawInt1);
            psw.WriteRawInt128(0, rawInt2);

            dw.Flush();
            dw.Close();
        }