This commit is contained in:
nsnail 2022-12-14 22:31:05 +08:00
parent 51943833ed
commit 075c8e76b2
42 changed files with 277 additions and 141 deletions

View File

@ -7,6 +7,18 @@ end_of_line = lf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.cs]
dotnet_analyzer_diagnostic.severity = warning
dotnet_diagnostic.IDE0008.severity = none
dotnet_diagnostic.IDE0055.severity = none
dotnet_diagnostic.IDE0160.severity = none
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.IDE0048.severity = none
dotnet_diagnostic.IDE0058.severity = none
dotnet_diagnostic.IDE0017.severity = none
dotnet_diagnostic.CA5350.severity = none
dotnet_diagnostic.CA5351.severity = none
# ReSharper properties # ReSharper properties
resharper_align_linq_query = true resharper_align_linq_query = true
@ -35,6 +47,7 @@ resharper_indent_preprocessor_other = usual_indent
resharper_int_align = true resharper_int_align = true
resharper_keep_existing_arrangement = false resharper_keep_existing_arrangement = false
resharper_place_linq_into_on_new_line = false resharper_place_linq_into_on_new_line = false
resharper_place_simple_embedded_statement_on_same_line = false
resharper_place_simple_switch_expression_on_single_line = true resharper_place_simple_switch_expression_on_single_line = true
resharper_wrap_before_eq = true resharper_wrap_before_eq = true
resharper_wrap_chained_method_calls = chop_if_long resharper_wrap_chained_method_calls = chop_if_long

View File

@ -1,8 +0,0 @@
<Project>
<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.50.0.58025">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

View File

@ -17,7 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{AD79881E-7
CodeCleanupOnSave.csx = CodeCleanupOnSave.csx CodeCleanupOnSave.csx = CodeCleanupOnSave.csx
Directory.Build.props = Directory.Build.props Directory.Build.props = Directory.Build.props
dot.sln.DotSettings = dot.sln.DotSettings dot.sln.DotSettings = dot.sln.DotSettings
dot.sln.DotSettings.user = dot.sln.DotSettings.user
dotnet-tools.json = dotnet-tools.json dotnet-tools.json = dotnet-tools.json
GenerateResx.targets = GenerateResx.targets GenerateResx.targets = GenerateResx.targets
git-clean.cmd = git-clean.cmd git-clean.cmd = git-clean.cmd
@ -27,7 +26,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{AD79881E-7
README.md = README.md README.md = README.md
README.zh-CN.md = README.zh-CN.md README.zh-CN.md = README.zh-CN.md
SafetyDelUnusedResx.ahk = SafetyDelUnusedResx.ahk SafetyDelUnusedResx.ahk = SafetyDelUnusedResx.ahk
SonarqubleAnalyzer.props = SonarqubleAnalyzer.props
switch-nuget.cmd = switch-nuget.cmd switch-nuget.cmd = switch-nuget.cmd
switch-project.cmd = switch-project.cmd switch-project.cmd = switch-project.cmd
switcher.json = switcher.json switcher.json = switcher.json

View File

@ -1,6 +1,12 @@
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" <wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve"> xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOR/@EntryValue">Required</s:String>
<s:String
x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_FOREACH/@EntryValue">Required</s:String>
<s:String
x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_IFELSE/@EntryValue">Required</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BRACES_FOR_WHILE/@EntryValue">Required</s:String>
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue">&lt;?xml version="1.0" encoding="utf-16"?&gt; <s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"&gt; &lt;Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"&gt;
&lt;TypePattern&gt; &lt;TypePattern&gt;

View File

@ -1,10 +1,14 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
namespace Dot.Color; namespace Dot.Color;
[Description(nameof(Str.ScreenPixelTool))] [Description(nameof(Str.ScreenPixelTool))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
internal sealed class Main : ToolBase<Option> internal sealed class Main : ToolBase<Option>
{ {

View File

@ -9,7 +9,7 @@ namespace Dot.Color;
internal sealed class MouseHook : IDisposable internal sealed class MouseHook : IDisposable
{ {
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit)]
private struct Msllhookstruct private readonly struct Msllhookstruct
{ {
[FieldOffset(0)] public readonly int X; [FieldOffset(0)] public readonly int X;
[FieldOffset(4)] public readonly int Y; [FieldOffset(4)] public readonly int Y;
@ -37,20 +37,29 @@ internal sealed class MouseHook : IDisposable
private void Dispose(bool disposing) private void Dispose(bool disposing)
{ {
if (_disposed) return; if (_disposed) {
return;
}
#pragma warning disable S108 #pragma warning disable S108
if (disposing) { } if (disposing) { }
#pragma warning restore S108 #pragma warning restore S108
if (_hookId != default) Win32.UnhookWindowsHookEx(_hookId); if (_hookId != default) {
Win32.UnhookWindowsHookEx(_hookId);
}
_disposed = true; _disposed = true;
} }
private nint HookCallback(int nCode, nint wParam, nint lParam) private nint HookCallback(int nCode, nint wParam, nint lParam)
{ {
if (nCode < 0 || (_WM_MOUSEMOVE != wParam && _WM_LBUTTONDOWN != wParam)) if (nCode < 0 || (_WM_MOUSEMOVE != wParam && _WM_LBUTTONDOWN != wParam)) {
return Win32.CallNextHookEx(_hookId, nCode, wParam, lParam); return Win32.CallNextHookEx(_hookId, nCode, wParam, lParam);
}
var hookStruct = (Msllhookstruct)Marshal.PtrToStructure(lParam, typeof(Msllhookstruct))!; var hookStruct = (Msllhookstruct)Marshal.PtrToStructure(lParam, typeof(Msllhookstruct))!;
MouseEvent(null, new MouseEventArgs( // MouseEvent(null, new MouseEventArgs( //
wParam == _WM_MOUSEMOVE ? MouseButtons.None : MouseButtons.Left // wParam == _WM_MOUSEMOVE ? MouseButtons.None : MouseButtons.Left //

View File

@ -2,4 +2,4 @@
namespace Dot.Color; namespace Dot.Color;
internal class Option : OptionBase { } internal sealed class Option : OptionBase { }

View File

@ -1,10 +1,13 @@
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Size = System.Drawing.Size; using Size = System.Drawing.Size;
namespace Dot.Color; namespace Dot.Color;
internal class WinInfo : Form [SupportedOSPlatform(nameof(OSPlatform.Windows))]
internal sealed class WinInfo : Form
{ {
private const int _WINDOW_SIZE = 480; //窗口大小 private const int _WINDOW_SIZE = 480; //窗口大小
private const int _ZOOM_RATE = 16; //缩放倍率 private const int _ZOOM_RATE = 16; //缩放倍率
@ -49,7 +52,10 @@ internal class WinInfo : Form
{ {
base.Dispose(disposing); base.Dispose(disposing);
if (_disposed) return; if (_disposed) {
return;
}
if (disposing) { if (disposing) {
_graphics?.Dispose(); _graphics?.Dispose();
_pbox?.Dispose(); _pbox?.Dispose();

View File

@ -1,14 +1,18 @@
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using TextCopy; using TextCopy;
namespace Dot.Color; namespace Dot.Color;
internal class WinMain : Form [SupportedOSPlatform(nameof(OSPlatform.Windows))]
internal sealed class WinMain : Form
{ {
private readonly Bitmap _bmp; private readonly Bitmap _bmp;
private bool _disposed; private bool _disposed;
private readonly WinInfo _winInfo = new(); //小图窗口 private readonly WinInfo _winInfo = new(); //小图窗口
public WinMain() public WinMain()
{ {
// 隐藏控制台窗口,避免捕获到截屏 // 隐藏控制台窗口,避免捕获到截屏
@ -32,7 +36,10 @@ internal class WinMain : Form
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
base.Dispose(disposing); base.Dispose(disposing);
if (_disposed) return; if (_disposed) {
return;
}
if (disposing) { if (disposing) {
_bmp?.Dispose(); _bmp?.Dispose();
_winInfo?.Dispose(); _winInfo?.Dispose();
@ -43,7 +50,9 @@ internal class WinMain : Form
protected override void OnKeyUp(KeyEventArgs e) protected override void OnKeyUp(KeyEventArgs e)
{ {
if (e.KeyCode == Keys.Escape) Application.Exit(); if (e.KeyCode == Keys.Escape) {
Application.Exit();
}
} }
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)

View File

@ -3,12 +3,13 @@ using System.Diagnostics;
namespace Dot; namespace Dot;
// ReSharper disable once UnusedType.Global // ReSharper disable once UnusedType.Global
internal class CsxEditor // ReSharper disable once UnusedMember.Global
internal sealed class CsxEditor
{ {
// ReSharper disable once UnusedMember.Local // ReSharper disable once UnusedMember.Local
#pragma warning disable CA1822 #pragma warning disable IDE0051
private void Run() private static void Run()
#pragma warning restore CA1822 #pragma warning restore IDE0051
{ {
/* /*
for %%i in (*.png) do pngquant %%i --force --output %%i --skip-if-larger for %%i in (*.png) do pngquant %%i --force --output %%i --skip-if-larger
@ -25,14 +26,14 @@ internal class CsxEditor
.ToArray(); .ToArray();
Parallel.ForEach(files, file => { _ = Parallel.ForEach(files, file => {
var startInfo = new ProcessStartInfo { var startInfo = new ProcessStartInfo {
FileName = "pngquant" FileName = "pngquant"
, Arguments , Arguments
= $"\"{file}\" --force --output \"{file}\" --skip-if-larger" = $"\"{file}\" --force --output \"{file}\" --skip-if-larger"
}; };
using var p = Process.Start(startInfo); using var p = Process.Start(startInfo);
p.WaitForExit(); p!.WaitForExit();
Console.WriteLine(p.ExitCode); Console.WriteLine(p.ExitCode);
}); });
@ -46,13 +47,13 @@ internal class CsxEditor
})) }))
.ToArray(); .ToArray();
Parallel.ForEach(files, file => { _ = Parallel.ForEach(files, file => {
var startInfo = new ProcessStartInfo { var startInfo = new ProcessStartInfo {
FileName = "jpegtran" FileName = "jpegtran"
, Arguments = $"-copy none -optimize -perfect \"{file}\" \"{file}\"" , Arguments = $"-copy none -optimize -perfect \"{file}\" \"{file}\""
}; };
using var p = Process.Start(startInfo); using var p = Process.Start(startInfo);
p.WaitForExit(); p!.WaitForExit();
Console.WriteLine(p.ExitCode); Console.WriteLine(p.ExitCode);
}); });
} }

View File

@ -1,4 +1,5 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Globalization;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
// ReSharper disable once RedundantUsingDirective // ReSharper disable once RedundantUsingDirective
using Panel = Spectre.Console.Panel; using Panel = Spectre.Console.Panel;
@ -21,7 +22,10 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
private async Task CoreInternal() private async Task CoreInternal()
{ {
if (!Opt.WriteMode) AnsiConsole.MarkupLine("[gray]{0}[/]", Str.ExerciseMode); if (!Opt.WriteMode) {
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, "[gray]{0}[/]", Str.ExerciseMode);
}
IEnumerable<string> fileList; IEnumerable<string> fileList;
await AnsiConsole.Progress() await AnsiConsole.Progress()
.Columns(new ProgressBarColumn() // .Columns(new ProgressBarColumn() //
@ -45,8 +49,9 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
var grid = new Grid().AddColumn(new GridColumn().NoWrap().PadRight(16)) var grid = new Grid().AddColumn(new GridColumn().NoWrap().PadRight(16))
.AddColumn(new GridColumn().Alignment(Justify.Right)); .AddColumn(new GridColumn().Alignment(Justify.Right));
foreach (var kv in _writeStats.OrderByDescending(x => x.Value).ThenBy(x => x.Key)) foreach (var kv in _writeStats.OrderByDescending(x => x.Value).ThenBy(x => x.Key)) {
grid.AddRow(kv.Key, kv.Value.ToString()); _ = grid.AddRow(kv.Key, kv.Value.ToString(CultureInfo.InvariantCulture));
}
AnsiConsole.Write(new Panel(grid).Header(Str.WriteFileStats)); AnsiConsole.Write(new Panel(grid).Header(Str.WriteFileStats));
} }
@ -57,7 +62,11 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
{ {
var exCnt = 0; var exCnt = 0;
if (Opt.ExcludeRegexes?.FirstOrDefault() is null) //默认排除.git 、 node_modules 目录 if (Opt.ExcludeRegexes?.FirstOrDefault() is null) //默认排除.git 、 node_modules 目录
{
Opt.ExcludeRegexes = new[] { @"\.git", "node_modules" }; Opt.ExcludeRegexes = new[] { @"\.git", "node_modules" };
}
var excludeRegexes = Opt.ExcludeRegexes.Select(x => new Regex(x)); var excludeRegexes = Opt.ExcludeRegexes.Select(x => new Regex(x));
var fileList = Directory.EnumerateFiles(path, searchPattern var fileList = Directory.EnumerateFiles(path, searchPattern
, new EnumerationOptions { , new EnumerationOptions {
@ -68,7 +77,10 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
, MaxRecursionDepth = Opt.MaxRecursionDepth , MaxRecursionDepth = Opt.MaxRecursionDepth
}) })
.Where(x => { .Where(x => {
if (!excludeRegexes.Any(y => y.IsMatch(x))) return true; if (!excludeRegexes.Any(y => y.IsMatch(x))) {
return true;
}
++exCnt; ++exCnt;
return false; return false;
}) })
@ -79,9 +91,10 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
protected override Task Core() protected override Task Core()
{ {
if (!Directory.Exists(Opt.Path)) return !Directory.Exists(Opt.Path)
throw new ArgumentException(nameof(Opt.Path), string.Format(Str.PathNotFound, Opt.Path)); ? throw new ArgumentException(nameof(Opt.Path)
return CoreInternal(); , string.Format(CultureInfo.InvariantCulture, Str.PathNotFound, Opt.Path))
: CoreInternal();
} }
@ -124,7 +137,10 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
_readCnt += readCnt; _readCnt += readCnt;
_writeCnt += writeCnt; _writeCnt += writeCnt;
_breakCnt += breakCnt; _breakCnt += breakCnt;
if (readCnt > 0) _childTask.Increment(1); if (readCnt > 0) {
_childTask.Increment(1);
}
_childTask.Description _childTask.Description
= $"{Str.Read}: [green]{_readCnt}[/]/{_totalCnt}, {Str.Write}: [red]{_writeCnt}[/], {Str.Break}: [gray]{_breakCnt}[/], {Str.Exclude}: [yellow]{_excludeCnt}[/]"; = $"{Str.Read}: [green]{_readCnt}[/]/{_totalCnt}, {Str.Write}: [red]{_writeCnt}[/], {Str.Break}: [gray]{_breakCnt}[/], {Str.Exclude}: [yellow]{_excludeCnt}[/]";
} }
@ -133,6 +149,6 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
protected void UpdateStats(string key) protected void UpdateStats(string key)
{ {
_writeStats.AddOrUpdate(key, 1, (_, oldValue) => oldValue + 1); _ = _writeStats.AddOrUpdate(key, 1, (_, oldValue) => oldValue + 1);
} }
} }

View File

@ -8,7 +8,7 @@ namespace Dot.Get;
[Description(nameof(Str.DownloadTool))] [Description(nameof(Str.DownloadTool))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
internal partial class Main : ToolBase<Option> internal sealed partial class Main : ToolBase<Option>
{ {
private const string _PART = "part"; private const string _PART = "part";
@ -22,7 +22,9 @@ internal partial class Main : ToolBase<Option>
{ {
if (GetUseablePath(ref path)) if (GetUseablePath(ref path))
// path 是一个存在的文件,已追加尾标 // path 是一个存在的文件,已追加尾标
{
return path; return path;
}
// ReSharper disable once InvertIf // ReSharper disable once InvertIf
if (Directory.Exists(path)) { //path 是一个存在的目录。 if (Directory.Exists(path)) { //path 是一个存在的目录。
@ -115,8 +117,9 @@ internal partial class Main : ToolBase<Option>
contentLength = content.Headers.ContentLength ?? 0; contentLength = content.Headers.ContentLength ?? 0;
attachment = content.Headers.ContentDisposition?.FileName ?? attachment = content.Headers.ContentDisposition?.FileName ??
Opt.Url[(Opt.Url.LastIndexOf('/') + 1)..]; Opt.Url[(Opt.Url.LastIndexOf('/') + 1)..];
foreach (var kv in content.Headers) foreach (var kv in content.Headers) {
table.AddRow(kv.Key, string.Join(Environment.NewLine, kv.Value)); table.AddRow(kv.Key, string.Join(Environment.NewLine, kv.Value));
}
}); });
AnsiConsole.Write(table); AnsiConsole.Write(table);
@ -164,7 +167,10 @@ internal partial class Main : ToolBase<Option>
using var getReq = new HttpRequestMessage(HttpMethod.Get, Opt.Url); using var getReq = new HttpRequestMessage(HttpMethod.Get, Opt.Url);
var startPos = i * chunkSize; var startPos = i * chunkSize;
var endPos = startPos + chunkSize - 1; var endPos = startPos + chunkSize - 1;
if (i == Opt.ChunkNumbers - 1) endPos += contentLength % chunkSize; if (i == Opt.ChunkNumbers - 1) {
endPos += contentLength % chunkSize;
}
getReq.Headers.Range = new RangeHeaderValue(startPos, endPos); getReq.Headers.Range = new RangeHeaderValue(startPos, endPos);
// ReSharper disable once AccessToDisposedClosure // ReSharper disable once AccessToDisposedClosure
using var getRsp using var getRsp

View File

@ -3,7 +3,7 @@
namespace Dot.Get; namespace Dot.Get;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[CommandOption("-b|--buffer-size")] [CommandOption("-b|--buffer-size")]
[Description(nameof(Str.BufferSize))] [Description(nameof(Str.BufferSize))]

View File

@ -2,6 +2,7 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.Text; using System.Text;
using NSExt.Extensions; using NSExt.Extensions;
@ -9,7 +10,7 @@ namespace Dot.Git;
[Description(nameof(Str.GitTool))] [Description(nameof(Str.GitTool))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
internal class Main : ToolBase<Option> internal sealed class Main : ToolBase<Option>
{ {
private Encoding _gitOutputEnc; //git command rsp 编码 private Encoding _gitOutputEnc; //git command rsp 编码
private ConcurrentDictionary<string, StringBuilder> _repoRsp; //仓库信息容器 private ConcurrentDictionary<string, StringBuilder> _repoRsp; //仓库信息容器
@ -28,7 +29,10 @@ internal class Main : ToolBase<Option>
, new TaskDescriptionColumn { Alignment = Justify.Left } // , new TaskDescriptionColumn { Alignment = Justify.Left } //
) )
.StartAsync(async ctx => { .StartAsync(async ctx => {
var taskFinder = ctx.AddTask(string.Format(Str.FindGitReps, Opt.Path)).IsIndeterminate(); var taskFinder = ctx
.AddTask(string.Format(CultureInfo.InvariantCulture, Str.FindGitReps
, Opt.Path))
.IsIndeterminate();
var paths = Directory.GetDirectories(Opt.Path, ".git" // var paths = Directory.GetDirectories(Opt.Path, ".git" //
, new EnumerationOptions // , new EnumerationOptions //
{ {
@ -44,8 +48,8 @@ internal class Main : ToolBase<Option>
_repoStatus = new ConcurrentDictionary<string, TaskStatusColumn.Statues>(); _repoStatus = new ConcurrentDictionary<string, TaskStatusColumn.Statues>();
var tasks = new Dictionary<string, ProgressTask>(); var tasks = new Dictionary<string, ProgressTask>();
foreach (var path in paths) { foreach (var path in paths) {
_repoRsp.TryAdd(path, new StringBuilder()); _ = _repoRsp.TryAdd(path, new StringBuilder());
_repoStatus.TryAdd(path, default); _ = _repoStatus.TryAdd(path, default);
var task = ctx.AddTask(new DirectoryInfo(path).Name, false).IsIndeterminate(); var task = ctx.AddTask(new DirectoryInfo(path).Name, false).IsIndeterminate();
tasks.Add(path, task); tasks.Add(path, task);
} }
@ -82,7 +86,10 @@ internal class Main : ToolBase<Option>
// 打印 git command rsp // 打印 git command rsp
void ExecRspReceived(object sender, DataReceivedEventArgs e) void ExecRspReceived(object sender, DataReceivedEventArgs e)
{ {
if (e.Data is null) return; if (e.Data is null) {
return;
}
var msg = Encoding.UTF8.GetString(_gitOutputEnc.GetBytes(e.Data)); var msg = Encoding.UTF8.GetString(_gitOutputEnc.GetBytes(e.Data));
_repoRsp[payload.Key].Append(msg.EscapeMarkup()); _repoRsp[payload.Key].Append(msg.EscapeMarkup());
} }
@ -122,9 +129,9 @@ internal class Main : ToolBase<Option>
protected override Task Core() protected override Task Core()
{ {
if (!Directory.Exists(Opt.Path)) return !Directory.Exists(Opt.Path)
throw new ArgumentException(nameof(Opt.Path) // ? throw new ArgumentException(nameof(Opt.Path) //
, string.Format(Str.PathNotFound, Opt.Path)); , string.Format(CultureInfo.InvariantCulture, Str.PathNotFound, Opt.Path))
return CoreInternal(); : CoreInternal();
} }
} }

View File

@ -3,7 +3,7 @@
namespace Dot.Git; namespace Dot.Git;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[CommandOption("-a|--args")] [CommandOption("-a|--args")]
[Description(nameof(Str.GitArgs))] [Description(nameof(Str.GitArgs))]

View File

@ -4,6 +4,6 @@ internal static class ProgressTaskStateExtensions
{ {
public static void Status(this ProgressTaskState me, TaskStatusColumn.Statues value) public static void Status(this ProgressTaskState me, TaskStatusColumn.Statues value)
{ {
me.Update<TaskStatusColumn.Statues>(nameof(TaskStatusColumn), _ => value); _ = me.Update<TaskStatusColumn.Statues>(nameof(TaskStatusColumn), _ => value);
} }
} }

View File

@ -6,7 +6,7 @@ using Spectre.Console.Rendering;
namespace Dot.Git; namespace Dot.Git;
internal class TaskStatusColumn : ProgressColumn internal sealed class TaskStatusColumn : ProgressColumn
{ {
public enum Statues : byte public enum Statues : byte
{ {

View File

@ -1,6 +1,7 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
using System.Globalization;
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
using TextCopy; using TextCopy;
#endif #endif
@ -14,7 +15,10 @@ internal sealed class Main : ToolBase<Option>
protected override Task Core() protected override Task Core()
{ {
var guid = System.Guid.NewGuid().ToString(); var guid = System.Guid.NewGuid().ToString();
if (Opt.Upper) guid = guid.ToUpper(); if (Opt.Upper) {
guid = guid.ToUpper(CultureInfo.InvariantCulture);
}
Console.WriteLine(Str.Copied, guid); Console.WriteLine(Str.Copied, guid);
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
ClipboardService.SetText(guid); ClipboardService.SetText(guid);

View File

@ -3,7 +3,7 @@
namespace Dot.Guid; namespace Dot.Guid;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[CommandOption("-u|--upper")] [CommandOption("-u|--upper")]
[Description(nameof(Str.UseUppercase))] [Description(nameof(Str.UseUppercase))]

View File

@ -14,8 +14,10 @@ internal sealed class Main : ToolBase<Option>
{ {
foreach (var item in NetworkInterface.GetAllNetworkInterfaces()) { foreach (var item in NetworkInterface.GetAllNetworkInterfaces()) {
if (item.NetworkInterfaceType != NetworkInterfaceType.Ethernet || if (item.NetworkInterfaceType != NetworkInterfaceType.Ethernet ||
item.OperationalStatus != OperationalStatus.Up) item.OperationalStatus != OperationalStatus.Up) {
continue; continue;
}
var output = string.Join(Environment.NewLine var output = string.Join(Environment.NewLine
, item.GetIPProperties() , item.GetIPProperties()
.UnicastAddresses .UnicastAddresses

View File

@ -2,4 +2,4 @@
namespace Dot.IP; namespace Dot.IP;
internal class Option : OptionBase { } internal sealed class Option : OptionBase { }

View File

@ -11,7 +11,7 @@ namespace Dot.Json;
[Description(nameof(Str.Json))] [Description(nameof(Str.Json))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
internal class Main : ToolBase<Option> internal sealed class Main : ToolBase<Option>
{ {
private object _inputObj; private object _inputObj;
@ -26,11 +26,15 @@ internal class Main : ToolBase<Option>
private async Task CoreInternal() private async Task CoreInternal()
{ {
string result = null; string result = null;
if (Opt.Compress) if (Opt.Compress) {
result = await JsonCompress(); result = await JsonCompress();
else if (Opt.ConvertToString) }
else if (Opt.ConvertToString) {
result = await ConvertToString(); result = await ConvertToString();
else if (Opt.Format) result = await JsonFormat(); }
else if (Opt.Format) {
result = await JsonFormat();
}
if (!result.NullOrWhiteSpace()) { if (!result.NullOrWhiteSpace()) {
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
@ -61,9 +65,13 @@ internal class Main : ToolBase<Option>
var inputText = Opt.InputText; var inputText = Opt.InputText;
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
if (inputText.NullOrWhiteSpace()) inputText = ClipboardService.GetText(); if (inputText.NullOrWhiteSpace()) {
inputText = ClipboardService.GetText();
}
#endif #endif
if (inputText.NullOrWhiteSpace()) throw new ArgumentException(Str.InputTextIsEmpty); if (inputText.NullOrWhiteSpace()) {
throw new ArgumentException(Str.InputTextIsEmpty);
}
try { try {
_inputObj = inputText.Object<object>(); _inputObj = inputText.Object<object>();

View File

@ -3,7 +3,7 @@
namespace Dot.Json; namespace Dot.Json;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[CommandOption("-c|--compress")] [CommandOption("-c|--compress")]
[Description(nameof(Str.CompressJson))] [Description(nameof(Str.CompressJson))]

View File

@ -27,7 +27,7 @@ namespace Dot.Lang {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Str { internal sealed class Str {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;

View File

@ -1,31 +1,43 @@
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using Dot;
using Dot.Git; using Dot.Git;
var app = new CommandApp(); namespace Dot;
app.Configure(config => { internal sealed class Program
{
public static int Main(string[] args)
{
var app = new CommandApp();
app.Configure(config => {
config.SetApplicationName(AssemblyInfo.ASSEMBLY_PRODUCT); config.SetApplicationName(AssemblyInfo.ASSEMBLY_PRODUCT);
config.SetApplicationVersion(AssemblyInfo.ASSEMBLY_VERSION); config.SetApplicationVersion(AssemblyInfo.ASSEMBLY_VERSION);
config.AddCommand<Main>(nameof(Dot.Git).ToLower()); config.AddCommand<Main>(nameof(Git).ToLower(CultureInfo.InvariantCulture));
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
config.AddCommand<Dot.Color.Main>(nameof(Dot.Color).ToLower()); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
config.AddCommand<Color.Main>(nameof(Color).ToLower(CultureInfo.InvariantCulture));
}
#endif #endif
config.AddCommand<Dot.Guid.Main>(nameof(Dot.Guid).ToLower()); config.AddCommand<Guid.Main>(nameof(Guid).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.IP.Main>(nameof(Dot.IP).ToLower()); config.AddCommand<IP.Main>(nameof(IP).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Json.Main>(nameof(Dot.Json).ToLower()); config.AddCommand<Json.Main>(nameof(Json).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Pwd.Main>(nameof(Dot.Pwd).ToLower()); config.AddCommand<Pwd.Main>(nameof(Pwd).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Rbom.Main>(nameof(Dot.Rbom).ToLower()); config.AddCommand<Rbom.Main>(nameof(Rbom).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Trim.Main>(nameof(Dot.Trim).ToLower()); config.AddCommand<Trim.Main>(nameof(Trim).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Text.Main>(nameof(Dot.Text).ToLower()); config.AddCommand<Text.Main>(nameof(Text).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Time.Main>(nameof(Dot.Time).ToLower()); config.AddCommand<Time.Main>(nameof(Time).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.ToLf.Main>(nameof(Dot.ToLf).ToLower()); config.AddCommand<ToLf.Main>(nameof(ToLf).ToLower(CultureInfo.InvariantCulture));
config.AddCommand<Dot.Get.Main>(nameof(Dot.Get).ToLower()); config.AddCommand<Get.Main>(nameof(Get).ToLower(CultureInfo.InvariantCulture));
config.ValidateExamples(); config.ValidateExamples();
}); });
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
return app.Run(args); return app.Run(args);
}
}

View File

@ -27,28 +27,38 @@ internal sealed class Main : ToolBase<Option>
var pDest = stackalloc char[Opt.Length]; var pDest = stackalloc char[Opt.Length];
var sourceLen = 0; var sourceLen = 0;
if (Opt.Type.HasFlag(Option.GenerateTypes.Number)) if (Opt.Type.HasFlag(Option.GenerateTypes.Number)) {
foreach (var c in _charTable[0]) foreach (var c in _charTable[0]) {
*(pSource + sourceLen++) = c; *(pSource + sourceLen++) = c;
}
}
if (Opt.Type.HasFlag(Option.GenerateTypes.LowerCaseLetter)) if (Opt.Type.HasFlag(Option.GenerateTypes.LowerCaseLetter)) {
foreach (var c in _charTable[1]) foreach (var c in _charTable[1]) {
*(pSource + sourceLen++) = c; *(pSource + sourceLen++) = c;
}
}
if (Opt.Type.HasFlag(Option.GenerateTypes.UpperCaseLetter)) if (Opt.Type.HasFlag(Option.GenerateTypes.UpperCaseLetter)) {
foreach (var c in _charTable[2]) foreach (var c in _charTable[2]) {
*(pSource + sourceLen++) = c; *(pSource + sourceLen++) = c;
}
}
if (Opt.Type.HasFlag(Option.GenerateTypes.SpecialCharacter)) if (Opt.Type.HasFlag(Option.GenerateTypes.SpecialCharacter)) {
foreach (var c in _charTable[3]) foreach (var c in _charTable[3]) {
*(pSource + sourceLen++) = c; *(pSource + sourceLen++) = c;
}
}
var randScope = new[] { 0, sourceLen }; var randScope = new[] { 0, sourceLen };
for (var i = 0; i != Opt.Length; ++i) // for (var i = 0; i != Opt.Length; ++i) //
{
*(pDest + i) = *(pSource + randScope.Rand()); *(pDest + i) = *(pSource + randScope.Rand());
}
var result = new string(pDest, 0, Opt.Length); var result = new string(pDest, 0, Opt.Length);
Console.WriteLine(Str.Copied, result); Console.WriteLine(Str.Copied, result);

View File

@ -3,7 +3,7 @@
namespace Dot.Pwd; namespace Dot.Pwd;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[Flags] [Flags]
public enum GenerateTypes public enum GenerateTypes

View File

@ -14,11 +14,18 @@ internal sealed class Main : FilesTool<Option>
{ {
Span<byte> buffer = stackalloc byte[_utf8Bom.Length]; Span<byte> buffer = stackalloc byte[_utf8Bom.Length];
var readLen = fsr.Read(buffer); var readLen = fsr.Read(buffer);
if (readLen != _utf8Bom.Length || !buffer.SequenceEqual(_utf8Bom)) return false; if (readLen != _utf8Bom.Length || !buffer.SequenceEqual(_utf8Bom)) {
return false;
}
using var fsw = CreateTempFile(out tempFile); using var fsw = CreateTempFile(out tempFile);
int data; int data;
while ((data = fsr.ReadByte()) != -1) fsw.WriteByte((byte)data);
while ((data = fsr.ReadByte()) != -1) {
fsw.WriteByte((byte)data);
}
return true; return true;
} }
@ -35,7 +42,10 @@ internal sealed class Main : FilesTool<Option>
} }
if (CloneFileWithoutBom(fsr, ref tmpFile)) { if (CloneFileWithoutBom(fsr, ref tmpFile)) {
if (Opt.WriteMode) File.Copy(tmpFile, file, true); if (Opt.WriteMode) {
File.Copy(tmpFile, file, true);
}
ShowMessage(0, 1, 0); ShowMessage(0, 1, 0);
UpdateStats(Path.GetExtension(file)); UpdateStats(Path.GetExtension(file));
} }
@ -44,6 +54,8 @@ internal sealed class Main : FilesTool<Option>
} }
} }
if (tmpFile != default) File.Delete(tmpFile); if (tmpFile != default) {
File.Delete(tmpFile);
}
} }
} }

View File

@ -3,4 +3,4 @@
namespace Dot.Rbom; namespace Dot.Rbom;
internal class Option : DirOption { } internal sealed class Option : DirOption { }

View File

@ -54,7 +54,10 @@ internal sealed class Main : ToolBase<Option>
ret.HtmlEncode = text.Html(); ret.HtmlEncode = text.Html();
if (!text.IsBase64String()) return ret; if (!text.IsBase64String()) {
return ret;
}
byte[] base64DeHex = null; byte[] base64DeHex = null;
try { try {
base64DeHex = text.Base64De(); base64DeHex = text.Base64De();
@ -63,7 +66,10 @@ internal sealed class Main : ToolBase<Option>
// ignored // ignored
} }
if (base64DeHex == null) return ret; if (base64DeHex == null) {
return ret;
}
ret.Base64DeCodeHex = base64DeHex.String(); ret.Base64DeCodeHex = base64DeHex.String();
ret.Base64DeCode = enc.GetString(base64DeHex); ret.Base64DeCode = enc.GetString(base64DeHex);
@ -118,9 +124,13 @@ html-decode: {o.HtmlDecode}
#endif #endif
{ {
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
if (Opt.Text.NullOrEmpty()) Opt.Text = await ClipboardService.GetTextAsync(); if (Opt.Text.NullOrEmpty()) {
Opt.Text = await ClipboardService.GetTextAsync();
}
#endif #endif
if (Opt.Text.NullOrEmpty()) throw new ArgumentException(Str.InputTextIsEmpty); if (Opt.Text.NullOrEmpty()) {
throw new ArgumentException(Str.InputTextIsEmpty);
}
ParseAndShow(Opt.Text); ParseAndShow(Opt.Text);

View File

@ -3,7 +3,7 @@
namespace Dot.Text; namespace Dot.Text;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[CommandArgument(0, "[input text]")] [CommandArgument(0, "[input text]")]
[Description(nameof(Str.TextTobeProcessed))] [Description(nameof(Str.TextTobeProcessed))]

View File

@ -1,6 +1,7 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
using System.Globalization;
using System.Net.Sockets; using System.Net.Sockets;
namespace Dot.Time; namespace Dot.Time;
@ -48,9 +49,9 @@ internal sealed class Main : ToolBase<Option>
try { try {
socket.Connect(server, _NTP_PORT); socket.Connect(server, _NTP_PORT);
socket.Send(ntpData); _ = socket.Send(ntpData);
var timeBefore = DateTime.Now; var timeBefore = DateTime.Now;
socket.Receive(ntpData); _ = socket.Receive(ntpData);
var transferTime = DateTime.Now - timeBefore; var transferTime = DateTime.Now - timeBefore;
var intPart = ((ulong)ntpData[40] << 24) // var intPart = ((ulong)ntpData[40] << 24) //
@ -130,8 +131,8 @@ internal sealed class Main : ToolBase<Option>
.Average(x => x.Value.State.Result().TotalMilliseconds); .Average(x => x.Value.State.Result().TotalMilliseconds);
}); });
AnsiConsole.MarkupLine(Str.NtpReceiveDone, $"[green]{_successCnt}[/]", _ntpServers.Length AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, Str.NtpReceiveDone, $"[green]{_successCnt}[/]"
, $"[yellow]{_offsetAvg:f2}[/]"); , _ntpServers.Length, $"[yellow]{_offsetAvg:f2}[/]");
if (Opt.Sync) { if (Opt.Sync) {
@ -159,11 +160,11 @@ internal sealed class Main : ToolBase<Option>
table.UpdateCell( table.UpdateCell(
0, 1, DateTime.Now.AddMilliseconds(-_offsetAvg).ToString("O")) 0, 1, DateTime.Now.AddMilliseconds(-_offsetAvg).ToString("O"))
.UpdateCell(1, 1, DateTime.Now.ToString("O"))); .UpdateCell(1, 1, DateTime.Now.ToString("O")));
await Task.Delay(100); await Task.Delay(100, CancellationToken.None);
} }
}); });
await AnsiConsole.Console.Input.ReadKeyAsync(true, cts.Token); _ = await AnsiConsole.Console.Input.ReadKeyAsync(true, cts.Token);
cts.Cancel(); cts.Cancel();
await task; await task;
} }

View File

@ -3,7 +3,7 @@
namespace Dot.Time; namespace Dot.Time;
internal class Option : OptionBase internal sealed class Option : OptionBase
{ {
[CommandOption("-s|--sync")] [CommandOption("-s|--sync")]
[Description(nameof(Str.SyncToLocalTime))] [Description(nameof(Str.SyncToLocalTime))]

View File

@ -9,7 +9,7 @@ internal static class ProgressTaskStateExtensions
public static void Result(this ProgressTaskState me, TimeSpan value) public static void Result(this ProgressTaskState me, TimeSpan value)
{ {
me.Update<TimeSpan>(nameof(TaskResultColumn), _ => value); _ = me.Update<TimeSpan>(nameof(TaskResultColumn), _ => value);
} }
public static TaskStatusColumn.Statues Status(this ProgressTaskState me) public static TaskStatusColumn.Statues Status(this ProgressTaskState me)
@ -19,6 +19,6 @@ internal static class ProgressTaskStateExtensions
public static void Status(this ProgressTaskState me, TaskStatusColumn.Statues value) public static void Status(this ProgressTaskState me, TaskStatusColumn.Statues value)
{ {
me.Update<TaskStatusColumn.Statues>(nameof(TaskStatusColumn), _ => value); _ = me.Update<TaskStatusColumn.Statues>(nameof(TaskStatusColumn), _ => value);
} }
} }

View File

@ -5,7 +5,7 @@ using Spectre.Console.Rendering;
namespace Dot.Time; namespace Dot.Time;
internal class TaskResultColumn : ProgressColumn internal sealed class TaskResultColumn : ProgressColumn
{ {
/// <summary> /// <summary>
/// Gets or sets the alignment of the task description. /// Gets or sets the alignment of the task description.

View File

@ -7,7 +7,7 @@ using Spectre.Console.Rendering;
namespace Dot.Time; namespace Dot.Time;
internal class TaskStatusColumn : ProgressColumn internal sealed class TaskStatusColumn : ProgressColumn
{ {
public enum Statues : byte public enum Statues : byte
{ {

View File

@ -34,7 +34,7 @@ internal sealed class Main : FilesTool<Option>
continue; continue;
case 0x0d: //cr macos case 0x0d: //cr macos
fsw.WriteByte(0x0a); fsw.WriteByte(0x0a);
fsr.Seek(-1, SeekOrigin.Current); _ = fsr.Seek(-1, SeekOrigin.Current);
hasWrote = true; hasWrote = true;
continue; continue;
case 0x00 or 0xff: //非文本文件 case 0x00 or 0xff: //非文本文件
@ -53,7 +53,10 @@ internal sealed class Main : FilesTool<Option>
#pragma warning disable S2583 #pragma warning disable S2583
if (hasWrote && !isBin) { if (hasWrote && !isBin) {
#pragma warning restore S2583 #pragma warning restore S2583
if (Opt.WriteMode) File.Copy(tmpFile, file, true); if (Opt.WriteMode) {
File.Copy(tmpFile, file, true);
}
ShowMessage(0, 1, 0); ShowMessage(0, 1, 0);
UpdateStats(Path.GetExtension(file)); UpdateStats(Path.GetExtension(file));
} }

View File

@ -3,4 +3,4 @@
namespace Dot.ToLf; namespace Dot.ToLf;
internal class Option : DirOption { } internal sealed class Option : DirOption { }

View File

@ -10,7 +10,7 @@ internal abstract class ToolBase<TOption> : Command<TOption> where TOption : Opt
await Core(); await Core();
if (Opt.KeepSession) { if (Opt.KeepSession) {
AnsiConsole.MarkupLine(Str.PressAnyKey); AnsiConsole.MarkupLine(Str.PressAnyKey);
AnsiConsole.Console.Input.ReadKey(true); _ = AnsiConsole.Console.Input.ReadKey(true);
} }
} }

View File

@ -12,17 +12,21 @@ internal sealed class Main : FilesTool<Option>
private static int GetSpacesCnt(Stream fsr) private static int GetSpacesCnt(Stream fsr)
{ {
var trimLen = 0; var trimLen = 0;
fsr.Seek(-1, SeekOrigin.End); _ = fsr.Seek(-1, SeekOrigin.End);
int data; int data;
while ((data = fsr.ReadByte()) != -1) while ((data = fsr.ReadByte()) != -1) {
if (new[] { 0x20, 0x0d, 0x0a }.Contains(data)) { if (new[] { 0x20, 0x0d, 0x0a }.Contains(data)) {
++trimLen; ++trimLen;
if (fsr.Position - 2 < 0) break; if (fsr.Position - 2 < 0) {
fsr.Seek(-2, SeekOrigin.Current); break;
}
_ = fsr.Seek(-2, SeekOrigin.Current);
} }
else { else {
break; break;
} }
}
return trimLen; return trimLen;
} }
@ -41,14 +45,17 @@ internal sealed class Main : FilesTool<Option>
return; return;
} }
fsrw.Seek(0, SeekOrigin.Begin); _ = fsrw.Seek(0, SeekOrigin.Begin);
if (!fsrw.IsTextStream()) { if (!fsrw.IsTextStream()) {
ShowMessage(0, 0, 1); ShowMessage(0, 0, 1);
return; return;
} }
if (Opt.WriteMode) fsrw.SetLength(fsrw.Length - spacesCnt); if (Opt.WriteMode) {
fsrw.SetLength(fsrw.Length - spacesCnt);
}
ShowMessage(0, 1, 0); ShowMessage(0, 1, 0);
UpdateStats(Path.GetExtension(file)); UpdateStats(Path.GetExtension(file));
} }

View File

@ -3,4 +3,4 @@
namespace Dot.Trim; namespace Dot.Trim;
internal class Option : DirOption { } internal sealed class Option : DirOption { }

View File

@ -5,8 +5,14 @@
<UseWindowsForms Condition="'$(TargetFramework)' == 'net7.0-windows'">true</UseWindowsForms> <UseWindowsForms Condition="'$(TargetFramework)' == 'net7.0-windows'">true</UseWindowsForms>
<RootNamespace>Dot</RootNamespace> <RootNamespace>Dot</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>CA1416;S1075</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AnalysisLevel>preview-all</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<MSBuildTreatWarningsAsErrors>true</MSBuildTreatWarningsAsErrors>
<MSBuildWarningsAsErrors>true</MSBuildWarningsAsErrors>
<WarningsAsErrors>true</WarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net7.0-windows'"> <PropertyGroup Condition="'$(TargetFramework)' == 'net7.0-windows'">
<DefineConstants>$(DefineConstants);NET7_0_WINDOWS</DefineConstants> <DefineConstants>$(DefineConstants);NET7_0_WINDOWS</DefineConstants>
@ -23,11 +29,5 @@
<LastGenOutput>Str.Designer.cs</LastGenOutput> <LastGenOutput>Str.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="Spectre.Console">
<HintPath>..\..\..\..\..\ForkedGitReps\spectre.console\src\Spectre.Console\bin\Debug\net6.0\Spectre.Console.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="../SonarqubleAnalyzer.props"/>
<Import Project="../GenerateResx.targets"/> <Import Project="../GenerateResx.targets"/>
</Project> </Project>