[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);
}
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)
{
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)
{
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.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 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 (HttpContent content = response.Content)
{
Stream stream = content.ReadAsStreamAsync().Result;
using (var fileStream = File.Create(pathIconPng))
{
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
}
using HttpContent content = response.Content;
Stream stream = content.ReadAsStreamAsync().Result;
using var fileStream = File.Create(pathIconPng);
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
string pathIcon = Path.Combine(pathToStoreIcons, $"{hostname}.ico");

View File

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

View File

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

View File

@ -749,16 +749,16 @@ namespace SystemTrayMenu.UserInterface
.Replace("*", " ");
// Replace special characters
string tmp = new string(searchString);
string tmp = new(searchString);
searchString = string.Empty;
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;

View File

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

View File

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