Skip to content

Commit

Permalink
Added .NET 7
Browse files Browse the repository at this point in the history
Fixed this dumb nonsense lduchosal/ipnetwork#280
  • Loading branch information
nefarius committed Nov 17, 2023
1 parent cf87a18 commit 4bddb8f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup .Net SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.x
dotnet-version: 8.x
include-prerelease: false

- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-to-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .Net SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.x
dotnet-version: 8.x
include-prerelease: false

- name: Build
Expand Down
6 changes: 4 additions & 2 deletions src/Nefarius.Utilities.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>NSS-128x128.png</PackageIcon>
Expand Down Expand Up @@ -38,7 +38,9 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="IPNetwork2" Version="2.6.618"/>
<PackageReference Include="IPNetwork2" Version="2.6.618">
<Aliases>IPNetwork2</Aliases>
</PackageReference>
<PackageReference Include="MonoMod.RuntimeDetour" Version="25.0.2"/>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.File.Archive" Version="1.0.3"/>
Expand Down
8 changes: 5 additions & 3 deletions src/Util/NetworkUtil.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Collections.Generic;
extern alias IPNetwork2;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;

using IPNetwork2::System.Net;

namespace Nefarius.Utilities.AspNetCore.Util;

internal static class NetworkUtil
Expand All @@ -15,7 +17,7 @@ public static IEnumerable<IPNetwork> GetNetworks(NetworkInterfaceType type)
n.OperationalStatus ==
OperationalStatus.Up) // get all operational networks of a given type
.Select(n => n.GetIPProperties()) // get the IPs
//.Where(n => n.GatewayAddresses.Any())
//.Where(n => n.GatewayAddresses.Any())
select item.UnicastAddresses.FirstOrDefault(i =>
i.Address.AddressFamily == AddressFamily.InterNetwork)
into ipInfo
Expand Down
6 changes: 4 additions & 2 deletions src/WebApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
extern alias IPNetwork2;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.IO.Compression;
Expand All @@ -19,7 +20,8 @@
using Serilog.Sinks.File.Archive;
using Serilog.Sinks.SystemConsole.Themes;

using IPNetwork = System.Net.IPNetwork;
using IPNetwork = IPNetwork2::System.Net.IPNetwork;


namespace Nefarius.Utilities.AspNetCore;

Expand Down

0 comments on commit 4bddb8f

Please sign in to comment.