public DataReader(string filePath, LoadFileType fType)
        {
            try
            {
                readFile = new System.IO.StreamReader(filePath);
            }
            catch (Exception)
            {

                System.Windows.Forms.MessageBox.Show("Failed to load the file");
            }
            loadDataArray(fType);
        }
        public void loadDataArray(LoadFileType ft)
        {
            switch (ft)
            {
                case LoadFileType.DBQERef:
                    try
                    {
                        bool dataStart = false;
                        int length = 0;
                        while (readFile.EndOfStream != true)
                        {
                            string tempStr = readFile.ReadLine();
                            if (dataStart == false)
                            {
                                if (tempStr.Contains("Wavelength (nm)"))
                                {
                                    dataStart = true;
                                }
                            }
                            else
                            {
                                string[] dataStr = tempStr.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                                Array.Resize(ref dataArray1, length + 1);
                                Array.Resize(ref dataArray2, length + 1);

                                dataArray1[length] = Convert.ToDouble(dataStr[0]);
                                dataArray2[length] = Convert.ToDouble(dataStr[1]);

                                length++;

                            }
                        }
                    }
                    catch (Exception)
                    {
                        System.Windows.Forms.MessageBox.Show("Fail to load the data from file. Please check the file");
                    }
                    break;
                case LoadFileType.csv2col:
                    int len = 0;
                    while (readFile.EndOfStream!=true)
                    {
                        string tempStr = readFile.ReadLine();
                        string[] dataStr = tempStr.Split(new char[] { ',',' ','\t' },
                            StringSplitOptions.RemoveEmptyEntries);
                        Array.Resize(ref dataArray1, len + 1);
                        Array.Resize(ref dataArray2, len + 1);

                        dataArray1[len] = Convert.ToDouble(dataStr[0]);
                        dataArray2[len] = Convert.ToDouble(dataStr[1]);

                        len++;
                    }
                    break;
                case LoadFileType.KHcsv:
                    loadDataArray_KHcsv();
                    break;
                case LoadFileType.DBQEDev:
                    try
                    {
                        bool dataStart = false;
                        bool convertedQEFile = false;
                        int length = 0;
                        while (readFile.EndOfStream != true)
                        {
                            string tempStr = readFile.ReadLine();
                            if (dataStart == false)
                            {
                                if (tempStr.Contains("Wavelength (nm)"))
                                {
                                    dataStart = true;
                                    if (tempStr.Contains("QE"))
                                    {
                                        convertedQEFile = true;
                                    }
                                }
                            }
                            else
                            {
                                string[] dataStr = tempStr.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                                Array.Resize(ref dataArray1, length + 1);
                                Array.Resize(ref dataArray2, length + 1);

                                dataArray1[length] = Convert.ToDouble(dataStr[0]);
                                if (convertedQEFile==true)
                                {
                                    dataArray2[length] = Convert.ToDouble(dataStr[3]);
                                }
                                else
                                {
                                    dataArray2[length] = Convert.ToDouble(dataStr[1]);
                                }
                                length++;

                            }
                        }
                    }
                    catch (Exception)
                    {
                        System.Windows.Forms.MessageBox.Show("Fail to load the data from file. Please check the file");
                    }
                    break;
            }
        }