Beispiel #1
0
        public static void WriteSIDSTAR(bool IsSID)
        {
            // Calling routine for SID and STAR diagrams
            // SSD = Either SID or STAR, depending on flag
            string path;
            string SSDfilter;
            string Section = "STAR"; if (IsSID)
            {
                Section = "SID";
            }

            DataTable SSD = Form1.SSD;

            // Get the list of Selected SSDs
            if (IsSID)
            {
                SSDfilter = "[IsSID]";
            }
            else
            {
                SSDfilter = "NOT [IsSID]";
            }
            SSDfilter += " AND [Selected]";
            DataView dvSSD = new DataView(SSD)
            {
                RowFilter = SSDfilter,
                Sort      = "ID",
            };
            DataTable SSDlist = dvSSD.ToTable(true, "ID");

            // Loop the SSDIDs. Create a text file for each one...
            // No other way to manage the one-file and multifile option

            if (InfoSection.OneFilePerSidStar)
            {
                foreach (DataRow drSSDlist in SSDlist.Rows)
                {
                    // Clear the prior data, if any
                    FixData   = new List <object>();
                    VORData   = new List <object>();
                    NDBData   = new List <object>();
                    SSDlines  = new List <string>();
                    FixesUsed = new List <string>();
                    APTsUsed  = new List <string>();
                    BigResult = string.Empty;
                    // Get the SSD in question - on this loop, the path is the SSDname
                    dvSSD.RowFilter = "ID = '" + drSSDlist[0].ToString() + "'";
                    // Pass the single row of SSD data to the writing programs
                    if (dvSSD.Count != 0)
                    {
                        BuildSSD(dvSSD);
                    }
                    // Creating a file for each dvSSD...
                    path = SCTcommon.CheckFile(PartialPath, dvSSD[0]["SSDcode"].ToString());
                    using (StreamWriter sw = new StreamWriter(path))
                    {
                        sw.WriteLine(CycleHeader);
                        if (InfoSection.IncludeSidStarReferences)
                        {
                            WriteSSDrefs(sw);
                        }
                        // Is this a SID or STAR section?  The 1st character will tell
                        sw.WriteLine(cr + "[" + Section + "]");
                        WriteSSDLines(sw);          // Since Labels depend on lines, call them there
                    }
                }
            }
            else
            {
                FixData   = new List <object>();
                VORData   = new List <object>();
                NDBData   = new List <object>();
                SSDlines  = new List <string>();
                FixesUsed = new List <string>();
                APTsUsed  = new List <string>();
                BigResult = string.Empty;
                foreach (DataRow drSSDlist in SSDlist.Rows)
                {
                    // Get the SSD in question - on this loop, the path is the SSDname
                    dvSSD.RowFilter = "ID = '" + drSSDlist[0].ToString() + "'";
                    if (dvSSD.Count != 0)
                    {
                        BuildSSD(dvSSD);
                    }
                }
                // Create ONE file for all the SSDs
                path = SCTcommon.CheckFile(PartialPath, Section);
                using (StreamWriter sw = new StreamWriter(path))
                {
                    sw.WriteLine(CycleHeader);
                    if (InfoSection.IncludeSidStarReferences)
                    {
                        WriteSSDrefs(sw);
                    }
                    // Is this a SID or STAR section?  The 1st character will tell
                    sw.WriteLine("[" + Section + "]");
                    WriteSSDLines(sw);          // Since Labels depend on lines, call them there
                }
            }
            dvSSD.Dispose();
            SSDlist.Dispose();
        }
Beispiel #2
0
        public static void WriteESE()
        {
            // DataTable LS = Form1.LocalSector;
            var    TextFiles = new List <string>();
            string Message; string path;
            bool   CombineIntoOneFile = SCTchecked.ChkOneESFile;

            if (SCTchecked.ChkES_SCTfile)
            {
                path = SCTcommon.CheckFile(PartialPath, "Header");
                Console.WriteLine("Header...");
                WriteHeader(path);
                if (CombineIntoOneFile)
                {
                    TextFiles.Add(path);
                }

                path = SCTcommon.CheckFile(PartialPath, "Colors");
                Console.WriteLine("ColorDefinitions");
                SCToutput.WriteColors(path);
                if (CombineIntoOneFile)
                {
                    TextFiles.Add(path);
                }

                path = SCTcommon.CheckFile(PartialPath, "Info");
                Console.WriteLine("INFO section...");
                SCToutput.WriteINFO(path);
                if (CombineIntoOneFile)
                {
                    TextFiles.Add(path);
                }

                if (SCTchecked.ChkVOR)
                {
                    path = SCTcommon.CheckFile(PartialPath, "VOR");
                    Console.WriteLine("VORs...");
                    SCToutput.WriteVOR(path);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }
                if (SCTchecked.ChkNDB)
                {
                    path = SCTcommon.CheckFile(PartialPath, "NDB");
                    Console.WriteLine("NDBs...");
                    SCToutput.WriteNDB(path);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }
                if (SCTchecked.ChkFIX)
                {
                    path = SCTcommon.CheckFile(PartialPath, "FIX");
                    Console.WriteLine("Fixes...");
                    SCToutput.WriteFixes(path);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }
                if (SCTchecked.ChkAPT)
                {
                    path = SCTcommon.CheckFile(PartialPath, "APT");
                    Console.WriteLine("Airports...");
                    WriteAPT(path);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }
                if (SCTchecked.ChkRWY)
                {
                    path = SCTcommon.CheckFile(PartialPath, "RWY");
                    Console.WriteLine("Airport Runways...");
                    WriteRWY(path);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }

                if (SCTchecked.ChkARB)
                {
                    path = SCTcommon.CheckFile(PartialPath, "ARTCC_HIGH");
                    Console.WriteLine("ARTCC HIGH...");
                    SCToutput.WriteARB(path, true);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }

                    path = SCTcommon.CheckFile(PartialPath, "ARTCC_LOW");
                    Console.WriteLine("ARTCC LOW...");
                    SCToutput.WriteARB(path, false);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }

                if (SCTchecked.ChkAWY)
                {
                    Console.WriteLine("Low AirWays...");
                    path = SCTcommon.CheckFile(PartialPath, "AirwayLow");
                    SCToutput.WriteAWY(path, IsLow: true);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }

                    path = SCTcommon.CheckFile(PartialPath, "AirwayHigh");
                    Console.WriteLine("High AirWays...");
                    SCToutput.WriteAWY(path, IsLow: false);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }

                if (SCTchecked.ChkSID)
                {
                    Console.WriteLine("SIDS...");
                    SCToutput.WriteSIDSTAR(IsSID: true);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }

                if (SCTchecked.ChkSTAR)
                {
                    Console.WriteLine("STARS...");
                    SCToutput.WriteSIDSTAR(IsSID: false);
                    if (CombineIntoOneFile)
                    {
                        TextFiles.Add(path);
                    }
                }
            }
            Message = TextFiles.Count.ToString() + " text file(s) written to " + PartialPath + cr;

            path = SCTcommon.CheckFile(PartialPath, CycleInfo.AIRAC.ToString(), ".sct2");
            using (var SCTfile = File.Create(path))
            {
                foreach (var file in TextFiles)
                {
                    using (var input = File.OpenRead(file))
                    {
                        input.CopyTo(SCTfile);
                    }
                }
                Message += "Sector file written to " + path + cr;
            }
            // ---------------------------  ESE SIDSTAR STARTS HERE
            path = SCTcommon.CheckFile(PartialPath, "SIDSTAR", ".ese");
            if (SCTchecked.ChkES_SSDfile && path != string.Empty)
            {
                Console.WriteLine("SIDS & STARS...");
                WriteSIDSTAR(path);
                Message += "SIDSTARS file written to " + path + cr;
            }
            SCTcommon.SendMessage(Message);
            Console.WriteLine("End writing output files");
        }
Beispiel #3
0
        public static void WriteSCT()
        {
            // DataTable LS = Form1.LocalSector;
            var    TextFiles = new List <string>();
            string Message;

            Console.WriteLine("Header...");
            string path = SCTcommon.CheckFile(PartialPath, "Header");

            WriteHeader(path);
            TextFiles.Add(path);

            path = SCTcommon.CheckFile(PartialPath, "Colors");
            Console.WriteLine("ColorDefinitions");
            WriteColors(path);
            TextFiles.Add(path);

            path = SCTcommon.CheckFile(PartialPath, "Info");
            Console.WriteLine("INFO section...");
            WriteINFO(path);
            TextFiles.Add(path);

            if (SCTchecked.ChkVOR)
            {
                path = SCTcommon.CheckFile(PartialPath, "VOR");
                Console.WriteLine("VORs...");
                WriteVOR(path);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkNDB)
            {
                path = SCTcommon.CheckFile(PartialPath, "NDB");
                Console.WriteLine("NDBs...");
                WriteNDB(path);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkAPT)
            {
                path = SCTcommon.CheckFile(PartialPath, "APT");
                Console.WriteLine("Airports...");
                WriteAPT(path);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkRWY)
            {
                path = SCTcommon.CheckFile(PartialPath, "RWY");
                Console.WriteLine("Airport Runways...");
                WriteRWY(path);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkFIX)
            {
                path = SCTcommon.CheckFile(PartialPath, "FIX");
                Console.WriteLine("Fixes...");
                WriteFixes(path);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkARB)
            {
                Console.WriteLine("ARTCC HIGH...");
                path = SCTcommon.CheckFile(PartialPath, "ARTCC_HIGH");
                WriteARB(path, true);
                TextFiles.Add(path);

                Console.WriteLine("ARTCC LOW...");
                path = SCTcommon.CheckFile(PartialPath, "ARTCC_LOW");
                WriteARB(path, false);
                TextFiles.Add(path);
            }

            if (SCTchecked.ChkAWY)
            {
                path = SCTcommon.CheckFile(PartialPath, "AirwayLow");
                Console.WriteLine("Low AirWays...");
                WriteAWY(path, IsLow: true);
                TextFiles.Add(path);

                path = SCTcommon.CheckFile(PartialPath, "AirwayHigh");
                Console.WriteLine("High AirWays...");
                WriteAWY(path, IsLow: false);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkSID)
            {
                Console.WriteLine("SIDS...");
                WriteSIDSTAR(IsSID: true);
                TextFiles.Add(path);
            }
            if (SCTchecked.ChkSTAR)
            {
                Console.WriteLine("STARS...");
                WriteSIDSTAR(IsSID: false);
                TextFiles.Add(path);
            }
            if (SCTchecked.IncludeSUAfile)
            {
                path = SCTcommon.CheckFile(PartialPath, "SUA");
                Console.WriteLine(path);
                if (path != string.Empty)
                {
                    Console.WriteLine("SUAs...");
                    WriteSUA();
                    TextFiles.Add(path);
                }
            }

            if (SCTchecked.ChkOneVRCFile)
            {
                path = SCTcommon.CheckFile(PartialPath, CycleInfo.AIRAC.ToString(), ".sct2");
                using (var SCTfile = File.Create(path))
                {
                    foreach (var file in TextFiles)
                    {
                        using (var input = File.OpenRead(file))
                        {
                            input.CopyTo(SCTfile);
                        }
                    }
                }
                Message = "Sector file written to" + path;
                SCTcommon.SendMessage(Message, MessageBoxIcon.Information);
            }
            else
            {
                Message = TextFiles.Count + " text file(s) written to " + FolderMgt.OutputFolder;
                SCTcommon.SendMessage(Message, MessageBoxIcon.Information);
            }
            Console.WriteLine("End writing output files in SCToutput");
        }