public override bool ValidateData() { DomName d = DomName.Root; string x; string y = ""; var rdr = new System.IO.StringReader(txtTo.Text.Trim()); while (true) { x = rdr.ReadLine(); if (x == null) { break; } if (x.Length == 0) { continue; } x = x.Replace(" ", ""); if (!DomName.TryParse(x, ref d)) { ShowErr("Invalid domain name in 'Alias zone names': " + x); return(false); } y += x + "\r\n"; } rdr.Close(); txtTo.Text = y; if (y.Length == 0) { ShowErr("At least one Alias Zone Name must be specified"); return(false); } txtFrom.Text = txtFrom.Text.Trim().ToLowerInvariant(); if (!DomName.TryParse(txtFrom.Text, ref d)) { ShowErr("Invalid 'Clone from zone' domain name"); return(false); } return(true); }
public void TryParse_should_detect_non_registered_prefixes() { DomName qn; Assert.False(DomName.TryParse("nonexistant:a", out qn)); }