Skip to content

Commit 42a33ed

Browse files
author
Andrew Mansell
committed
Linting
1 parent 8918a6b commit 42a33ed

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

Rubberduck.Core/Common/WinAPI/SHCore.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
namespace Rubberduck.Common.WinAPI
44
{
5+
/// <summary>
6+
/// Native functions from SHCore.dll
7+
/// </summary>
58
public static class SHCore
69
{
710
/// <summary>
8-
/// Sets the DPI awerness level of the current process.
11+
/// Sets the DPI awareness level of the current process.
912
/// </summary>
1013
/// <param name="awareness">DPI awareness level.</param>
1114
/// <returns>HRESULT of S_OK, E_INVALIDARG or E_ACCESSDENIED.</returns>

Rubberduck.Core/Common/WindowsVersion.cs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Rubberduck.Common
44
{
5-
public struct WindowsVersion : IComparable<WindowsVersion>
5+
public struct WindowsVersion : IComparable<WindowsVersion>, IEquatable<WindowsVersion>
66
{
7-
public static WindowsVersion Windows10 = new WindowsVersion(10, 0, 10240);
8-
public static WindowsVersion Windows81 = new WindowsVersion(6, 3, 9200);
9-
public static WindowsVersion Windows8 = new WindowsVersion(6, 2, 9200);
10-
public static WindowsVersion Windows7_SP1 = new WindowsVersion(6, 1, 7601);
11-
public static WindowsVersion WindowsVista_SP2 = new WindowsVersion(6, 0, 6002);
7+
public static readonly WindowsVersion Windows10 = new WindowsVersion(10, 0, 10240);
8+
public static readonly WindowsVersion Windows81 = new WindowsVersion(6, 3, 9200);
9+
public static readonly WindowsVersion Windows8 = new WindowsVersion(6, 2, 9200);
10+
public static readonly WindowsVersion Windows7_SP1 = new WindowsVersion(6, 1, 7601);
11+
public static readonly WindowsVersion WindowsVista_SP2 = new WindowsVersion(6, 0, 6002);
1212

1313
public WindowsVersion(int major, int minor, int build)
1414
{
@@ -21,6 +21,7 @@ public WindowsVersion(int major, int minor, int build)
2121
public int Minor { get; }
2222
public int Build { get; }
2323

24+
2425
public int CompareTo(WindowsVersion other)
2526
{
2627
var majorComparison = Major.CompareTo(other.Major);
@@ -36,6 +37,27 @@ public int CompareTo(WindowsVersion other)
3637
: Build.CompareTo(other.Build);
3738
}
3839

40+
public bool Equals(WindowsVersion other)
41+
{
42+
return Major == other.Major && Minor == other.Minor && Build == other.Build;
43+
}
44+
45+
public override bool Equals(object other)
46+
{
47+
return other is WindowsVersion otherVersion && Equals(otherVersion);
48+
}
49+
50+
public override int GetHashCode()
51+
{
52+
unchecked
53+
{
54+
var hashCode = Major;
55+
hashCode = (hashCode * 397) ^ Minor;
56+
hashCode = (hashCode * 397) ^ Build;
57+
return hashCode;
58+
}
59+
}
60+
3961
public static bool operator ==(WindowsVersion os1, WindowsVersion os2)
4062
{
4163
return os1.CompareTo(os2) == 0;

0 commit comments

Comments
 (0)