Exemple #1
0
        public static int ReadFileHead(Bitmap image, out int?x, out int?y)
        {
            x = 0;
            y = 0;
            List <byte> retBits = new List <byte>(ReadFileBody(image, 32, (int)x, (int)y));
            int         ret     = DataConverter.Bits2Integer(DataConverter.Bytes2Bits(retBits));

            x = 0;
            y = 32;
            return(ret);
        }
        public void Integer2BitsTest()
        {
            // 0000 0000   0000 0000   0000 0000   0000 0100

            List <byte> data = new List <byte>()
            {
                0, 0, 1, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0,
                0, 0, 0, 0, 0, 0, 0, 0
            };
            int expected = 4;

            int actual = DataConverter.Bits2Integer(data);

            Assert.AreEqual(expected, actual);
        }