Exemple #1
0
        private static void Test01()
        {
            IntegerConverter conv = new IntegerConverter();

            conv.Number = 65535;
            Console.WriteLine("{0}: ", conv.Number);
            conv.GroupSize = 8;
            conv.ConvertBinary();
            Console.WriteLine(conv.Result);
            conv.ConvertHexadecimal();
            Console.WriteLine(conv.Result);
            conv.Number = 65536;
            Console.WriteLine("{0}: ", conv.Number);
            conv.GroupSize = 8;
            conv.ConvertBinary();
            Console.WriteLine(conv.Result);
            conv.ConvertHexadecimal();
            Console.WriteLine(conv.Result);
            conv.Number = 255;
            Console.WriteLine("{0}: ", conv.Number);
            conv.GroupSize = 4;
            conv.ConvertBinary();
            Console.WriteLine(conv.Result);
            conv.ConvertHexadecimal();
            Console.WriteLine(conv.Result);
            conv.Number = 256;
            Console.WriteLine("{0}: ", conv.Number);
            conv.GroupSize = 4;
            conv.ConvertBinary();
            Console.WriteLine(conv.Result);
            conv.ConvertHexadecimal();
            Console.WriteLine(conv.Result);
        }
Exemple #2
0
        private static void Test01c()
        {
            IntegerConverter conv = new IntegerConverter();

            conv.Number = 12345678;
            Console.WriteLine("{0}: ", conv.Number);
            conv.ConvertDualBCD();
            Console.WriteLine(conv.Result);
        }
Exemple #3
0
        private static void Test01b()
        {
            IntegerConverter conv = new IntegerConverter();

            conv.Number = 123456789;
            Console.WriteLine("{0}: ", conv.Number);
            conv.ConvertBinary();
            Console.WriteLine(conv.Result);
        }
Exemple #4
0
        private static void Test01d()
        {
            IntegerConverter conv = new IntegerConverter();

            Console.WriteLine("{0}: ", Int32.MaxValue);
            conv.Number = Int32.MaxValue;
            conv.ConvertDualBCD();
            Console.WriteLine(conv.Result);
        }
Exemple #5
0
        public void ConvertDualBCD()
        {
            StringBuilder    sb   = new StringBuilder();
            IntegerConverter conv = new IntegerConverter();

            for (int i = 0; i < this.Number.Length; i++)
            {
                conv.Number = this.Number[i];
                conv.ConvertDualBCD();

                if (i > 0)
                {
                    sb.Append(" ");
                }

                sb.Append(conv.Result);
            }

            this.result = sb.ToString();
        }