Example #1
0
        public static void readSchedule()
        {
            var fileStream = scheduleFilename;

            using (StreamReader sr = new StreamReader(scheduleFilename, System.Text.Encoding.Default))
            {
                string line;
                while ((line = sr.ReadLine()) != null)
                {
                    string[] items            = line.Split(new char[] { ';' });
                    DateTime application_time = new DateTime();
                    string[] time             = items[0].Split(new char[] { ':' });
                    application_time = application_time.AddHours(int.Parse(time[0]));
                    application_time = application_time.AddMinutes(int.Parse(time[1]));
                    bool is_arriving = true;
                    if (items[4] == "DEPARTURE")
                    {
                        is_arriving = false;
                    }
                    durations required_time_interval = new durations();
                    foreach (durations t in timeDurations)
                    {
                        if (items[3].StartsWith(t.type))
                        {
                            required_time_interval = t;
                        }
                    }
                    //items[0] - время; items[1] - номер рейса; items[2] - авиакомпаниия; items[3] - тип самолета; items[4] - отправление или посадка
                    airplanes.Add(new Airplane(application_time, items[1], items[2], is_arriving, required_time_interval));
                }
            }
            Airplane.generateDelays();
        }
Example #2
0
 public Airplane(DateTime application_time, string flight, string company_name, bool is_arriving, durations required_time_interval)
 {
     ApplicationTime = application_time;
     Flight          = flight;
     CompanyName     = company_name;
     IsArriving      = is_arriving;
     TimeIntervals   = required_time_interval;
     Delta           = 0;
     runwayNumber    = 0;
     type            = required_time_interval.type;
 }
Example #3
0
 public Airplane(DateTime application_time, string _flight, string company_name, bool is_arriving, durations required_time_interval, int runway)
 {
     applicationTime = application_time;
     flight          = _flight;
     companyName     = company_name;
     isArriving      = is_arriving;
     timeIntervals   = required_time_interval;
     delta           = 0;
     runwayNumber    = runway;
     type            = required_time_interval.type;
 }