mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Small cleanups [skip ci]
This commit is contained in:
parent
02a06a12b0
commit
98e6be5eb6
171 changed files with 1607 additions and 1769 deletions
|
@ -20,14 +20,12 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Greenshot.IniFile;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using log4net;
|
||||
|
||||
namespace Greenshot.Helpers
|
||||
{
|
||||
|
@ -36,19 +34,18 @@ namespace Greenshot.Helpers
|
|||
/// </summary>
|
||||
public static class EnvironmentInfo
|
||||
{
|
||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(EnvironmentInfo));
|
||||
private static bool? isWindows = null;
|
||||
private static bool? _isWindows;
|
||||
|
||||
public static bool IsWindows
|
||||
{
|
||||
get
|
||||
{
|
||||
if (isWindows.HasValue)
|
||||
if (_isWindows.HasValue)
|
||||
{
|
||||
return isWindows.Value;
|
||||
return _isWindows.Value;
|
||||
}
|
||||
isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Win");
|
||||
return isWindows.Value;
|
||||
_isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Win");
|
||||
return _isWindows.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +98,7 @@ namespace Greenshot.Helpers
|
|||
{
|
||||
environment.Append(", ");
|
||||
}
|
||||
environment.Append(String.Format("OS: {0} {1} {2} (x{3}) {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
|
||||
environment.Append(string.Format("OS: {0} {1} {2} (x{3}) {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
|
||||
if (newline)
|
||||
{
|
||||
environment.AppendLine();
|
||||
|
@ -201,11 +198,6 @@ namespace Greenshot.Helpers
|
|||
exceptionText.AppendLine(EnvironmentToString(true));
|
||||
exceptionText.AppendLine(ExceptionToString(exception));
|
||||
exceptionText.AppendLine("Configuration dump:");
|
||||
using (TextWriter writer = new StringWriter(exceptionText))
|
||||
{
|
||||
// TODO: Create summary of properties
|
||||
//var iniConfig = IniConfig.Current.WriteToStreamAsync();
|
||||
}
|
||||
|
||||
return exceptionText.ToString();
|
||||
}
|
||||
|
@ -215,13 +207,13 @@ namespace Greenshot.Helpers
|
|||
/// Provides detailed information about the host operating system.
|
||||
/// Code is available at: http://www.csharp411.com/determine-windows-version-and-edition-with-c/
|
||||
/// </summary>
|
||||
static public class OSInfo
|
||||
public static class OSInfo
|
||||
{
|
||||
#region BITS
|
||||
/// <summary>
|
||||
/// Determines if the current application is 32 or 64-bit.
|
||||
/// </summary>
|
||||
static public int Bits
|
||||
public static int Bits
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -231,24 +223,26 @@ namespace Greenshot.Helpers
|
|||
#endregion BITS
|
||||
|
||||
#region EDITION
|
||||
static private string s_Edition;
|
||||
private static string _sEdition;
|
||||
/// <summary>
|
||||
/// Gets the edition of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public string Edition
|
||||
public static string Edition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_Edition != null)
|
||||
if (_sEdition != null)
|
||||
{
|
||||
return s_Edition; //***** RETURN *****//
|
||||
return _sEdition; //***** RETURN *****//
|
||||
}
|
||||
|
||||
string edition = String.Empty;
|
||||
string edition = string.Empty;
|
||||
|
||||
OperatingSystem osVersion = Environment.OSVersion;
|
||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
||||
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX
|
||||
{
|
||||
dwOSVersionInfoSize = Marshal.SizeOf(typeof (OSVERSIONINFOEX))
|
||||
};
|
||||
|
||||
if (GetVersionEx(ref osVersionInfo))
|
||||
{
|
||||
|
@ -469,18 +463,18 @@ namespace Greenshot.Helpers
|
|||
#endregion VERSION 6
|
||||
}
|
||||
|
||||
s_Edition = edition;
|
||||
_sEdition = edition;
|
||||
return edition;
|
||||
}
|
||||
}
|
||||
#endregion EDITION
|
||||
|
||||
#region NAME
|
||||
static private string s_Name;
|
||||
private static string s_Name;
|
||||
/// <summary>
|
||||
/// Gets the name of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public string Name
|
||||
public static string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -666,17 +660,17 @@ namespace Greenshot.Helpers
|
|||
private struct OSVERSIONINFOEX
|
||||
{
|
||||
public int dwOSVersionInfoSize;
|
||||
public int dwMajorVersion;
|
||||
public int dwMinorVersion;
|
||||
public int dwBuildNumber;
|
||||
public int dwPlatformId;
|
||||
public readonly int dwMajorVersion;
|
||||
public readonly int dwMinorVersion;
|
||||
public readonly int dwBuildNumber;
|
||||
public readonly int dwPlatformId;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
||||
public string szCSDVersion;
|
||||
public short wServicePackMajor;
|
||||
public short wServicePackMinor;
|
||||
public short wSuiteMask;
|
||||
public byte wProductType;
|
||||
public byte wReserved;
|
||||
public readonly string szCSDVersion;
|
||||
public readonly short wServicePackMajor;
|
||||
public readonly short wServicePackMinor;
|
||||
public readonly short wSuiteMask;
|
||||
public readonly byte wProductType;
|
||||
public readonly byte wReserved;
|
||||
}
|
||||
#endregion OSVERSIONINFOEX
|
||||
|
||||
|
@ -724,13 +718,9 @@ namespace Greenshot.Helpers
|
|||
|
||||
#region VERSIONS
|
||||
private const int VER_NT_WORKSTATION = 1;
|
||||
private const int VER_NT_DOMAIN_CONTROLLER = 2;
|
||||
private const int VER_NT_SERVER = 3;
|
||||
private const int VER_SUITE_SMALLBUSINESS = 1;
|
||||
private const int VER_SUITE_ENTERPRISE = 2;
|
||||
private const int VER_SUITE_TERMINAL = 16;
|
||||
private const int VER_SUITE_DATACENTER = 128;
|
||||
private const int VER_SUITE_SINGLEUSERTS = 256;
|
||||
private const int VER_SUITE_PERSONAL = 512;
|
||||
private const int VER_SUITE_BLADE = 1024;
|
||||
#endregion VERSIONS
|
||||
|
@ -740,11 +730,11 @@ namespace Greenshot.Helpers
|
|||
/// <summary>
|
||||
/// Gets the service pack information of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public string ServicePack
|
||||
public static string ServicePack
|
||||
{
|
||||
get
|
||||
{
|
||||
string servicePack = String.Empty;
|
||||
string servicePack = string.Empty;
|
||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
||||
|
||||
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||||
|
@ -778,7 +768,7 @@ namespace Greenshot.Helpers
|
|||
/// <summary>
|
||||
/// Gets the full version string of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public string VersionString
|
||||
public static string VersionString
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -791,7 +781,7 @@ namespace Greenshot.Helpers
|
|||
/// <summary>
|
||||
/// Gets the full version of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public Version Version
|
||||
public static Version Version
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -805,7 +795,7 @@ namespace Greenshot.Helpers
|
|||
/// <summary>
|
||||
/// Gets the major version number of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public int MajorVersion
|
||||
public static int MajorVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -818,7 +808,7 @@ namespace Greenshot.Helpers
|
|||
/// <summary>
|
||||
/// Gets the minor version number of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public int MinorVersion
|
||||
public static int MinorVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -831,7 +821,7 @@ namespace Greenshot.Helpers
|
|||
/// <summary>
|
||||
/// Gets the revision version number of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public int RevisionVersion
|
||||
public static int RevisionVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue