public void OpenLocalFile() { localSemester = new Semester(gui); OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Open local file"; ofd.Filter = "CSV Files|*.csv"; try { if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { localSemester.LocalRead(ofd.FileName); localSemester.FileName = ofd.FileName; gui.SetLocalFile(ofd.FileName); localFileName = ofd.FileName; KSISFileName = ""; gui.ClearKSISFile(); WriteFileNames(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Reload() { if (!localFileName.Equals("")) { localSemester.LocalRead(localFileName); localSemester.FileName = localFileName; if (!KSISFileName.Equals("")) { Semester KSISsemester = new Semester(gui); KSISsemester.KSISread(KSISFileName); localSemester.VerifyAgainst(KSISsemester); } } }
private void ReadFileNames() { StreamReader readFile = null; try { // open configuration file readFile = new StreamReader(configFileName); // the first line is the local file name localFileName = readFile.ReadLine(); // read in the semeseter from the file name if (!localFileName.Equals("")) { localSemester = new Semester(gui); localSemester.LocalRead(localFileName); localSemester.FileName = localFileName; gui.SetLocalFile(localFileName); } // the second line is the KSIS file name KSISFileName = readFile.ReadLine(); if (!KSISFileName.Equals("")) { Semester KSISsemester = new Semester(gui); KSISsemester.KSISread(KSISFileName); localSemester.VerifyAgainst(KSISsemester); gui.SetKSISFile(KSISFileName); } // save filenames to file readFile.Close(); WriteFileNames(); } catch (Exception e) { localFileName = ""; KSISFileName = ""; } }