本文整理汇总了C#中System.Version.Last方法的典型用法代码示例。如果您正苦于以下问题:C# Version.Last方法的具体用法?C# Version.Last怎么用?C# Version.Last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Version
的用法示例。
在下文中一共展示了Version.Last方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckGPUAndVersion
/// <summary>Outputs some general GPU information in text format.</summary>
public static string CheckGPUAndVersion()
{
// Create a list of valid versions. The list must be sorted.
Version[] testedOK = new Version[]
{
Version.Parse("13.251.9001.0"),
Version.Parse("14.501.1003.0"),
Version.Parse("15.200.1062.1004")
};
const string recommend = "(Known working with 14.501.1003 or 15.200.1062)";
StringBuilder msg = new StringBuilder();
bool anyAmdGpuFound = false;
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
foreach (ManagementObject mo in searcher.Get())
{
string desc = mo.Properties["Name"].Value.ToString();
//////////////////// Lets check if this is an AMD GPU (not 100% accurate) /////////////////////////
if (Regex.Match(desc,
@"((AMD|ASUS|ATI)\s+(Radeon|RADEON|Mobility\sRadeon|FireGL|FireStream|Firepro|FirePro|R7|R9|HD)[\s\(\d].*)" +
@"|(Radeon\s?(\(TM\))?\s?(HD|R5|R7|R9)[\s\(\d].*)" +
@"|(ASUS\sEAH6450.*)").Success)
{
anyAmdGpuFound = true;
//////////////////// Lets check the Driver version /////////////////////////
string driverVer = mo.Properties["DriverVersion"].Value.ToString();
Version driver = System.Version.Parse(driverVer);
if (testedOK.Contains(driver))
msg.AppendFormat("INFO: AMD Driver version, {0}, has been verified as working.\r\n", driverVer);
else if ((from t in testedOK where t.Major == driver.Major && t.Minor == driver.Minor select t).Any())
msg.AppendFormat("INFO: AMD driver version, {0}, is near a known working version{1}\r\n", driverVer, recommend);
else if (driver < testedOK[0])
msg.AppendFormat("WARN: AMD driver version, {0}, might be too low (warning below {1}){2}\r\n", driverVer, testedOK[0], recommend);
else if (driver > testedOK.Last())
msg.AppendFormat("WARN: AMD driver version, {0}, might be too new (warning above {1}){2}\r\n", driverVer, testedOK.Last(), recommend);
else
msg.AppendFormat("WARN: AMD driver version, {0}, has not been tested {2}\r\n", driverVer, testedOK.Last(), recommend);
//////////////////// Lets check the GPU dataType using the Video card name /////////////////////////
if (Regex.Match(desc,
@"((AMD|ASUS)\s+Radeon\s*(\(TM\))?\s*(HD|R7|R9|)\s*(7[789]\d|818|821|825|824|828|833|837|847|857|867|840|857|867|876|877|886|895|897|899|855|857|859|867|869|873|875|877|879|883|885|887|889|893|895|897|899)0[MDG]?(\s.*)?)" +
@"|((AMD|ASUS)\s+(Radeon|R7|R9)\s*?(\(TM\))?\s*?(R[79])?\s+(2[0456789][05]X?)\s.*)" +
@"||((AMD|ASUS)\s+Firepro\s*?(\(TM\))?\s*?M(40|41|51|60)00\s.*)").Success)
{
msg.AppendLine("INFO: Found GPU with GCN - " + desc);
}
else if (Regex.Match(desc,
@"((AMD|ATI)\s+FirePro\s+(2270|2460|A300|3800|V[345789][89]00)\s.*?)" + // No FirePro support GCN
@"|(AMD FireStream 93[57]0\s.*?)" + // No FireStream 93xx support GCN
@"|((AMD|ATI|VisionTek)\s+(Mobility\s+)?Radeon\s+(HD\s+)?5[0456789]\d0(X2)?[\s/].*?)" + // No 5000 support GCN
@"|((AMD|ATI)\s+Radeon\s+(HD\s+)?E?6[2-9]\d0[DGMA]?[\s/].*?)" + // No 6000 support GCN
@"|((AMD|ATI)\s+Radeon\s+(HD\s+)?7[03456]\d0[DGM]?[\s/].*?)" + // No 7000-7600 support GCN
@"|((AMD\s+)?Radeon\s+(R5\s+)2[123][05]X?[\s/].*?)").Success) // No 200-235 support GCN
{
msg.AppendLine("ERROR: GPU does not support GCN (" + desc + ")");
}
else
{
msg.AppendLine("WARN: AMD GPU Found: (unknown if GPU supports GCN) " + desc);
}
}
} // end foreach VideoController
if (!anyAmdGpuFound)
msg.AppendLine("ERROR: No known AMD GPU found. ");
return msg.ToString();
}