Small fix for mono support, seeing how for we get, but this is just the tip of the iceberg..

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1934 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-06-26 09:46:28 +00:00
commit ed2650eb75

View file

@ -35,6 +35,17 @@ namespace Greenshot.Helpers {
/// </summary> /// </summary>
public static class EnvironmentInfo { public static class EnvironmentInfo {
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger("Greenshot"); private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger("Greenshot");
private static bool? isWindows = null;
public static bool IsWindows {
get {
if (isWindows.HasValue) {
return isWindows.Value;
}
isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Windows");
return isWindows.Value;
}
}
public static string EnvironmentToString(bool newline) { public static string EnvironmentToString(bool newline) {
StringBuilder environment = new StringBuilder(); StringBuilder environment = new StringBuilder();
@ -62,20 +73,29 @@ namespace Greenshot.Helpers {
environment.Append(", "); environment.Append(", ");
} }
environment.Append(String.Format("OS: {0} {1} {2} x{3} modus Version = {4}",OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString )); if (IsWindows) {
if (newline) { environment.Append(String.Format("OS: {0} {1} {2} x{3} modus Version = {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
environment.AppendLine(); if (newline) {
} else { environment.AppendLine();
environment.Append(", "); } else {
} environment.Append(", ");
// Get some important information for fixing GDI related Problems }
environment.Append("GDI object count: " + User32.GetGuiResourcesGDICount()); // Get some important information for fixing GDI related Problems
if (newline) { environment.Append("GDI object count: " + User32.GetGuiResourcesGDICount());
environment.AppendLine(); if (newline) {
} else { environment.AppendLine();
environment.Append(", "); } else {
} environment.Append(", ");
environment.Append("User object count: " + User32.GetGuiResourcesUserCount()); }
environment.Append("User object count: " + User32.GetGuiResourcesUserCount());
} else {
environment.Append("OS: " + Environment.OSVersion.Platform.ToString());
if (newline) {
environment.AppendLine();
} else {
environment.Append(", ");
}
}
return environment.ToString(); return environment.ToString();
} }
@ -154,12 +174,11 @@ namespace Greenshot.Helpers {
/// <summary> /// <summary>
/// Gets the edition of the operating system running on this computer. /// Gets the edition of the operating system running on this computer.
/// </summary> /// </summary>
static public string Edition static public string Edition {
{ get {
get if (s_Edition != null) {
{ return s_Edition; //***** RETURN *****//
if (s_Edition != null) }
return s_Edition; //***** RETURN *****//
string edition = String.Empty; string edition = String.Empty;
@ -167,8 +186,7 @@ namespace Greenshot.Helpers {
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX(); OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf( typeof( OSVERSIONINFOEX ) ); osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf( typeof( OSVERSIONINFOEX ) );
if (GetVersionEx( ref osVersionInfo )) if (GetVersionEx( ref osVersionInfo )) {
{
int majorVersion = osVersion.Version.Major; int majorVersion = osVersion.Version.Major;
int minorVersion = osVersion.Version.Minor; int minorVersion = osVersion.Version.Minor;
byte productType = osVersionInfo.wProductType; byte productType = osVersionInfo.wProductType;
@ -625,11 +643,9 @@ namespace Greenshot.Helpers {
/// <summary> /// <summary>
/// Gets the build version number of the operating system running on this computer. /// Gets the build version number of the operating system running on this computer.
/// </summary> /// </summary>
static public int BuildVersion public static int BuildVersion {
{ get {
get return Environment.OSVersion.Version.Build;
{
return Environment.OSVersion.Version.Build;
} }
} }
#endregion BUILD #endregion BUILD