Esempio n. 1
0
        void Test_Real2()
        {
            var encoded = new byte[] { 0xC0, 0x04, 0xDF };
            var input   = new BerMemoryInput(encoded);
            var decoded = BerEncoding.DecodeReal(input, encoded.Length);

            Console.WriteLine("decoded={0}", decoded);

            var output    = new BerMemoryOutput();
            var reencoded = BerEncoding.EncodeReal(output, decoded);

            var bytes = output.ToArray();

            Console.WriteLine("reencoded={0}", BytesToString(bytes));
        }
Esempio n. 2
0
        void Test_Real()
        {
            var values = new[] { 32.1, 32.125, 32.123, 100, 200, 300, -1000, 5.5005005, 777777777.123456789 };

            foreach (var value in values)
            {
                var output = new BerMemoryOutput();
                BerEncoding.EncodeReal(output, value);

                var input        = new BerMemoryInput(output.Memory);
                var decodedValue = BerEncoding.DecodeReal(input, output.Length);

                Console.WriteLine("value={0} decoded={1}", value, decodedValue);
            }
        }