using System; using System.Collections.Generic; using System.IO; namespace SoFii { public static class EmbeddedResources { public static void LoadLines(string name, Action onLine) { using(Stream stream = Program.CurrentAssembly.GetManifestResourceStream($@"{Program.CurrentAssemblyName.Name}.{name}")) using(StreamReader sr = new StreamReader(stream, true)) { string line; while(!string.IsNullOrEmpty(line = sr.ReadLine())) onLine(line); } } public static string[] GetDNSServers() { List items = new List(); LoadLines("DNSServers.txt", line => { if(!line.StartsWith("#")) items.Add(line.Trim()); }); return items.ToArray(); } public static ColourCharInfo[] GetColourChars() { List items = new List(); LoadLines("NameColours.txt", line => { string[] parts = line.Split(' '); if(parts.Length > 1) items.Add(ColourCharInfo.FromStrings(parts[0], parts[1])); }); return items.ToArray(); } } }