From 0c5a1f22cce32136e76c471c9dd6716e20c81f91 Mon Sep 17 00:00:00 2001 From: sr55 Date: Sat, 7 Sep 2013 16:54:52 +0000 Subject: WinGui: Add System Information to the About Window and Log header. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5775 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrake.ApplicationServices.csproj | 1 + .../Utilities/GeneralUtilities.cs | 9 ++++- .../Utilities/SystemInfo.cs | 33 +++++++++++++++ win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs | 47 ++++++++++++++++++++++ win/CS/HandBrakeWPF/Views/AboutView.xaml | 8 ++++ 5 files changed, 97 insertions(+), 1 deletion(-) diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index d884131d0..bb85a5071 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -66,6 +66,7 @@ 3.5 + diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs index 42f075508..f316c85c6 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs @@ -96,10 +96,17 @@ namespace HandBrake.ApplicationServices.Utilities { var logHeader = new StringBuilder(); + StringBuilder gpuBuilder = new StringBuilder(); + foreach (var item in SystemInfo.GetGPUInfo) + { + gpuBuilder.AppendLine(string.Format(" {0}", item)); + } + logHeader.AppendLine(String.Format("HandBrake {0} - {1}", VersionHelper.GetVersion(), VersionHelper.GetPlatformBitnessVersion())); logHeader.AppendLine(String.Format("OS: {0}", Environment.OSVersion)); logHeader.AppendLine(String.Format("CPU: {0}", SystemInfo.GetCpuCount)); - logHeader.Append(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory)); + logHeader.AppendLine(String.Format("Ram: {0} MB, ", SystemInfo.TotalPhysicalMemory)); + logHeader.AppendLine(String.Format("GPU Information:{0}{1}", Environment.NewLine, gpuBuilder.ToString().TrimEnd())); logHeader.AppendLine(String.Format("Screen: {0}x{1}", SystemInfo.ScreenBounds.Bounds.Width, SystemInfo.ScreenBounds.Bounds.Height)); logHeader.AppendLine(String.Format("Temp Dir: {0}", Path.GetTempPath())); logHeader.AppendLine(String.Format("Install Dir: {0}", Application.StartupPath)); diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs index 41af30f5e..6eb669114 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs @@ -10,7 +10,11 @@ namespace HandBrake.ApplicationServices.Utilities { using System; + using System.Collections.Generic; + using System.Globalization; + using System.Management; using System.Text.RegularExpressions; + using System.Windows.Documents; using System.Windows.Forms; using HandBrake.Interop.HbLib; @@ -109,5 +113,34 @@ namespace HandBrake.ApplicationServices.Utilities return false; } } + + /// + /// Gets the get gpu driver version. + /// + public static List GetGPUInfo + { + get + { + List gpuInfo = new List(); + ManagementObjectSearcher searcher = new ManagementObjectSearcher( + "select * from " + "Win32_VideoController"); + foreach (ManagementObject share in searcher.Get()) + { + string gpu = string.Empty, version = string.Empty; + + foreach (PropertyData PC in share.Properties) + { + if (PC.Name.Equals("DriverVersion")) version = PC.Value.ToString(); + + + if (PC.Name.Equals("Name")) + gpu = PC.Value.ToString(); + } + + gpuInfo.Add(string.Format("{0} - {1}", gpu, version)); + } + return gpuInfo; + } + } } } \ No newline at end of file diff --git a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs index cb9cef3e7..f456357b7 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AboutViewModel.cs @@ -9,6 +9,11 @@ namespace HandBrakeWPF.ViewModels { + using System; + using System.IO; + using System.Text; + using System.Windows.Forms; + using HandBrake.ApplicationServices.Utilities; using HandBrakeWPF.ViewModels.Interfaces; @@ -18,12 +23,38 @@ namespace HandBrakeWPF.ViewModels /// public class AboutViewModel : ViewModelBase, IAboutViewModel { + /// + /// The system info. + /// + private string systemInfo; + /// /// Initializes a new instance of the class. /// public AboutViewModel() { this.Title = "About HandBrake"; + + StringBuilder builder = new StringBuilder(); + foreach (var item in SystemInfo.GetGPUInfo) + { + builder.AppendLine(item); + } + + StringBuilder system = new StringBuilder(); + system.AppendLine(string.Format("Enviroment: {0}", Environment.NewLine)); + system.AppendLine(string.Format("Operating System: {0}", Environment.OSVersion)); + system.AppendLine(string.Format("CPU: {0}", SystemInfo.GetCpuCount)); + system.AppendLine(string.Format("Ram: {0} MB{1}", SystemInfo.TotalPhysicalMemory, Environment.NewLine)); + + system.AppendLine(string.Format("{0}GPU Information:{0}{0}{1}", Environment.NewLine, builder)); + + system.AppendLine(string.Format("{0}System Paths:{0}", Environment.NewLine)); + system.AppendLine(string.Format("Temp Dir: {0}", Path.GetTempPath())); + system.AppendLine(string.Format("Install Dir: {0}", Application.StartupPath)); + system.AppendLine(string.Format("Data Dir: {0}\n", Application.UserAppDataPath)); + + SystemInformation = system.ToString(); } /// @@ -37,6 +68,22 @@ namespace HandBrakeWPF.ViewModels } } + /// + /// Gets or sets the system info. + /// + public string SystemInformation + { + get + { + return this.systemInfo; + } + set + { + this.systemInfo = value; + this.NotifyOfPropertyChange("SystemInfo"); + } + } + /// /// Close this window. /// diff --git a/win/CS/HandBrakeWPF/Views/AboutView.xaml b/win/CS/HandBrakeWPF/Views/AboutView.xaml index d7b63c08b..188b3aa28 100644 --- a/win/CS/HandBrakeWPF/Views/AboutView.xaml +++ b/win/CS/HandBrakeWPF/Views/AboutView.xaml @@ -29,6 +29,8 @@ + + + + + + + -- cgit v1.2.3