public RobotsBuilder AllowWithComment(Uri uri, string comment) { var allowEntry = new AllowEntry { Url = uri, Comment = comment }; _lastUserAgent.AddEntry(allowEntry); return this; }
public RobotsBuilder AllowWithComment(string url, string comment) { var allowEntry = new AllowEntry { Url = new Uri(_robots.BaseUri, url), Comment = comment }; _lastUserAgent.AddEntry(allowEntry); return this; }
public void Add_allow_entry_Test() { var target = new UserAgentEntry(); Entry entry = new AllowEntry(); target.AddEntry(entry); Assert.NotEmpty(target.Entries); Assert.NotEmpty(target.AllowEntries); Assert.Empty(target.DisallowEntries); }
private static bool CheckAllowedEntry(AllowEntry entry, string[] uriParts, out bool allow) { allow = true; string[] robotInstructionUriParts = entry.Url.PathAndQuery.Split(new[] { '/', '?' }, StringSplitOptions.RemoveEmptyEntries); if (robotInstructionUriParts.Length > uriParts.Length) return false; bool mismatch = false; for (int i = 0; i < Math.Min(robotInstructionUriParts.Length, uriParts.Length); i++) { if (string.Compare(uriParts[i], robotInstructionUriParts[i], true) != 0) { mismatch = true; break; } } if (mismatch) { return false; } return true; }
public void EntryType_Test() { var target = new AllowEntry(); Assert.AreEqual(EntryType.Allow, target.Type); }
internal virtual UrlEntry CreateUrlEntry() { UrlEntry target = new AllowEntry(); return target; }