예제 #1
0
        public static bool SIDSTARS(string Apt, string FullFilename)
        {
            // The output strings will be
            // <SID/STAR>:<AIRPORT ICAO>:<RUNWAY>:<TRANSITIONxPROCEDURE>:<ROUTE>
            // There will be a line for every RWY with the Procedure and every RWY with Transition.Procedure
            // Therefore, read all the procedures for each runway and save transitions to reuse later
            Airport = Apt;
            bool   result = false;
            string Section = string.Empty; string Level; string Content; string Addenda;

            using (StreamReader reader = new StreamReader(FullFilename))
            {
                while ((Line = reader.ReadLine()) != null)
                {
                    Words.Clear();                              // Start fresh
                    if ((Line.IndexOf("//") == -1) && (Line.Length > 0))
                    {
                        Level = GetLevel();
                        switch (Level)                       // Which "level" is the line
                        {
                        case "Title":                        // No leading whitespace
                            Section = GetLineID();
                            switch (Section)                 // Switch based upon the section we are working with
                            {
                            case "FIXES":                    // Indicates start of the FIXes data
                                break;

                            case "FIX":                         // FiX data - don't need anything except the name but capture all
                                AddFixString();
                                break;

                            case "ENDFIXES":                // Indicates end of the FIXES data
                                Section = string.Empty;
                                break;

                            case "RNWS":                    // Indicates start of the RNW data
                                break;

                            case "RNW":                     // As a title only identifies each RNW in the data
                                Words.AddRange(ParseLine());
                                RNWS.Add(Words[1]);
                                break;

                            case "ENDRNWS":                 // Indicates end of the RNW data
                                Section = string.Empty;
                                break;

                            case "SIDS":                    // Indicates start of the SIDs data
                                break;

                            case "SID":
                                // This begins the read of one SID
                                Words.AddRange(ParseLine());
                                SSDcode = Words[1];             // This is always the SSDcode
                                                                // Usually these are multiline and we need the rest of the entry to load
                                                                // Check for a single-line SID - special handling
                                if (SCTcommon.GetListItemCount(Words, "RNW") != 0)
                                {
                                    AddSID_OneLine();
                                }
                                break;

                            case "STARS":                    // Indicates start of the STARs data
                                break;

                            case "STAR":
                                // This begins the read of one STAR
                                Words.AddRange(ParseLine());
                                SSDcode = AddSTAR();
                                break;

                            case "APPROACHES":              // Indicates start of the APPROACHes data
                                break;

                            case "APPROACH":
                                // This begins the read of one APPROACH
                                // **** ENTER APPROACH SUBROUTINE ****
                                Words.AddRange(ParseLine());
                                SSDcode = Words[1];
                                break;

                            case "//":                          // Comment line
                            default:
                                break;
                            }
                            break;

                        case "Content":                         // This line has one whitespace.  Again, each word is unique to SID or STAR
                            Content = GetLineID();
                            switch (Content)
                            {
                            case "RNW":                         // SID RNW information for the current SID (SSDcode)
                                Words.AddRange(ParseLine());
                                AddSID();
                                break;

                            case "TRANSITION":                  // TRANSITION information for a STAR or APPROACH
                                if (Section == "STAR")
                                {
                                    Words.AddRange(ParseLine());
                                    STARTransition();
                                }
                                break;
                            }
                            break;

                        case "Addenda":                         // This line has two whitespaces.  Each word is unique to a SID or STAR
                            Addenda = GetLineID();
                            switch (Addenda)
                            {
                            case "RNW":                          //Only occurs in STARS
                                Words.AddRange(ParseLine());
                                STAR_RNWS();
                                break;

                            case "TRANSITION":                  // Only occurs in SIDs  SID transitions apply to all RNWs, so don't need a complex DataTable
                                Words.AddRange(ParseLine());
                                SIDTransition();
                                break;
                            }
                            break;

                        case "":
                            break;
                        }
                    }
                }
                SaveRwys();
                result = true;
            }
            return(result);
        }