VideoDriverInfoProvider Constructor |
Namespace: Xcalibur.WMI.Hardware.Video
1// Main 2private static void Main() 3{ 4 // Make a connection to the local machine 5 const string computer = "."; 6 var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions 7 { 8 Impersonation = ImpersonationLevel.Impersonate, 9 Authentication = AuthenticationLevel.Connect 10 }); 11 managementScope.Connect(); 12 13 // Video Driver Info Provider 14 var provider = new VideoDriverInfoProvider(managementScope); 15 16 // Fetch data 17 provider.Refresh(); 18 19 // Print 20 foreach (var info in provider.Results) 21 { 22 Console.WriteLine($"Name: \t\t\t{info.Name}"); 23 Console.WriteLine($"Driver: \t\t{info.DriverVersion} ({info.DriverDate:MM/dd/yyyy})"); 24 Console.WriteLine($"Bits / pixel: \t\t{info.CurrentBitsPerPixel}"); 25 Console.WriteLine($"Resolution: \t\t{info.CurrentHorizontalResolution} x {info.CurrentVerticalResolution}"); 26 Console.WriteLine($"Refresh Rate: \t\t{info.CurrentRefreshRate} Hz"); 27 Console.WriteLine($"Min Refresh Rate: \t{info.MinRefreshRate} Hz"); 28 Console.WriteLine($"Max Refresh Rate: \t{info.MaxRefreshRate} Hz"); 29 Console.WriteLine($"Colors: \t\t{info.CurrentNumberOfColors / Math.Pow(2, 30):n1} Billion"); 30 Console.WriteLine($"INF File name: \t\t{info.InfFilename}"); 31 Console.WriteLine(""); 32 } 33 34 // Read 35 Console.Read(); 36} 37 38/* Results: 39 * 40 * Name: NVIDIA GeForce GTX 970 41 * Driver: 23.21.13.9101 (02/22/2018) 42 * Bits / pixel: 32 43 * Resolution: 3840 x 1080 44 * Refresh Rate: 143 Hz 45 * Min Refresh Rate: 50 Hz 46 * Max Refresh Rate: 143 Hz 47 * Colors: 4.0 Billion 48 * INF file name: oem43.inf 49 * 50 */