Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 1 addition & 30 deletions TimVer/Helpers/VideoHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ internal static List<Dictionary<string, string>> GetAllVideoControllers()
const string scope = @"\\.\root\CIMV2";
const string dialect = "WQL";
const string query = "SELECT DeviceID, Name, Description, CurrentHorizontalResolution, CurrentVerticalResolution, " +
"CurrentRefreshRate, CurrentBitsPerPixel, VideoProcessor, " +
"AdapterRam, CurrentNumberOfColors " +
"CurrentRefreshRate, CurrentBitsPerPixel, VideoProcessor, CurrentNumberOfColors " +
"FROM Win32_VideoController";
try
{
Expand All @@ -40,7 +39,6 @@ internal static List<Dictionary<string, string>> GetAllVideoControllers()
[GetStringResource("GraphicsInfo_DeviceID")] = CimStringProperty(gpu, "DeviceID"),
[GetStringResource("GraphicsInfo_CurrentResolution")] = FormatResolution(gpu),
[GetStringResource("GraphicsInfo_CurrentRefreshRate")] = FormatCurrentRefresh(gpu),
[GetStringResource("GraphicsInfo_AdapterRAM")] = FormatAdapterRamInfo(gpu),
[GetStringResource("GraphicsInfo_BitsPerPixel")] = CimStringProperty(gpu, "CurrentBitsPerPixel"),
[GetStringResource("GraphicsInfo_NumberOfColors")] = FormatColorsInfo(gpu),
[GetStringResource("GraphicsInfo_NumberOfDisplays")] = displayCount.ToString(CultureInfo.InvariantCulture),
Expand Down Expand Up @@ -123,33 +121,6 @@ private static string FormatResolution(CimInstance instance)
}
#endregion Get current resolution

#region Adapter Memory
/// <summary>
/// Gets video adapter Ram.
/// </summary>
/// <param name="instance">The CimInstance</param>
/// <returns>A formatted string.</returns>
#pragma warning disable RCS1213 // Remove unused member declaration
// Leaving this method in place for now as I may add it back in the future. It is currently commented out in the GetAllVideoControllers method.
private static string FormatAdapterRamInfo(CimInstance instance)
#pragma warning restore RCS1213 // Remove unused member declaration
{
if (instance.CimInstanceProperties["AdapterRam"] == null)
{
_log.Debug("Value for AdapterRam was null");
return GetStringResource("MsgText_NotAvailable");
}
double ram = Convert.ToDouble(instance.CimInstanceProperties["AdapterRam"].Value, CultureInfo.InvariantCulture);
if (ram >= Math.Pow(1024, 3))
{
ram /= Math.Pow(1024, 3);
return string.Format(CultureInfo.CurrentCulture, $"{ram:N2} GB");
}
ram /= Math.Pow(1024, 2);
return string.Format(CultureInfo.CurrentCulture, $"{ram:N2} MB");
}
#endregion Adapter Memory

#region Get display count
/// <summary>
/// Gets the count of visible display monitors.
Expand Down