Skip to content

Commit 61c18ad

Browse files
committed
Refactor.
1 parent 31cdd0b commit 61c18ad

File tree

93 files changed

+314
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+314
-248
lines changed

.github/workflows/build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ jobs:
1414

1515
steps:
1616

17-
# Setup
17+
# Set up
1818

1919
- name: Setup msbuild
2020
uses: microsoft/[email protected]
2121

22-
# Checkout
22+
# Check out
2323

24-
- name: Checkout ${{env.PROJECT}}
24+
- name: Check out ${{env.PROJECT}}
2525
uses: actions/[email protected]
2626

2727
# Restore

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.15.29.0</Version>
3+
<Version>1.15.30.0</Version>
44
</PropertyGroup>
55
</Project>

Hourglass.Bundle/Bundle.wxs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
44
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
55
<Bundle Name="Hourglass"
6-
Version="1.15.29.0"
6+
Version="1.15.30.0"
77
Manufacturer="2021 Chris Dziemborowicz, 2024 Ivan Ivon"
88
UpgradeCode="f1d002c9-cfc9-40fb-84af-96e7aec26e0b"
99
IconSourceFile="$(var.Hourglass.ProjectDir)Resources\AppIcon.ico">

Hourglass.Setup/Product.wxs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
33
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
4-
<Product Id="*" Name="Hourglass" Language="1033" Version="1.15.29.0" Manufacturer="Chris Dziemborowicz, Ivan Ivon" UpgradeCode="172d3713-8820-4374-8195-3e2374e7724f">
4+
<Product Id="*" Name="Hourglass" Language="1033" Version="1.15.30.0" Manufacturer="Chris Dziemborowicz, Ivan Ivon" UpgradeCode="172d3713-8820-4374-8195-3e2374e7724f">
55
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"/>
66

77
<Icon Id="AppIcon.exe" SourceFile="$(var.Hourglass.ProjectDir)Resources\AppIcon.ico"/>

Hourglass.Test/Hourglass.Test.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
<DebugType>pdbonly</DebugType>
2424
</PropertyGroup>
2525
<ItemGroup>
26-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
27-
<PackageReference Include="MSTest.TestAdapter" Version="3.2.1" />
28-
<PackageReference Include="MSTest.TestFramework" Version="3.2.1" />
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
27+
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
28+
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
2929
</ItemGroup>
3030
<ItemGroup>
3131
<ProjectReference Include="..\Hourglass\Hourglass.csproj" />

Hourglass/CommandLineArguments.cs

+9-18
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,7 @@ private static CommandLineArguments GetCommandLineArguments(IEnumerable<string>
827827
/// <param name="arg">The name of the argument for which the value is to be returned.</param>
828828
/// <param name="remainingArgs">The unparsed arguments.</param>
829829
/// <returns>The next value in <paramref name="remainingArgs"/>.</returns>
830-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument in
831-
/// <paramref name="remainingArgs"/> is a switch.</exception>
830+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument in <paramref name="remainingArgs"/> is a switch.</exception>
832831
private static string GetRequiredValue(string arg, Queue<string> remainingArgs)
833832
{
834833
string? value = GetValue(remainingArgs);
@@ -853,8 +852,7 @@ private static string GetRequiredValue(string arg, Queue<string> remainingArgs)
853852
/// <param name="arg">The name of the argument for which the value is to be returned.</param>
854853
/// <param name="remainingArgs">The unparsed arguments.</param>
855854
/// <returns>The next <see cref="bool"/> value in <paramref name="remainingArgs"/>.</returns>
856-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not
857-
/// "on" or "off".</exception>
855+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not "on" or "off".</exception>
858856
private static bool GetBoolValue(string arg, Queue<string> remainingArgs)
859857
{
860858
string value = GetRequiredValue(arg, remainingArgs);
@@ -886,8 +884,7 @@ private static bool GetBoolValue(string arg, Queue<string> remainingArgs)
886884
/// <param name="remainingArgs">The unparsed arguments.</param>
887885
/// <param name="last">The value of the argument returned when the user specifies "last".</param>
888886
/// <returns>The next <see cref="bool"/> value in <paramref name="remainingArgs"/>.</returns>
889-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not
890-
/// "on", "off", or "last".</exception>
887+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not "on", "off", or "last".</exception>
891888
private static bool GetBoolValue(string arg, Queue<string> remainingArgs, bool last)
892889
{
893890
string value = GetRequiredValue(arg, remainingArgs);
@@ -923,8 +920,7 @@ private static bool GetBoolValue(string arg, Queue<string> remainingArgs, bool l
923920
/// <param name="remainingArgs">The unparsed arguments.</param>
924921
/// <param name="last">The value of the argument returned when the user specifies "last".</param>
925922
/// <returns>The next <see cref="Theme"/> value in <paramref name="remainingArgs"/></returns>
926-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not
927-
/// "last" or a valid representation of a <see cref="Theme"/>.</exception>
923+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not "last" or a valid representation of a <see cref="Theme"/>.</exception>
928924
private static Theme? GetThemeValue(string arg, Queue<string> remainingArgs, Theme? last)
929925
{
930926
string value = GetRequiredValue(arg, remainingArgs);
@@ -962,8 +958,7 @@ private static bool GetBoolValue(string arg, Queue<string> remainingArgs, bool l
962958
/// <param name="remainingArgs">The unparsed arguments.</param>
963959
/// <param name="last">The value of the argument returned when the user specifies "last".</param>
964960
/// <returns>The next <see cref="Sound"/> value in <paramref name="remainingArgs"/>.</returns>
965-
/// <exception cref="ParseException">if <paramref name="remainingArgs"/> is empty or the next argument is not
966-
/// "none", "last", or a valid representation of a <see cref="Sound"/>.</exception>
961+
/// <exception cref="ParseException">if <paramref name="remainingArgs"/> is empty or the next argument is not "none", "last", or a valid representation of a <see cref="Sound"/>.</exception>
967962
private static Sound? GetSoundValue(string arg, Queue<string> remainingArgs, Sound? last)
968963
{
969964
string value = GetRequiredValue(arg, remainingArgs);
@@ -1003,8 +998,7 @@ private static bool GetBoolValue(string arg, Queue<string> remainingArgs, bool l
1003998
/// <param name="remainingArgs">The unparsed arguments.</param>
1004999
/// <param name="last">The value of the argument returned when the user specifies "last".</param>
10051000
/// <returns>The next <see cref="WindowTitleMode"/> value in <paramref name="remainingArgs"/>.</returns>
1006-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not
1007-
/// "app", "left", "elapsed", "title", or "last".</exception>
1001+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not "app", "left", "elapsed", "title", or "last".</exception>
10081002
private static WindowTitleMode GetWindowTitleModeValue(string arg, Queue<string> remainingArgs, WindowTitleMode last)
10091003
{
10101004
string value = GetRequiredValue(arg, remainingArgs);
@@ -1061,8 +1055,7 @@ private static WindowTitleMode GetWindowTitleModeValue(string arg, Queue<string>
10611055
/// <param name="remainingArgs">The unparsed arguments.</param>
10621056
/// <param name="last">The value of the argument returned when the user specifies "last".</param>
10631057
/// <returns>The next <see cref="WindowState"/> value in <paramref name="remainingArgs"/>.</returns>
1064-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not
1065-
/// "normal", "maximized", "minimized", or "last".</exception>
1058+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not "normal", "maximized", "minimized", or "last".</exception>
10661059
private static WindowState GetWindowStateValue(string arg, Queue<string> remainingArgs, WindowState last)
10671060
{
10681061
string value = GetRequiredValue(arg, remainingArgs);
@@ -1101,8 +1094,7 @@ private static WindowState GetWindowStateValue(string arg, Queue<string> remaini
11011094
/// <param name="remainingArgs">The unparsed arguments.</param>
11021095
/// <param name="last">The value of the argument returned when the user specifies "last".</param>
11031096
/// <returns>The next <see cref="Rect"/> value in <paramref name="remainingArgs"/>.</returns>
1104-
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not a
1105-
/// valid representation of a <see cref="Rect"/>.</exception>
1097+
/// <exception cref="ParseException">If <paramref name="remainingArgs"/> is empty or the next argument is not a valid representation of a <see cref="Rect"/>.</exception>
11061098
private static Rect GetRectValue(string arg, Queue<string> remainingArgs, Rect last)
11071099
{
11081100
string value = GetRequiredValue(arg, remainingArgs);
@@ -1140,8 +1132,7 @@ private static Rect GetRectValue(string arg, Queue<string> remainingArgs, Rect l
11401132
/// The <see cref="TimerStart"/> value corresponding to the concatenation of all <paramref name="remainingArgs"/>
11411133
/// or individual timer values if <paramref name="multiTimers"/> if <c>true</c>.
11421134
/// </returns>
1143-
/// <exception cref="ParseException">If the concatenation of all <paramref name="remainingArgs"/> is not a
1144-
/// valid representation of a <see cref="TimerStart"/>.</exception>
1135+
/// <exception cref="ParseException">If the concatenation of all <paramref name="remainingArgs"/> is not a valid representation of a <see cref="TimerStart"/>.</exception>
11451136
private static IEnumerable<TimerStart> GetTimerStartValue(IEnumerable<string> remainingArgs, bool multiTimers)
11461137
{
11471138
if (!multiTimers)

Hourglass/Extensions/ColorExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public static int ToInt(this Color color)
3131
/// </summary>
3232
/// <param name="colorString">A <see cref="string"/> representation of a <see cref="Color"/>.</param>
3333
/// <returns>A <see cref="Color"/>.</returns>
34+
/// <exception cref="ArgumentNullException"><paramref name="colorString"/> is <see langword="null"/></exception>
3435
public static Color FromString(string colorString)
3536
{
3637
if (string.IsNullOrWhiteSpace(colorString))

Hourglass/Extensions/CultureInfoExtensions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ namespace Hourglass.Extensions;
1010
using System.Globalization;
1111
using System.Text.RegularExpressions;
1212

13+
// ReSharper disable ExceptionNotDocumented
14+
1315
/// <summary>
1416
/// Provides extensions methods for the <see cref="CultureInfo"/> class and the related <see
1517
/// cref="IFormatProvider"/> interface.

Hourglass/Extensions/DateTimeExtensions.cs

+13-11
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public static DateTime AddYears(this DateTime dateTime, double years)
8383
/// <param name="month">A month number between 1 and 12 inclusive.</param>
8484
/// <param name="provider">An <see cref="IFormatProvider"/>.</param>
8585
/// <returns>The string representation of the month.</returns>
86+
/// <exception cref="ArgumentOutOfRangeException">If the month is out of range.</exception>
8687
public static string GetMonthString(int month, IFormatProvider provider)
8788
{
8889
IDictionary<int, string> months = GetMonthStrings(provider);
@@ -101,6 +102,7 @@ public static string GetMonthString(int month, IFormatProvider provider)
101102
/// <param name="day">A day number between 1 and 31 inclusive.</param>
102103
/// <param name="provider">An <see cref="IFormatProvider"/>.</param>
103104
/// <returns>The ordinal string representation of the day.</returns>
105+
/// <exception cref="ArgumentOutOfRangeException">If the day is out of range.</exception>
104106
public static string GetOrdinalDayString(int day, IFormatProvider provider)
105107
{
106108
if (day is < 1 or > 31)
@@ -115,34 +117,35 @@ public static string GetOrdinalDayString(int day, IFormatProvider provider)
115117
Resources.ResourceManager.GetString(nameof(Resources.DateTimeExtensionsNstFormatString), provider),
116118
day);
117119
}
118-
else if (day % 10 == 2 && day / 10 != 1)
120+
121+
if (day % 10 == 2 && day / 10 != 1)
119122
{
120123
return string.Format(
121124
Resources.ResourceManager.GetEffectiveProvider(provider),
122125
Resources.ResourceManager.GetString(nameof(Resources.DateTimeExtensionsNndFormatString), provider),
123126
day);
124127
}
125-
else if (day % 10 == 3 && day / 10 != 1)
128+
129+
if (day % 10 == 3 && day / 10 != 1)
126130
{
127131
return string.Format(
128132
Resources.ResourceManager.GetEffectiveProvider(provider),
129133
Resources.ResourceManager.GetString(nameof(Resources.DateTimeExtensionsNrdFormatString), provider),
130134
day);
131135
}
132-
else
133-
{
134-
return string.Format(
135-
Resources.ResourceManager.GetEffectiveProvider(provider),
136-
Resources.ResourceManager.GetString(nameof(Resources.DateTimeExtensionsNthFormatString), provider),
137-
day);
138-
}
136+
137+
return string.Format(
138+
Resources.ResourceManager.GetEffectiveProvider(provider),
139+
Resources.ResourceManager.GetString(nameof(Resources.DateTimeExtensionsNthFormatString), provider),
140+
day);
139141
}
140142

141143
/// <summary>
142144
/// Increments a month by one.
143145
/// </summary>
144146
/// <param name="year">A year.</param>
145147
/// <param name="month">A month number between 1 and 12 inclusive.</param>
148+
/// <exception cref="ArgumentOutOfRangeException">If the month is out of range.</exception>
146149
public static void IncrementMonth(ref int year, ref int month)
147150
{
148151
if (month is < 1 or > 12)
@@ -191,8 +194,7 @@ public static bool IsValid(int? year, int? month, int? day)
191194
/// <param name="str">A string representation of a month.</param>
192195
/// <param name="provider">An <see cref="IFormatProvider"/>.</param>
193196
/// <returns>The month number parsed from the string.</returns>
194-
/// <exception cref="FormatException">If <paramref name="str"/> is not a supported representation of a month.
195-
/// </exception>
197+
/// <exception cref="FormatException">If <paramref name="str"/> is not a supported representation of a month. </exception>
196198
public static int ParseMonth(string str, IFormatProvider provider)
197199
{
198200
IList<KeyValuePair<int, string>> matches = GetMonthStrings(provider)

Hourglass/Extensions/DayOfWeekExtensions.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public static class DayOfWeekExtensions
2424
/// <param name="str">A string.</param>
2525
/// <param name="provider">An <see cref="IFormatProvider"/>.</param>
2626
/// <returns>The <see cref="DayOfWeek"/> parsed from the string.</returns>
27-
/// <exception cref="FormatException">If <paramref name="str"/> is not a supported representation of a day
28-
/// of the week.</exception>
27+
/// <exception cref="FormatException">If <paramref name="str"/> is not a supported representation of a day of the week.</exception>
2928
public static DayOfWeek ParseDayOfWeek(string str, IFormatProvider provider)
3029
{
3130
IList<KeyValuePair<DayOfWeek, string>> matches = GetDayOfWeekStrings(provider)

Hourglass/Extensions/ResourceManagerExtensions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ namespace Hourglass.Extensions;
1010
using System.Globalization;
1111
using System.Resources;
1212

13+
// ReSharper disable ExceptionNotDocumented
14+
1315
/// <summary>
1416
/// Provides extensions methods for the <see cref="ResourceManager"/> class.
1517
/// </summary>

Hourglass/Extensions/TimerWindowExtensions.cs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Hourglass.Extensions;
1313

14+
// ReSharper disable LocalSuppression
15+
// ReSharper disable ExceptionNotDocumented
16+
1417
public static class TimerWindowExtensions
1518
{
1619
private static readonly Comparer<TimerWindow> TimeComparer = Comparer<TimerWindow>.Create(CompareTime);

Hourglass/Extensions/UriExtensions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
using Hourglass.Properties;
55

6+
// ReSharper disable ExceptionNotDocumented
7+
68
namespace Hourglass.Extensions;
79

810
internal static class UriExtensions

Hourglass/Extensions/WindowExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ public static void OpenContextMenu(this Window window)
602602
return;
603603
}
604604

605-
ContextMenuEventArgs contextMenuEventArgs = (ContextMenuEventArgs)Activator.CreateInstance(
605+
var contextMenuEventArgs = (ContextMenuEventArgs)Activator.CreateInstance(
606606
typeof(ContextMenuEventArgs),
607607
#pragma warning disable S3011
608608
BindingFlags.Instance | BindingFlags.NonPublic,

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialog.WindowSubclassHandler.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
// ReSharper disable all
4+
35
namespace KPreisser.UI;
46

57
public partial class TaskDialog

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialog.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#pragma warning disable S3963
2121
#pragma warning disable S1135
2222

23+
// ReSharper disable all
24+
2325
namespace KPreisser.UI;
2426

2527
/// <summary>
@@ -278,7 +280,6 @@ static TaskDialog()
278280
///
279281
/// </summary>
280282
public TaskDialog()
281-
: base()
282283
{
283284
// TaskDialog is only supported on Windows.
284285
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialogButton.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System;
44
using System.Collections.Generic;
55

6+
// ReSharper disable all
7+
68
namespace KPreisser.UI;
79

810
/// <summary>
@@ -31,7 +33,6 @@ public abstract class TaskDialogButton : TaskDialogControl
3133

3234
// Disallow inheritance by specifying a private protected constructor.
3335
private protected TaskDialogButton()
34-
: base()
3536
{
3637
}
3738

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialogButtonClickedEventArgs.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
// ReSharper disable all
4+
35
namespace KPreisser.UI;
46

57
/// <summary>
@@ -11,7 +13,6 @@ public class TaskDialogButtonClickedEventArgs : EventArgs
1113
///
1214
/// </summary>
1315
internal TaskDialogButtonClickedEventArgs()
14-
: base()
1516
{
1617
}
1718

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialogButtons.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
// ReSharper disable all
4+
35
namespace KPreisser.UI;
46

57
/// <summary>

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialogCheckbox.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
using TaskDialogFlags = KPreisser.UI.TaskDialogNativeMethods.TASKDIALOG_FLAGS;
66

7+
// ReSharper disable all
8+
79
namespace KPreisser.UI;
810

911
/// <summary>
@@ -24,7 +26,6 @@ public sealed class TaskDialogCheckBox : TaskDialogControl
2426
///
2527
/// </summary>
2628
public TaskDialogCheckBox()
27-
: base()
2829
{
2930
}
3031

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialogClosingEventArgs.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System.ComponentModel;
22

3+
// ReSharper disable all
4+
35
namespace KPreisser.UI;
46

57
/// <summary>
@@ -11,7 +13,6 @@ public class TaskDialogClosingEventArgs : CancelEventArgs
1113
///
1214
/// </summary>
1315
internal TaskDialogClosingEventArgs(TaskDialogButton closeButton)
14-
: base()
1516
{
1617
CloseButton = closeButton;
1718
}

Hourglass/Lib/TaskDialog/TaskDialog/TaskDialogControl.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
using TaskDialogFlags = KPreisser.UI.TaskDialogNativeMethods.TASKDIALOG_FLAGS;
66

7+
// ReSharper disable all
8+
79
namespace KPreisser.UI;
810

911
/// <summary>
@@ -13,7 +15,6 @@ public abstract class TaskDialogControl
1315
{
1416
// Disallow inheritance by specifying a private protected constructor.
1517
private protected TaskDialogControl()
16-
: base()
1718
{
1819
}
1920

0 commit comments

Comments
 (0)