Skip to content

Commit 005716b

Browse files
committed
Merge with netcore31 - notifier not compiling because of contextmenu (wip)
1 parent 69a65d4 commit 005716b

11 files changed

+164
-802
lines changed

.editorconfig

-13
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,3 @@ root = true
55
[*.{cs,xaml}]
66
indent_style = space
77
indent_size = 4
8-
[*.cs]
9-
10-
# CA1305: Specify IFormatProvider
11-
dotnet_diagnostic.CA1305.severity = silent
12-
13-
# CA1819: Properties should not return arrays
14-
dotnet_diagnostic.CA1819.severity = silent
15-
16-
# CA1034: Nested types should not be visible
17-
dotnet_diagnostic.CA1034.severity = silent
18-
19-
# CA1031: Do not catch general exception types
20-
dotnet_diagnostic.CA1031.severity = none

Common/Common.csproj

+33-195
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,22 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.3\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.3\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" />
4-
<Import Project="..\packages\Microsoft.NetFramework.Analyzers.2.9.3\build\Microsoft.NetFramework.Analyzers.props" Condition="Exists('..\packages\Microsoft.NetFramework.Analyzers.2.9.3\build\Microsoft.NetFramework.Analyzers.props')" />
5-
<Import Project="..\packages\Microsoft.NetCore.Analyzers.2.9.3\build\Microsoft.NetCore.Analyzers.props" Condition="Exists('..\packages\Microsoft.NetCore.Analyzers.2.9.3\build\Microsoft.NetCore.Analyzers.props')" />
6-
<Import Project="..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\build\Microsoft.CodeQuality.Analyzers.props" Condition="Exists('..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\build\Microsoft.CodeQuality.Analyzers.props')" />
7-
<Import Project="..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.3\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.3\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props')" />
8-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
92
<PropertyGroup>
10-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
11-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
12-
<ProjectGuid>{94028C5E-9B0E-4D15-966A-9FA766A20821}</ProjectGuid>
13-
<OutputType>Library</OutputType>
14-
<AppDesignerFolder>Properties</AppDesignerFolder>
15-
<RootNamespace>Wokhan.WindowsFirewallNotifier.Common</RootNamespace>
3+
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<UseWPF>true</UseWPF>
165
<AssemblyName>Wokhan.WindowsFirewallNotifier.Common</AssemblyName>
17-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
18-
<FileAlignment>512</FileAlignment>
19-
<SccProjectName>SAK</SccProjectName>
20-
<SccLocalPath>SAK</SccLocalPath>
21-
<SccAuxPath>SAK</SccAuxPath>
22-
<SccProvider>SAK</SccProvider>
23-
<TargetFrameworkProfile>
24-
</TargetFrameworkProfile>
25-
<NuGetPackageImportStamp>
26-
</NuGetPackageImportStamp>
27-
</PropertyGroup>
28-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
29-
<DebugSymbols>true</DebugSymbols>
30-
<DebugType>full</DebugType>
31-
<OutputPath>..\bin\Debug\</OutputPath>
32-
<DefineConstants>DEBUG;TRACE</DefineConstants>
33-
<ErrorReport>prompt</ErrorReport>
34-
<WarningLevel>4</WarningLevel>
35-
<Prefer32Bit>false</Prefer32Bit>
36-
<PlatformTarget>AnyCPU</PlatformTarget>
37-
</PropertyGroup>
38-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
39-
<DebugType>pdbonly</DebugType>
40-
<Optimize>true</Optimize>
41-
<OutputPath>..\bin\Release\</OutputPath>
42-
<DefineConstants>
43-
</DefineConstants>
44-
<ErrorReport>prompt</ErrorReport>
45-
<WarningLevel>4</WarningLevel>
46-
<Prefer32Bit>false</Prefer32Bit>
47-
</PropertyGroup>
48-
<PropertyGroup>
49-
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
50-
</PropertyGroup>
51-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
52-
<DebugSymbols>true</DebugSymbols>
53-
<OutputPath>..\bin\x86\Debug\</OutputPath>
54-
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
55-
<DebugType>full</DebugType>
56-
<PlatformTarget>x86</PlatformTarget>
57-
<ErrorReport>prompt</ErrorReport>
58-
</PropertyGroup>
59-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
60-
<OutputPath>..\bin\x86\Release\</OutputPath>
61-
<DefineConstants>
62-
</DefineConstants>
63-
<Optimize>true</Optimize>
64-
<DebugType>pdbonly</DebugType>
65-
<PlatformTarget>x86</PlatformTarget>
66-
<ErrorReport>prompt</ErrorReport>
67-
</PropertyGroup>
68-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
69-
<DebugSymbols>true</DebugSymbols>
70-
<OutputPath>..\bin\x64\Debug\</OutputPath>
71-
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
72-
<DebugType>full</DebugType>
73-
<PlatformTarget>x64</PlatformTarget>
74-
<ErrorReport>prompt</ErrorReport>
75-
</PropertyGroup>
76-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
77-
<OutputPath>..\bin\x64\Release\</OutputPath>
78-
<DefineConstants>
79-
</DefineConstants>
80-
<Optimize>true</Optimize>
81-
<DebugType>pdbonly</DebugType>
82-
<PlatformTarget>x64</PlatformTarget>
83-
<ErrorReport>prompt</ErrorReport>
6+
<RootNamespace>Wokhan.WindowsFirewallNotifier.Common</RootNamespace>
7+
<ApplicationRevision>0</ApplicationRevision>
8+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
9+
<Description>Windows Firewall Notifier - Common Library</Description>
10+
<Product>Windows Firewall Notifier</Product>
11+
<Copyright>2011-2020 Wokhan (https://github.com/wokhansoft/WFN)</Copyright>
12+
<Authors>Wokhan Solutions</Authors>
13+
<OutputPath>..\bin\$(ConfigurationName)</OutputPath>
8414
</PropertyGroup>
8515
<ItemGroup>
86-
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
87-
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
88-
</Reference>
89-
<Reference Include="PresentationCore" />
90-
<Reference Include="PresentationFramework" />
91-
<Reference Include="System" />
92-
<Reference Include="System.Configuration" />
93-
<Reference Include="System.Core" />
94-
<Reference Include="System.Drawing" />
95-
<Reference Include="System.Management" />
96-
<Reference Include="System.ServiceProcess" />
97-
<Reference Include="System.Xml.Linq" />
98-
<Reference Include="System.Data.DataSetExtensions" />
99-
<Reference Include="Microsoft.CSharp" />
100-
<Reference Include="System.Data" />
101-
<Reference Include="System.Xml" />
102-
<Reference Include="WindowsBase" />
16+
<Compile Remove="Properties\AssemblyInfo.cs" />
10317
</ItemGroup>
10418
<ItemGroup>
105-
<Compile Include="Extensions\EnumExtensions.cs" />
106-
<Compile Include="Extensions\ProcessExtensions.cs" />
107-
<Compile Include="Extensions\StreamExtensions.cs" />
108-
<Compile Include="Helpers\DnsResolver.cs" />
109-
<Compile Include="Helpers\NetshHelper.cs" />
110-
<Compile Include="Helpers\CommonHelper.cs" />
111-
<Compile Include="Helpers\CustomSettingsProvider.cs" />
112-
<Compile Include="Helpers\FileHelper.cs" />
113-
<Compile Include="Helpers\FirewallHelper.cs" />
114-
<Compile Include="Helpers\IconHelper.cs" />
115-
<Compile Include="Helpers\Impersonation.cs" />
116-
<Compile Include="Helpers\IPHelpers\TCP6Helper.cs" />
117-
<Compile Include="Helpers\IPHelpers\TCPHelper.cs" />
118-
<Compile Include="Helpers\IPHelpers\UDP6Helper.cs" />
119-
<Compile Include="Helpers\IPHelpers\UDPHelper.cs" />
120-
<Compile Include="Helpers\IPHelpers\IPHelper.cs" />
121-
<Compile Include="Helpers\LogHelper.cs" />
122-
<Compile Include="Helpers\ProcessHelper.cs" />
123-
<Compile Include="Helpers\UACHelper.cs" />
124-
<Compile Include="Helpers\WindowHelper.cs" />
125-
<Compile Include="Properties\Annotations.cs" />
126-
<Compile Include="Properties\AssemblyInfo.cs" />
127-
<Compile Include="Properties\Resources.Designer.cs">
128-
<DependentUpon>Resources.resx</DependentUpon>
129-
<AutoGen>True</AutoGen>
130-
<DesignTime>True</DesignTime>
131-
</Compile>
132-
<Compile Include="Settings.cs" />
133-
<Compile Include="Settings.Designer.cs">
134-
<AutoGen>True</AutoGen>
135-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
136-
<DependentUpon>Settings.settings</DependentUpon>
137-
</Compile>
19+
<None Remove="Resources\Shield.ico" />
13820
</ItemGroup>
13921
<ItemGroup>
14022
<COMReference Include="NetFwTypeLib">
@@ -148,74 +30,30 @@
14830
</COMReference>
14931
</ItemGroup>
15032
<ItemGroup>
151-
<None Include="app.config">
152-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
153-
</None>
154-
<None Include="packages.config" />
155-
<None Include="Settings.settings">
156-
<Generator>PublicSettingsSingleFileGenerator</Generator>
157-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
158-
</None>
33+
<PackageReference Include="log4net" Version="2.0.8" />
34+
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
35+
<PrivateAssets>all</PrivateAssets>
36+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
37+
</PackageReference>
38+
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
39+
<PackageReference Include="System.Management" Version="4.7.0" />
40+
<PackageReference Include="System.ServiceProcess.ServiceController" Version="4.7.0" />
15941
</ItemGroup>
16042
<ItemGroup>
16143
<Resource Include="Resources\Shield.ico" />
16244
</ItemGroup>
163-
<ItemGroup>
164-
<EmbeddedResource Include="Properties\Resources.resx">
165-
<Generator>PublicResXFileCodeGenerator</Generator>
166-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
167-
<SubType>Designer</SubType>
168-
</EmbeddedResource>
169-
</ItemGroup>
170-
<ItemGroup>
171-
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.3\analyzers\dotnet\Microsoft.CodeAnalysis.VersionCheckAnalyzer.dll" />
172-
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\analyzers\dotnet\cs\Humanizer.dll" />
173-
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\analyzers\dotnet\cs\Microsoft.CodeQuality.Analyzers.dll" />
174-
<Analyzer Include="..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\analyzers\dotnet\cs\Microsoft.CodeQuality.CSharp.Analyzers.dll" />
175-
<Analyzer Include="..\packages\Microsoft.NetCore.Analyzers.2.9.3\analyzers\dotnet\cs\Microsoft.NetCore.Analyzers.dll" />
176-
<Analyzer Include="..\packages\Microsoft.NetCore.Analyzers.2.9.3\analyzers\dotnet\cs\Microsoft.NetCore.CSharp.Analyzers.dll" />
177-
<Analyzer Include="..\packages\Microsoft.NetFramework.Analyzers.2.9.3\analyzers\dotnet\cs\Microsoft.NetFramework.Analyzers.dll" />
178-
<Analyzer Include="..\packages\Microsoft.NetFramework.Analyzers.2.9.3\analyzers\dotnet\cs\Microsoft.NetFramework.CSharp.Analyzers.dll" />
179-
</ItemGroup>
180-
<ItemGroup>
181-
<None Include="WFN.config.log4net">
182-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
183-
</None>
184-
</ItemGroup>
185-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
186-
<PropertyGroup>
187-
<PostBuildEvent>del "WFN.config"
188-
ren "$(TargetPath).config" "WFN.config"
189-
del "app.config"
190-
</PostBuildEvent>
191-
</PropertyGroup>
192-
<PropertyGroup>
193-
<PreBuildEvent>
194-
</PreBuildEvent>
195-
</PropertyGroup>
196-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
45+
46+
<!--<ItemGroup>
47+
<Resource Include="Resources\Shield.ico" />
48+
</ItemGroup>-->
49+
19750
<PropertyGroup>
198-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
51+
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
52+
<PostBuildEvent>
53+
del WFN.config
54+
ren "Wokhan.WindowsFirewallNotifier.Common.dll.config" WFN.config
55+
if "$(ConfigurationName)" == "Release" (mkdir "$(TargetDir)..\Published")
56+
if "$(ConfigurationName)" == "Release" (copy "$(TargetPath)" "$(TargetDir)..\Published")
57+
</PostBuildEvent>
19958
</PropertyGroup>
200-
<Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.3\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.VersionCheckAnalyzer.2.9.3\build\Microsoft.CodeAnalysis.VersionCheckAnalyzer.props'))" />
201-
<Error Condition="!Exists('..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\build\Microsoft.CodeQuality.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeQuality.Analyzers.2.9.3\build\Microsoft.CodeQuality.Analyzers.props'))" />
202-
<Error Condition="!Exists('..\packages\Microsoft.NetCore.Analyzers.2.9.3\build\Microsoft.NetCore.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NetCore.Analyzers.2.9.3\build\Microsoft.NetCore.Analyzers.props'))" />
203-
<Error Condition="!Exists('..\packages\Microsoft.NetFramework.Analyzers.2.9.3\build\Microsoft.NetFramework.Analyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NetFramework.Analyzers.2.9.3\build\Microsoft.NetFramework.Analyzers.props'))" />
204-
<Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.3\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.FxCopAnalyzers.2.9.3\build\Microsoft.CodeAnalysis.FxCopAnalyzers.props'))" />
205-
</Target>
206-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
207-
Other similar extension points exist, see Microsoft.Common.targets.
208-
<Target Name="BeforeBuild">
209-
</Target>
210-
<Target Name="AfterBuild">
211-
</Target>
212-
<Target Name="AfterBuild" Condition="'$(ConfigurationName)' == 'Release'">
213-
<EXEC command="mkdir &quot;$(TargetDir)..\Release_Publish&quot;" />
214-
<EXEC command="copy &quot;$(TargetDir)&quot; &quot;$(TargetDir)..\Release_Publish&quot;"/>
215-
</Target>
216-
-->
217-
<Target Name="Clean">
218-
<RemoveDir Directories="$(TargetDir)" />
219-
<!--<RemoveDir Directories="$(TargetDir)..\Release_Publish" /> -->
220-
</Target>
22159
</Project>

Common/Helpers/CustomSettingsProvider.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private static ClientSettingsSection GetApplicationSettingsSection(Configuration
9999
{
100100
try
101101
{
102-
return (ClientSettingsSection)cfg.GetSectionGroup(applicationSectionName).Sections[SectionName];
102+
return (ClientSettingsSection)cfg.GetSectionGroup(applicationSectionName)?.Sections[SectionName];
103103
}
104104
catch (ConfigurationErrorsException e)
105105
{
@@ -116,7 +116,7 @@ private static ClientSettingsSection GetUserSettingsSection(Configuration cfg)
116116
{
117117
try
118118
{
119-
return (ClientSettingsSection)cfg.GetSectionGroup(userSectionName).Sections[SectionName];
119+
return (ClientSettingsSection)cfg.GetSectionGroup(userSectionName)?.Sections[SectionName];
120120
}
121121
catch (ConfigurationErrorsException e)
122122
{

Common/packages.config

-9
This file was deleted.

0 commit comments

Comments
 (0)