Skip to content

Commit

Permalink
added netcore5 to release targets and merged a netcore5 winform sampl…
Browse files Browse the repository at this point in the history
…e from @ammarheidari
  • Loading branch information
falahati committed Jan 10, 2022
1 parent b709361 commit 814cbf2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions WindowsFirewallHelper.Net5Sample/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private static void NodeDiscovery(TreeNode node)

node.Nodes.Clear();

if (o is ICollection<FirewallWASRule> || o is ICollection<IFirewallRule>)
if (o is ICollection<FirewallWASRule> or ICollection<IFirewallRule>)
{
foreach (var item in ((IEnumerable) o).Cast<IFirewallRule>().OrderBy(rule => rule.FriendlyName))
{
Expand All @@ -48,7 +48,7 @@ private static void NodeDiscovery(TreeNode node)
if (propertyInfo.PropertyType.GetInterfaces().Contains(typeof(IEnumerable)) &&
propertyInfo.PropertyType != typeof(string))
{
if (!propertyInfo.GetGetMethod().IsStatic)
if (propertyInfo.GetGetMethod()?.IsStatic == false)
{
var value = propertyInfo.GetValue(o, null);
node.Nodes.Add(new TreeNode("[" + propertyInfo.Name + "] ") {Tag = value});
Expand Down Expand Up @@ -76,7 +76,7 @@ private void AddApplicationRule(object sender, EventArgs e)

var newAppRule = FirewallManager.Instance.CreateApplicationRule(
profileType.Value,
"!!TETS!! " + Guid.NewGuid().ToString("B"),
"!!TEST!! " + Guid.NewGuid().ToString("B"),
FirewallAction.Allow,
ofd_app.FileName
);
Expand Down
2 changes: 1 addition & 1 deletion WindowsFirewallHelper.Sample/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void AddApplicationRule(object sender, EventArgs e)

var newAppRule = FirewallManager.Instance.CreateApplicationRule(
profileType.Value,
"!!TETS!! " + Guid.NewGuid().ToString("B"),
"!!TEST!! " + Guid.NewGuid().ToString("B"),
FirewallAction.Allow,
ofd_app.FileName
);
Expand Down
11 changes: 4 additions & 7 deletions WindowsFirewallHelper/WindowsFirewallHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2;net4;net5.0</TargetFrameworks>
<PackageId>WindowsFirewallHelper</PackageId>
<Version>2.1.4.81</Version>
<Version>2.2.0.86</Version>
<Authors>Soroush Falahati</Authors>
<Description>A class library to manage the Windows Firewall as well as adding your program to the Windows Firewall Exception list. Supporting Windows XP+.</Description>
<PackageLicenseUrl>https://github.com/falahati/WindowsFirewallHelper/blob/master/LICENSE</PackageLicenseUrl>
Expand All @@ -21,7 +21,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<Reference Condition="'$(TargetFramework)'=='net4'" Include="System.ServiceProcess"></Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Icon.png">
Expand All @@ -33,12 +32,10 @@
<PackagePath>\</PackagePath>
</Content>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2'">
<PackageReference Include="System.ServiceProcess.ServiceController">
<Version>5.0.0</Version>
</PackageReference>
<ItemGroup Condition="'$(TargetFramework)' == 'net4'">
<Reference Include="System.ServiceProcess"></Reference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<ItemGroup Condition="'$(TargetFramework)' != 'net4'">
<PackageReference Include="System.ServiceProcess.ServiceController">
<Version>5.0.0</Version>
</PackageReference>
Expand Down

0 comments on commit 814cbf2

Please sign in to comment.