private static void driver(string fileName)
        {
            long length = GeneralUse.GetFileSize(fileName);
            var  data   = new byte[length];

            data = GeneralUse.loadByteArray(fileName);

            //Create a list of file headers

            List <int>           possibleHeaderIndexes = bmpListFunctions.getHeaderIndexes(data);
            List <byte[]>        possibleHeaderBytes   = bmpListFunctions.getPossibleHeaderBytesList(data, possibleHeaderIndexes);
            List <BmpFileHeader> fileHeaderHeap        = new List <BmpFileHeader>();

            for (int idx = 0; idx < possibleHeaderBytes.Count; idx++)
            {
                BmpFileHeader fileHeader = new BmpFileHeader(possibleHeaderBytes[idx], possibleHeaderIndexes[idx]);
                //BmpFileAccessors fileHeader = BmpFileHeaderList.setFileHeader(possibleHeaderBytes[idx], possibleHeaderIndexes[idx]);

                if (fileHeader.isValid())
                {
                    fileHeaderHeap.Add(fileHeader);
                }
            }
            fileHeaderHeap = bmpListFunctions.createSortedList(fileHeaderHeap);

            WriteAndHashData.Driver(data, fileHeaderHeap, fileName);
            Console.WriteLine("Press enter to exit");
            Console.Read();
        }
        /* * BMP HEADER RELATED FUNCTIONS: FUNCTIONS RELATING TO THE
         * BMP HEADER, FIRST 14 BYTES IN A BMP FILE.
         * Source: https://en.wikipedia.org/wiki/BMP_file_format#Bitmap_file_header
         * Offset hex	Offset dec	Size	Purpose
         * 00	0	2 bytes	The header field used to identify the BMP and DIB file is 0x42 0x4D in hexadecimal, same as BM in ASCII.
         * 02	2	4 bytes	The size of the BMP file in bytes
         * 06	6	2 bytes	Reserved; actual value depends on the application that creates the image
         * 08	8	2 bytes	Reserved; actual value depends on the application that creates the image
         * 0A	10	4 bytes	The offset, i.e. starting address, of the byte where the bitmap image data (pixel array) can be found.
         */

        //Returns image size in bytes (starts at bit 2) from sent in array of bmpFile bytes
        public static int GetImageDataSize(byte[] bmpFile)
        {
            var data = new byte[4];

            data = GeneralUse.FillByteArray(bmpFile, 2, 4);
            return(BitConverter.ToInt32(data, 0));
        }
        public static int getBitsPerPixel(byte[] bmpFile)
        {
            var data = new byte[4];

            data = GeneralUse.FillByteArray(bmpFile, 14, 4);
            return(BitConverter.ToInt32(data, 0));
        }
        //Returns image width (starts at bit 18) from sent in array of bmpFile bytes
        public static int GetImageWidth(byte[] bmpFile)
        {
            var data = new byte[4];

            data = GeneralUse.FillByteArray(bmpFile, 18, 4);
            int imageWidth = BitConverter.ToInt32(data, 0);

            return(imageWidth);
        }
        //Returns image height (starts at bit 22) from sent in array of bmpFile bytes
        public static int GetImageHeight(byte[] bmpFile)
        {
            var data = new byte[4];

            data = GeneralUse.FillByteArray(bmpFile, 22, 4);
            int imageHeight = BitConverter.ToInt32(data, 0);

            return(imageHeight);
        }
        public static void Driver(byte[] data, List <BmpFileHeader> fileHeaderList, string fileName)
        {
            int idx;

            byte[] buffer;
            bool   fileStartsWithBMP;
            int    lastFileHeaderIdx = fileHeaderList.Count - 1;

            //Create folder in path that file is in
            String directoryName = fileName + "_Output";

            Directory.CreateDirectory(directoryName); //Create directory

            //Check if file starts with bmp or other file
            fileStartsWithBMP = false;
            foreach (var fileHeader in fileHeaderList)
            {
                if (fileHeader.minIndex == 0)
                {
                    fileStartsWithBMP = true;
                }
            }
            if (!fileStartsWithBMP) //case data before first bmp file
            {
                buffer = GeneralUse.FillByteArray(data, 0, fileHeaderList[0].minIndex);
                makeFile(directoryName, buffer, 0, false);
            }

            //Loop through each bmp file and make al files
            for (idx = 0; idx < fileHeaderList.Count; idx++)
            {
                buffer = GeneralUse.FillByteArray(data, fileHeaderList[idx].minIndex, fileHeaderList[idx].imageSize);
                makeFile(directoryName, buffer, fileHeaderList[idx].minIndex, true);
                if (idx == lastFileHeaderIdx)
                {
                    break;
                }                                        //If end of fileHeaderList reached
                if (fileHeaderList[idx].maxIndex + 1 < fileHeaderList[idx + 1].minIndex)
                {
                    buffer = GeneralUse.FillByteArray(data, fileHeaderList[idx].maxIndex + 1, fileHeaderList[idx + 1].minIndex - 1);
                    makeFile(directoryName, buffer, fileHeaderList[idx].maxIndex + 1, false);
                }
            } //End for loop

            if (fileHeaderList[lastFileHeaderIdx].maxIndex < data.Length - 1) //In case there is data after last bmp file
            {
                int numBytes = data.Length - 1 - (fileHeaderList[lastFileHeaderIdx].maxIndex);
                buffer = GeneralUse.FillByteArray(data, fileHeaderList[lastFileHeaderIdx].maxIndex, numBytes);
                makeFile(directoryName, buffer, fileHeaderList[lastFileHeaderIdx].maxIndex + 1, false);
            }
        }
        /*Returns a list of byte[] arrays that are the length of the
         * bitmap file header + the DIB header */
        public static List <byte[]> getPossibleHeaderBytesList(byte[] data, List <int> headerIndexList)
        {
            List <byte[]> possibleHeaderBytesList = new List <byte[]>();
            int           dibHeaderSize;

            byte[] header;
            for (int i = 0; i < headerIndexList.Count; i++)
            {
                header        = GeneralUse.FillByteArray(data, headerIndexList[i], 18);                 //Load with bitmap header + 4 to grab dib header size
                dibHeaderSize = BmpFileHeader.getDIBHeaderSize(header);
                header        = GeneralUse.FillByteArray(data, headerIndexList[i], 14 + dibHeaderSize); //fill byte array with both bmp and dib header
                possibleHeaderBytesList.Add(header);
            }
            return(possibleHeaderBytesList);
        }