Skip to content

Commit b3c6385

Browse files
committed
.NET 4.8 & 6.0. Nullable reference types.
1 parent e7000e3 commit b3c6385

15 files changed

Lines changed: 162 additions & 138 deletions

src/Diff.Net.ruleset

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<RuleSet Name="New Rule Set" Description=" " ToolsVersion="16.0">
2+
<RuleSet Name="New Rule Set" Description=" " ToolsVersion="17.0">
33
<Rules AnalyzerId="CodeCracker.CSharp" RuleNamespace="CodeCracker.CSharp">
44
<Rule Id="CC0001" Action="None" />
55
<Rule Id="CC0014" Action="None" />
@@ -17,6 +17,9 @@
1717
<Rule Id="MEN007" Action="Warning" />
1818
<Rule Id="MEN010" Action="Warning" />
1919
</Rules>
20+
<Rules AnalyzerId="Microsoft.CodeAnalysis.NetAnalyzers" RuleNamespace="Microsoft.CodeAnalysis.NetAnalyzers">
21+
<Rule Id="CA1031" Action="Warning" />
22+
</Rules>
2023
<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
2124
<Rule Id="CA1062" Action="None" />
2225
</Rules>

src/Diff.Net/CommandLineProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ internal static class CommandLineProcessor
3434
private static string[] GetNames()
3535
{
3636
// Note: This method is called from a static initializer, so it shouldn't depend on other static fields.
37-
List<string> result = new List<string>(2);
37+
List<string> result = new(2);
3838

39-
CommandLine cmdLine = new CommandLine(false);
39+
CommandLine cmdLine = new(false);
4040
cmdLine.AddSwitch("f", string.Empty, (value, errors) => ProcessFileOption(value), CommandLineSwitchOptions.AllowMultiple);
4141
cmdLine.AddSwitch("d", string.Empty, (value, errors) => ProcessDirOption(value), CommandLineSwitchOptions.AllowMultiple);
4242
cmdLine.AddValueHandler((value, errors) => result.Add(TextUtility.StripQuotes(value)));

src/Diff.Net/Diff.Net.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net45</TargetFrameworks>
54
<OutputType>WinExe</OutputType>
65
<UseWindowsForms>true</UseWindowsForms>
76
<ApplicationIcon>Images\DiffDotNet.ico</ApplicationIcon>
87
<ApplicationManifest>app.manifest</ApplicationManifest>
98
</PropertyGroup>
109

1110
<ItemGroup>
12-
<PackageReference Include="Menees.Diffs.Windows.Forms" Version="4.9.10" />
11+
<PackageReference Include="Menees.Diffs.Windows.Forms" Version="5.0.0" />
1312
</ItemGroup>
1413

1514
<ItemGroup>

src/Diff.Net/DirDiffDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private void Edit_TextChanged(object sender, EventArgs e)
153153

154154
private void GetDirectory(TextBox edit, string title)
155155
{
156-
string selectedFolder = WindowsUtility.SelectFolder(this, title, edit.Text);
156+
string? selectedFolder = WindowsUtility.SelectFolder(this, title, edit.Text);
157157
if (!string.IsNullOrEmpty(selectedFolder))
158158
{
159159
edit.Text = selectedFolder;

src/Diff.Net/DirDiffForm.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal sealed partial class DirDiffForm : ExtendedForm, IDifferenceForm
1717
{
1818
#region Private Data Members
1919

20-
private ShowDiffArgs lastDiffArgs;
20+
private ShowDiffArgs? lastDiffArgs;
2121

2222
#endregion
2323

@@ -32,11 +32,11 @@ public DirDiffForm()
3232

3333
#region Public Properties
3434

35-
public string ToolTipText
35+
public string? ToolTipText
3636
{
3737
get
3838
{
39-
string result = null;
39+
string? result = null;
4040

4141
if (this.lastDiffArgs != null)
4242
{
@@ -53,7 +53,7 @@ public string ToolTipText
5353

5454
public void ShowDifferences(ShowDiffArgs e)
5555
{
56-
DirectoryDiff diff = new DirectoryDiff(
56+
DirectoryDiff diff = new(
5757
Options.ShowOnlyInA,
5858
Options.ShowOnlyInB,
5959
Options.ShowDifferent,
@@ -88,7 +88,7 @@ private void DiffCtrl_RecompareNeeded(object sender, EventArgs e)
8888
{
8989
if (this.lastDiffArgs != null)
9090
{
91-
using (WaitCursor wc = new WaitCursor(this))
91+
using (WaitCursor wc = new(this))
9292
{
9393
this.ShowDifferences(this.lastDiffArgs);
9494
}

src/Diff.Net/FileDiffDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private void GetFileName(TextBox edit, string title)
139139
// Try to make sure GetDirectoryName won't blow up.
140140
if (fileName.IndexOfAny(Path.GetInvalidPathChars()) < 0)
141141
{
142-
string directoryName = Path.GetDirectoryName(fileName);
142+
string? directoryName = Path.GetDirectoryName(fileName);
143143
if (!string.IsNullOrEmpty(directoryName))
144144
{
145145
this.OpenDlg.InitialDirectory = directoryName;

0 commit comments

Comments
 (0)