static void LoadData() { FileStream FS = new FileStream("Users_Subjects.txt", FileMode.OpenOrCreate); StreamReader SR = new StreamReader(FS); data = new ArrayList <Pair <int, ArrayList <Pair <bool, Course> > > >(); while (!SR.EndOfStream) { ArrayList <Pair <bool, Course> > s = new ArrayList <Pair <bool, Course> >(); Pair <int, ArrayList <Pair <bool, Course> > > sn = new Pair <int, ArrayList <Pair <bool, Course> > >(); int n; string line = SR.ReadLine(); string[] fields = line.Split('@'); n = int.Parse(fields[0]); for (int i = 1; i < fields.Length; i += 2) { if (fields[i] == "") { continue; } Pair <bool, Course> bc = new Pair <bool, Course>(); if (fields[i] == "1") { bc.First = true; } else { bc.First = false; } bc.Second = CoursesFile.GetCourse(fields[i + 1]); s.Append(bc); } sn.First = n; sn.Second = s; data.Append(sn); } SR.Close(); }
static void LoadData() { FileStream FS = new FileStream("Subjects_User.txt", FileMode.Open); StreamReader SR = new StreamReader(FS); Data = new ArrayList <Pair <Course, ArrayList <Student> > >(); while (!SR.EndOfStream) { ArrayList <Student> s = new ArrayList <Student>(); Pair <Course, ArrayList <Student> > cs = new Pair <Course, ArrayList <Student> >(); Course c; string line = SR.ReadLine(); string[] fields = line.Split('@'); c = CoursesFile.GetCourse(fields[0]); for (int i = 1; i < fields.Length; i++) { s.Append(UsersFile.GetUser(int.Parse(fields[i]))); } cs.First = c; cs.Second = s; Data.Append(cs); } SR.Close(); }
static void LoadData() { FileStream FS = new FileStream("Users_Subjects.txt", FileMode.Open); StreamReader SR = new StreamReader(FS); Data = new ArrayList <Pair <int, ArrayList <Course> > >(); while (!SR.EndOfStream) { ArrayList <Course> s = new ArrayList <Course>(); Pair <int, ArrayList <Course> > sn = new Pair <int, ArrayList <Course> >(); int n; string line = SR.ReadLine(); string[] fields = line.Split('@'); n = int.Parse(fields[0]); for (int i = 1; i < fields.Length; i++) { s.Append(CoursesFile.GetCourse(fields[i])); } sn.First = n; sn.Second = s; Data.Append(sn); } SR.Close(); }