[Feature] Fix warnings (#313), version 1.2.3.8

This commit is contained in:
Markus Hofknecht 2022-02-05 12:47:27 +01:00
parent 4c927a4225
commit 23848e8014
9 changed files with 48 additions and 27 deletions

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
[*.cs]
# WFAC010: Unsupported high DPI configuration
dotnet_diagnostic.WFAC010.severity = silent

View file

@ -859,6 +859,12 @@ namespace SystemTrayMenu.Business
Log.ProcessStart(path); Log.ProcessStart(path);
} }
private static int GetRowUnderCursor(DataGridView dgv, Point location)
{
DataGridView.HitTestInfo myHitTest = dgv.HitTest(location.X, location.Y);
return myHitTest.RowIndex;
}
private Menu Create(MenuData menuData, string title = null) private Menu Create(MenuData menuData, string title = null)
{ {
Menu menu = new(); Menu menu = new();
@ -1106,12 +1112,6 @@ namespace SystemTrayMenu.Business
} }
} }
private int GetRowUnderCursor(DataGridView dgv, Point location)
{
DataGridView.HitTestInfo myHitTest = dgv.HitTest(location.X, location.Y);
return myHitTest.RowIndex;
}
private void Dgv_MouseUp(object sender, MouseEventArgs e) private void Dgv_MouseUp(object sender, MouseEventArgs e)
{ {
lastMouseDownRowIndex = -1; lastMouseDownRowIndex = -1;

View file

@ -13,4 +13,4 @@ using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1000:Keywords should be spaced correctly", Justification = "new() should not be replaced by new() ")] [assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1000:Keywords should be spaced correctly", Justification = "new() should not be replaced by new() ")]
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Standard codecleanup removes the this")] [assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Standard codecleanup removes the this")]
[assembly: SuppressMessage("Interoperability", "CA1416:Check platform compatibility", Justification = "<todo>")] [assembly: SuppressMessage("Interoperability", "CA1416:Check platform compatibility", Justification = "this is a long way to get platform compatibility")]

View file

@ -74,18 +74,14 @@ namespace SystemTrayMenu.Helper
string pathIconPng = Path.Combine(pathToStoreIcons, $"{hostname}.png"); string pathIconPng = Path.Combine(pathToStoreIcons, $"{hostname}.png");
string urlGoogleIconDownload = @"http://www.google.com/s2/favicons?sz=32&domain=" + url; string urlGoogleIconDownload = @"http://www.google.com/s2/favicons?sz=32&domain=" + url;
HttpClient client = new HttpClient(); HttpClient client = new();
using (HttpResponseMessage response = client.GetAsync(urlGoogleIconDownload).Result) using (HttpResponseMessage response = client.GetAsync(urlGoogleIconDownload).Result)
{ {
using (HttpContent content = response.Content) using HttpContent content = response.Content;
{ Stream stream = content.ReadAsStreamAsync().Result;
Stream stream = content.ReadAsStreamAsync().Result; using var fileStream = File.Create(pathIconPng);
using (var fileStream = File.Create(pathIconPng)) stream.Seek(0, SeekOrigin.Begin);
{ stream.CopyTo(fileStream);
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
}
} }
string pathIcon = Path.Combine(pathToStoreIcons, $"{hostname}.ico"); string pathIcon = Path.Combine(pathToStoreIcons, $"{hostname}.ico");

View file

@ -33,14 +33,17 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<OutputPath>bin\x64\Debug\</OutputPath> <OutputPath>bin\x64\Debug\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>bin\AnyCPU\Debug\</OutputPath> <OutputPath>bin\AnyCPU\Debug\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<OutputPath>bin\x86\Debug\</OutputPath> <OutputPath>bin\x86\Debug\</OutputPath>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
@ -70,31 +73,37 @@
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePackage|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePackage|x64'">
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePackage|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePackage|AnyCPU'">
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePackage|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleasePackage|x86'">
<ErrorReport>none</ErrorReport> <ErrorReport>none</ErrorReport>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<NoWarn>1701;1702;WFAC010</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Clearcove.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Clearcove.Logging, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -307,7 +316,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Svg" Version="3.3.0" /> <PackageReference Include="Svg" Version="3.4.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Packaging\AppPackages\" /> <Folder Include="Packaging\AppPackages\" />
@ -320,6 +329,10 @@
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
<None Update="README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>taskkill /fi "pid gt 0" /im SystemTrayMenu.exe <PreBuildEvent>taskkill /fi "pid gt 0" /im SystemTrayMenu.exe
@ -331,7 +344,10 @@ EXIT 0</PreBuildEvent>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<RepositoryType></RepositoryType> <RepositoryType></RepositoryType>
<PackageTags>SystemTrayMenu</PackageTags> <PackageTags>SystemTrayMenu</PackageTags>
<ApplicationManifest>Resources\app.manifest</ApplicationManifest>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<ApplicationManifest>Resources\app.manifest</ApplicationManifest>
<PackageReadmeFile>README.md</PackageReadmeFile>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -17,6 +17,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SystemTrayMenuDocuments", "
EndProject EndProject
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Packaging", "Packaging\Packaging.wapproj", "{01D77F37-786A-4DC4-A1AD-BC1EEC54EAE3}" Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "Packaging", "Packaging\Packaging.wapproj", "{01D77F37-786A-4DC4-A1AD-BC1EEC54EAE3}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D34D9392-6592-4F44-B8D4-1781502FE7E6}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU

View file

@ -749,16 +749,16 @@ namespace SystemTrayMenu.UserInterface
.Replace("*", " "); .Replace("*", " ");
// Replace special characters // Replace special characters
string tmp = new string(searchString); string tmp = new(searchString);
searchString = string.Empty; searchString = string.Empty;
foreach (char ch in tmp) foreach (char ch in tmp)
{ {
switch(ch) searchString += ch switch
{ {
case '[': searchString += "[[]"; break; '[' => "[[]",
case ']': searchString += "[]]"; break; ']' => "[]]",
default: searchString += ch; break; _ => ch,
} };
} }
string like = string.Empty; string like = string.Empty;

View file

@ -24,7 +24,7 @@ namespace SystemTrayMenu.Utilities
internal static void Initialize() internal static void Initialize()
{ {
string fileNamePath = GetLogFilePath(); string fileNamePath = GetLogFilePath();
FileInfo fileInfo = new FileInfo(fileNamePath); FileInfo fileInfo = new(fileNamePath);
if (fileInfo.Length > 2000000) if (fileInfo.Length > 2000000)
{ {
string fileNamePathLast = GetLogFilePath(LogfileLastExtension); string fileNamePathLast = GetLogFilePath(LogfileLastExtension);

View file

@ -32,7 +32,7 @@ namespace SystemTrayMenu.Utilities
try try
{ {
List<VirtualKeyCode> virtualKeyCodesModifiers = new List<VirtualKeyCode>(); List<VirtualKeyCode> virtualKeyCodesModifiers = new();
foreach (string key in modifiers.ToString().ToUpperInvariant().Split(", ")) foreach (string key in modifiers.ToString().ToUpperInvariant().Split(", "))
{ {
if (key == "NONE") if (key == "NONE")