예제 #1
0
 public HostsItem(NetAddress ip, HostAliases hosts, string comment = "")
 {
     Enabled = true;
     IP = ip;
     Aliases = hosts;
     Comment = comment ?? "";
     Valid = true;
 }
예제 #2
0
 public HostsItem(NetAddress ip, HostName host, string comment = "")
 {
     Enabled = true;
     IP = ip;
     Aliases = new HostAliases(host);
     Comment = comment ?? "";
     Valid = true;
 }
예제 #3
0
 public HostsItem(string ip, string[] hosts, string comment = "")
 {
     Enabled = true;
     IP = new IPAddress(ip);
     Aliases = new HostAliases(hosts);
     Comment = comment ?? "";
     Valid = true;
 }
예제 #4
0
        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;
            }
        }
예제 #5
0
 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;
 }