mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
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:
parent
be2614649e
commit
ed2650eb75
1 changed files with 44 additions and 28 deletions
|
@ -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,6 +73,7 @@ namespace Greenshot.Helpers {
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsWindows) {
|
||||||
environment.Append(String.Format("OS: {0} {1} {2} x{3} modus Version = {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
|
environment.Append(String.Format("OS: {0} {1} {2} x{3} modus Version = {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
|
||||||
if (newline) {
|
if (newline) {
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
|
@ -76,6 +88,14 @@ namespace Greenshot.Helpers {
|
||||||
environment.Append(", ");
|
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) {
|
||||||
{
|
|
||||||
if (s_Edition != null)
|
|
||||||
return s_Edition; //***** RETURN *****//
|
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,10 +643,8 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue