Scan() public method

public Scan ( byte data, int sizeMax, int sizeMin, int sizeModulus ) : int[]
data byte
sizeMax int
sizeMin int
sizeModulus int
return int[]
        static void Test(Compression compression, string originalFile, string report)
        {
            BinaryReader br = new BinaryReader(File.OpenRead(originalFile));
            byte[] file = br.ReadBytes((int)br.BaseStream.Length);
            br.Close();

            int[] offsetsToTest = compression.Scan(file, 0, file.Length, 4, 0, file.Length);
            int i;
            List<int> differentOffsets = new List<int>(50);

            for (i = 0; i < offsetsToTest.Length; i++)
            {
                bool success = true;
                byte[] data = compression.Compress(compression.Decompress(file, offsetsToTest[i]));
                byte[] data2 = new byte[compression.CompressedLength(file, offsetsToTest[i])];
                Array.Copy(file, offsetsToTest[i], data2, 0, data2.Length);
                success = data.Length <= data2.Length;
                /*for (int j = 0; j < data.Length && success; j++)
                        success = data[j] == data2[j];*/
                if (!success)
                    differentOffsets.Add(offsetsToTest[i]);

            }

            if (differentOffsets.Count == 0)
            {
                messagePoster("No differences were found.");
            }
            else
            {
                messagePoster("There is a difference.");
                StreamWriter sw = new StreamWriter(report, false);
                for (int j = 0; j < differentOffsets.Count; j++)
                {
                    sw.WriteLine(Convert.ToString(differentOffsets[j], 16));
                }
                sw.Close();
            }
        }
        static void Scan(Compression compression, string input, string output, int offset, int lenght)
        {
            if ((compression.supportedModes & CompressionOperation.Scan) == CompressionOperation.None)
            {
                messagePoster("Compression type doesn't support scanning.");
                return;
            }
            byte[] file;
            try
            {
                BinaryReader br = new BinaryReader(File.OpenRead(input));
                file = br.ReadBytes((int)br.BaseStream.Length);
                br.Close();
            }
            catch (IOException)
            {
                messagePoster("Error while opening input file.");
                return;
            }

            if (lenght == 0 || lenght + offset > file.Length)
                lenght = file.Length - offset;

            int[] result = compression.Scan(file, offset, lenght, 4, 0, 0x100000);

            if (result.Length == 0)
                messagePoster("No compressed offsets were found.");
            else
            {
                StreamWriter sw = new StreamWriter(output);
                for (int i = 0; i < result.Length; i++)
                    sw.WriteLine(Convert.ToString(result[i], 16));
                sw.Close();
                messagePoster("Scanning was successful.");
            }
        }