private static bool TryEnqueueEntry(VisitedUri entry) { lock (bagLock) { if (allProcessedUris.Contains(entry)) { return(false); } } allProcessedUris.Add(entry); consumerQueue.Enqueue(entry); // Console.WriteLine(entry.Uri); return(true); }
private static bool TryCreateEntry(out VisitedUri entry, string foundUri, int depth) { try { entry = new VisitedUri { Uri = new Uri(foundUri), depth = depth }; } catch (UriFormatException e) { Console.WriteLine($"Wrong URI format: {foundUri}"); entry = new VisitedUri(); return(false); } return(true); }