EDIT: Removed registry check method because it works only for Dx <=9 (thx @Telanor)
This method is very, very slow, but only one I figured out that is 100% accurate
private static int checkdxversion_dxdiag()
{
Process.Start("dxdiag", "/x dxv.xml");
while (!File.Exists("dxv.xml"))
Thread.Sleep(1000);
XmlDocument doc = new XmlDocument();
doc.Load("dxv.xml");
XmlNode dxd = doc.SelectSingleNode("//DxDiag");
XmlNode dxv = dxd.SelectSingleNode("//DirectXVersion");
return Convert.ToInt32(dxv.InnerText.Split(' ')[1]);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…