コード例 #1
0
        public string ProcessLink(string link, int recursionLevel, string startingUrl, object storageLock)
        {
            Uri    uri          = new Uri(startingUrl);
            string completeLink = uri.Scheme + @":\\" + new Uri(startingUrl).Authority + @"/" + link;
            bool   isNewValue   = false;

            lock (storageLock)
            {
                if (!storageProvider.Contains(completeLink))
                {
                    outputProvider.WriteLine(completeLink + " " + (recursionLevel + 1).ToString());
                    storageProvider.TryAdd(completeLink, recursionLevel + 1);
                    isNewValue = true;
                }
            }

            if (isNewValue)
            {
                return(completeLink);
            }
            else
            {
                return(null);
            }
        }