Beispiel #1
0
        private void Proload()
        {
            RhodesDataBase db       = new RhodesDataBase();
            List <Student> students = new List <Student>();

            using (var input = context.Assets.Open("Students.json"))
                using (StreamReader sr = new StreamReader(input))
                {
                    dynamic stuff = JsonConvert.DeserializeObject(sr.ReadLine());
                    students.Add(new Student {
                        StudentNo = stuff.StudentNumber, Password = stuff.Password
                    });
                }
            db.StoreStudents(students);
        }
        public void StoreStudents()
        {
            List <Student> students = new List <Student>();
            RhodesDataBase db       = new RhodesDataBase();
            var            text     = System.IO.File.OpenText("Files/RhodesMap.geojson");
            string         line     = text.ReadLine();

            while (true)
            {
                if (string.IsNullOrEmpty(line))
                {
                    break;
                }
                dynamic stuff = JsonConvert.DeserializeObject(line);
                students.Add(new Student {
                    StudentNo = stuff.StudentNumber, Password = stuff.Password
                });
                line = text.ReadLine();
            }
            db.StoreStudents(students);
        }