WikiCrawler/Utility/CategoryTranslation.cs
/// <summary>
/// Records the category the specified tag has been mapped to.
/// </summary>
/// <returns>The complete set of mappings for the tag.</returns>
Records the category the specified tag has been mapped to.
Records the category the specified tag has been mapped to .
private static IEnumerable<string> MapCategory(string tag, string category)
		{
			if (!string.IsNullOrEmpty(category))
			{
				if (!category.StartsWith("Category:")) category = "Category:" + category;
				CategoryMappingData categoryData;
				if (s_categoryMap.TryGetValue(tag, out categoryData))
				{
					categoryData.AddCategory(category);
				}
				else
				{
					categoryData = new CategoryMappingData(category);
					s_categoryMap.Add(tag, categoryData);
				}
				Console.WriteLine("Mapped '" + tag + "' to '" + category + "'.");
				return categoryData.Cats;
			}
			else
			{
				CategoryMappingData categoryData;
				if (!s_categoryMap.TryGetValue(tag, out categoryData))
				{
					categoryData = new CategoryMappingData();
					s_categoryMap.Add(tag, categoryData);
				}
				return categoryData.Cats;
			}
		}
private static IEnumerable < string > MapCategory ( string tag , string category ) { if ( ! string . IsNullOrEmpty ( category ) ) { if ( ! category . StartsWith ( " " ) ) category = " " + category ; CategoryMappingData categoryData ; if ( s_categoryMap . TryGetValue ( tag , out categoryData ) ) { categoryData . AddCategory ( category ) ; } else { categoryData = new CategoryMappingData ( category ) ; s_categoryMap . Add ( tag , categoryData ) ; } Console . WriteLine ( " " + tag + " " + category + " " ) ; return categoryData . Cats ; } else { CategoryMappingData categoryData ; if ( ! s_categoryMap . TryGetValue ( tag , out categoryData ) ) { categoryData = new CategoryMappingData ( ) ; s_categoryMap . Add ( tag , categoryData ) ; } return categoryData . Cats ; } }
Records the category the specified tag has been mapped to.
Records the category the specified tag has been mapped to .
// record blank categories so we don't check them again
The complete set of mappings for the tag.
The complete set of mappings for the tag .
tag
string
category
string