Exemplo n.º 1
0
        public void AddEntry(HostEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            if (HostEntry.IsIgnoredHostname(entry.Name))
            {
                throw new ArgumentException("The following hostnames cannot be configured: " + String.Join(", ", HostEntry.IgnoredHostnames));
            }

            if (!entries.Contains(entry))
            {
                entries.Add(entry);
            }
        }
Exemplo n.º 2
0
        private void Load(Stream stream)
        {
            deletedLines = new List <int>();

            this.lines = ReadAllLines(stream);

            List <HostEntry> entriesList = new List <HostEntry>();

            for (int i = 0; i < lines.Length; i++)
            {
                HostEntry entry = ParseHostEntry(i, lines[i]);

                if (!(entry == null || HostEntry.IsIgnoredHostname(entry.Name)))
                {
                    entriesList.Add(entry);
                }
            }

            this.entries = entriesList;
        }