Ejemplo n.º 1
0
        public byte[] GetCurrentBlock()
        {
            // get 0xEA bytes from the current file but return 0xEE bytes (7 * 34 = 238 = 0xEE bytes)
            // if the blocknumber is 0xF50 return less bytes because that is the last block
            int       address = 0x020000 + _blockNumber * 0xEA;
            ByteCoder bc      = new ByteCoder();

            if (_blockNumber == 0xF50)
            {
                byte[] array = new byte[0xE0];
                bc.ResetCounter();
                for (int byteCount = 0; byteCount < 0xE0; byteCount++)
                {
                    array[byteCount] = bc.codeByte(filebytes[address++]);
                }
                return(array);
            }
            else
            {
                byte[] array = new byte[0xEE];
                bc.ResetCounter();
                for (int byteCount = 0; byteCount < 0xEA; byteCount++)
                {
                    array[byteCount] = bc.codeByte(filebytes[address++]);
                }
                return(array);
            }
        }
Ejemplo n.º 2
0
 public byte[] GetCurrentBlock()
 {
     // get 0xEA bytes from the current file but return 0xEE bytes (7 * 34 = 238 = 0xEE bytes)
     // if the blocknumber is 0xF50 return less bytes because that is the last block
     int address = 0x020000 + _blockNumber * 0xEA;
     ByteCoder bc = new ByteCoder();
     if (_blockNumber == 0xF50)
     {
         byte[] array = new byte[0xE0];
         bc.ResetCounter();
         for (int byteCount = 0; byteCount < 0xE0; byteCount++)
         {
             array[byteCount] = bc.codeByte(filebytes[address++]);
         }
         return array;
     }
     else
     {
         byte[] array = new byte[0xEE];
         bc.ResetCounter();
         for (int byteCount = 0; byteCount < 0xEA; byteCount++)
         {
             array[byteCount] = bc.codeByte(filebytes[address++]);
         }
         return array;
     }
 }
Ejemplo n.º 3
0
        public byte[] GetCurrentBlock_128(int block, bool byteswapped)
        {
            _blockNumber = block;
            int address = _blockNumber * 0x80;


            byte[] buffer = new byte[0x80];
            byte[] array  = new byte[0x88];


            if (byteswapped)
            {
                for (int byteCount = 0; byteCount < 0x80; byteCount += 2)
                {
                    buffer[byteCount + 1] = filebytes[address];
                    buffer[byteCount]     = filebytes[address + 1];
                    address += 2;
                }
            }
            else
            {
                for (int byteCount = 0; byteCount < 0x80; byteCount++)
                {
                    buffer[byteCount] = filebytes[address++];
                }
            }

            ByteCoder bc = new ByteCoder();

            bc.ResetCounter();

            for (int byteCount = 0; byteCount < 0x80; byteCount++)
            {
                array[byteCount] = bc.codeByte(buffer[byteCount]);
            }

            return(array);
        }