Пример #1
0
        private void Load()
        {
            StreamReader inStream = new StreamReader(File.Open(rootPath + "database.db", FileMode.OpenOrCreate, FileAccess.Read));


            String activeType = "";

            while (!inStream.EndOfStream)
            {
                String line = inStream.ReadLine();
                if (line.Equals(""))
                {
                    continue;
                }
                if (line.StartsWith("*"))
                {
                    activeType = line.Substring(1, line.IndexOf(':') - 1);
                    continue;
                }
                switch (activeType)
                {
                case "MEMBERS":
                    members.Add(MemberRecord.FromString(line));
                    break;

                case "PROVIDERS":
                    providers.Add(ProviderRecord.FromString(line));
                    break;

                case "SERVICES":
                    services.Add(ServiceRecord.FromString(line));
                    break;

                case "CONSULTATIONS":
                    consultations.Add(ConsultationRecord.FromString(line));
                    break;

                default:
                    break;
                }
            }
            inStream.Close();
        }