WikiCrawler/Utility/LicenseUtility.cs
/// <summary>
/// Returns the best applicable license tag for an item with the specified parameters.
/// </summary>
Returns the best applicable license tag for an item with the specified parameters.
Returns the best applicable license tag for an item with the specified parameters .
public static string GetPdLicenseTag(int pubYear, int? authorDeathYear, string pubCountry)
	{
		bool canUsePDOldExpired = false;
		if (pubCountry == "USA")
		{
			canUsePDOldExpired = true;
		}
		else if (authorDeathYear.HasValue)
		{
			canUsePDOldExpired = (DateTime.Now.Year - authorDeathYear.Value) > GetPMADuration(pubCountry)
				|| DateTime.Now.Year - (pubYear + SafeLifetimeYears) > GetPMADuration(pubCountry);
		}
		if (canUsePDOldExpired && pubYear < (DateTime.Now.Year - 95))
		{
			if (authorDeathYear.HasValue && authorDeathYear != 9999)
			{
				return "{{PD-old-auto-expired|deathyear=" + authorDeathYear.ToString() + "}}";
			}
			else if (pubCountry == "US" || pubCountry == "USA")
			{
				return "{{PD-US-expired|country=US}}";
			}
			else if (pubCountry == "FRA")
			{
				return "{{PD-US-expired}}{{PD-France}}";
			}
			else
			{
				return "";
			}
		}
		else
		{
			if (authorDeathYear.HasValue && DateTime.Now.Year - authorDeathYear >= 70)
			{
				return "";
			}
			else
			{
				return "";
			}
		}
	}
public static string GetPdLicenseTag ( int pubYear , int ? authorDeathYear , string pubCountry ) { bool canUsePDOldExpired = false ; if ( pubCountry == " " ) { canUsePDOldExpired = true ; } else if ( authorDeathYear . HasValue ) { canUsePDOldExpired = ( DateTime . Now . Year - authorDeathYear . Value ) > GetPMADuration ( pubCountry ) || DateTime . Now . Year - ( pubYear + SafeLifetimeYears ) > GetPMADuration ( pubCountry ) ; } if ( canUsePDOldExpired && pubYear < ( DateTime . Now . Year - 95 ) ) { if ( authorDeathYear . HasValue && authorDeathYear != 9999 ) { return " " + authorDeathYear . ToString ( ) + " " ; } else if ( pubCountry == " " || pubCountry == " " ) { return " " ; } else if ( pubCountry == " " ) { return " " ; } else { return " " ; } } else { if ( authorDeathYear . HasValue && DateTime . Now . Year - authorDeathYear >= 70 ) { return " " ; } else { return " " ; } } }
Returns the best applicable license tag for an item with the specified parameters.
Returns the best applicable license tag for an item with the specified parameters .
// estimate for authors with unknown deathyear // "{{PD-old-auto|deathyear=" + authorDeathYear.ToString() + "}}";
pubYear
int
authorDeathYear
int?
pubCountry
string