public HostsItem(NetAddress ip, HostAliases hosts, string comment = "") { Enabled = true; IP = ip; Aliases = hosts; Comment = comment ?? ""; Valid = true; }
public HostsItem(NetAddress ip, HostName host, string comment = "") { Enabled = true; IP = ip; Aliases = new HostAliases(host); Comment = comment ?? ""; Valid = true; }
public HostsItem(string ip, string[] hosts, string comment = "") { Enabled = true; IP = new IPAddress(ip); Aliases = new HostAliases(hosts); Comment = comment ?? ""; Valid = true; }
protected Page(PageSession browser, string host, string path, bool ssl = false, params string[] hostAliases) { Host = host; HostAliases = hostAliases.ToList(); HostAliases.Add(host); Path = path; SSL = ssl; if (browser != null) { Browser = browser; Browser.Configuration.AppHost = host; Browser.Configuration.SSL = SSL; } }
public bool Parse(string value) { SourceString = value; try { var match = HostRowPattern.Match(value); if (!match.Success) throw new FormatException(); Enabled = value[0] != '#'; IP = new NetAddress(match.Groups["ip"].Value); Aliases = new HostAliases(match.Groups["hosts"].Value); Comment = match.Groups["comment"].Value; Hidden = false; if (!String.IsNullOrEmpty(Comment)) { Hidden = Comment[0] == '!'; if (Hidden) Comment = Comment.Substring(1).Trim(); } Valid = true; } catch { Enabled = false; Hidden = false; IP = null; Aliases = null; Comment = null; Valid = false; } SourceHash = HalfMD5.ComputeHash(ToString()); return Valid; }