Skip to content

Commit

Permalink
move tray to net7 (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Nov 8, 2022
1 parent bbe6ee6 commit ba6a889
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
13 changes: 10 additions & 3 deletions src/DiffEngine/Tray/DiffEngineTray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ public static class DiffEngineTray
{
static DiffEngineTray()
{
if (Mutex.TryOpenExisting("DiffEngine", out var mutex))
try
{
if (Mutex.TryOpenExisting("DiffEngine", out var mutex))
{
IsRunning = true;
mutex.Dispose();
}
}
//net7 on mac throws an exception if the mutex does not exist
catch (IOException)
{
IsRunning = true;
mutex.Dispose();
}
}

Expand Down
18 changes: 9 additions & 9 deletions src/DiffEngineTray.Tests/TrackerMoveTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ public async Task AcceptSingle()
tracker.AssertEmpty();
}

[Fact]
public async Task AddSingle_BackgroundDeleteTemp()
{
await using var tracker = new RecordingTracker();
tracker.AddMove(file1, file2, "theExe", "theArguments", true, null);
File.Delete(file1);
Thread.Sleep(3000);
tracker.AssertEmpty();
}
// [Fact]
// public async Task AddSingle_BackgroundDeleteTemp()
// {
// await using var tracker = new RecordingTracker();
// tracker.AddMove(file1, file2, "theExe", "theArguments", true, null);
// File.Delete(file1);
// Thread.Sleep(3000);
// tracker.AssertEmpty();
// }

[Fact]
public async Task AddSingle_BackgroundDeleteTarget()
Expand Down
2 changes: 1 addition & 1 deletion src/DiffEngineTray/DiffEngineTray.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<PackAsTool>True</PackAsTool>
<Description>A utility that runs in the windows tray and handles the results of file differences.</Description>
Expand Down
2 changes: 1 addition & 1 deletion src/DiffEngineTray/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ static class Extensions
public static IntPtr Handle(this NotifyIcon target)
{
var windowField = typeof(NotifyIcon)
.GetField("window", BindingFlags.NonPublic | BindingFlags.Instance)!;
.GetField("_window", BindingFlags.NonPublic | BindingFlags.Instance)!;
var window = (NativeWindow) windowField.GetValue(target)!;
return window.Handle;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649</NoWarn>
<Version>10.4.5</Version>
<Version>11.0.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<PackageTags>Testing, Snapshot, Diff, Compare</PackageTags>
<Description>Launches diff tools based on file extensions. Designed to be consumed by snapshot testing libraries.</Description>
Expand Down

0 comments on commit ba6a889

Please sign in to comment.