// Spludlow Software // Copyright © Samuel P. Ludlow 2020 All Rights Reserved // Distributed under the terms of the GNU General Public License version 3 // Distributed WITHOUT ANY WARRANTY; without implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE // https://www.spludlow.co.uk/LICENCE.TXT // The Spludlow logo is a registered trademark of Samuel P. Ludlow and may not be used without permission // v1.14 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; using System.Data; namespace Spludlow.Net { public class PortNumbers { // public static DataTable DataTable = null; static PortNumbers() { string filename = Spludlow.Config.ProgramData + @"\Data\PortNumbers.txt"; if (File.Exists(filename) == false) { using (Spludlow.TempDirectory tempDir = new TempDirectory()) { string url = "https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv"; string tempFilename = tempDir + @"\PortNumbers.csv"; Spludlow.Net.Http.GetDataFile(url, tempFilename); DataTable table = Spludlow.Data.CSV.Read(tempFilename); Spludlow.Data.TextTable.Write(filename, table); } } DataTable = Spludlow.Data.TextTable.ReadFile(filename); } } }