This commit is contained in:
2022-12-14 17:14:54 +08:00
parent 51943833ed
commit 50bdf223ed
30 changed files with 225 additions and 78 deletions

217
StyleCopAnalyzers.ruleset Normal file
View File

@ -0,0 +1,217 @@
<?xml version="1.0"?>
<RuleSet Name="StyleCop.Analyzers rules with default action" Description="StyleCop.Analyzers with default action. Rules with IsEnabledByDefault = false are disabled." ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpecialRules">
<Rule Id="SA0001" Action="Warning" /> <!-- XML comment analysis disabled -->
<Rule Id="SA0002" Action="Warning" /> <!-- Invalid settings file -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpacingRules">
<Rule Id="SA1000" Action="Warning" /> <!-- Keywords should be spaced correctly -->
<Rule Id="SA1001" Action="None" /> <!-- Commas should be spaced correctly -->
<Rule Id="SA1002" Action="Warning" /> <!-- Semicolons should be spaced correctly -->
<Rule Id="SA1003" Action="Warning" /> <!-- Symbols should be spaced correctly -->
<Rule Id="SA1004" Action="Warning" /> <!-- Documentation lines should begin with single space -->
<Rule Id="SA1005" Action="None" /> <!-- Single line comments should begin with single space -->
<Rule Id="SA1006" Action="Warning" /> <!-- Preprocessor keywords should not be preceded by space -->
<Rule Id="SA1007" Action="Warning" /> <!-- Operator keyword should be followed by space -->
<Rule Id="SA1008" Action="Warning" /> <!-- Opening parenthesis should be spaced correctly -->
<Rule Id="SA1009" Action="Warning" /> <!-- Closing parenthesis should be spaced correctly -->
<Rule Id="SA1010" Action="Warning" /> <!-- Opening square brackets should be spaced correctly -->
<Rule Id="SA1011" Action="Warning" /> <!-- Closing square brackets should be spaced correctly -->
<Rule Id="SA1012" Action="Warning" /> <!-- Opening braces should be spaced correctly -->
<Rule Id="SA1013" Action="Warning" /> <!-- Closing braces should be spaced correctly -->
<Rule Id="SA1014" Action="Warning" /> <!-- Opening generic brackets should be spaced correctly -->
<Rule Id="SA1015" Action="Warning" /> <!-- Closing generic brackets should be spaced correctly -->
<Rule Id="SA1016" Action="Warning" /> <!-- Opening attribute brackets should be spaced correctly -->
<Rule Id="SA1017" Action="Warning" /> <!-- Closing attribute brackets should be spaced correctly -->
<Rule Id="SA1018" Action="Warning" /> <!-- Nullable type symbols should be spaced correctly -->
<Rule Id="SA1019" Action="Warning" /> <!-- Member access symbols should be spaced correctly -->
<Rule Id="SA1020" Action="Warning" /> <!-- Increment decrement symbols should be spaced correctly -->
<Rule Id="SA1021" Action="Warning" /> <!-- Negative signs should be spaced correctly -->
<Rule Id="SA1022" Action="Warning" /> <!-- Positive signs should be spaced correctly -->
<Rule Id="SA1023" Action="Warning" /> <!-- Dereference and access of symbols should be spaced correctly -->
<Rule Id="SA1024" Action="Warning" /> <!-- Colons should be spaced correctly -->
<Rule Id="SA1025" Action="None" /> <!-- Code should not contain multiple whitespace in a row -->
<Rule Id="SA1026" Action="Warning" /> <!-- Code should not contain space after new or stackalloc keyword in implicitly typed array allocation -->
<Rule Id="SA1027" Action="Warning" /> <!-- Use tabs correctly -->
<Rule Id="SA1028" Action="Warning" /> <!-- Code should not contain trailing whitespace -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.ReadabilityRules">
<Rule Id="SA1100" Action="Warning" /> <!-- Do not prefix calls with base unless local implementation exists -->
<Rule Id="SA1101" Action="None" /> <!-- Prefix local calls with this -->
<Rule Id="SA1102" Action="Warning" /> <!-- Query clause should follow previous clause -->
<Rule Id="SA1103" Action="Warning" /> <!-- Query clauses should be on separate lines or all on one line -->
<Rule Id="SA1104" Action="Warning" /> <!-- Query clause should begin on new line when previous clause spans multiple lines -->
<Rule Id="SA1105" Action="Warning" /> <!-- Query clauses spanning multiple lines should begin on own line -->
<Rule Id="SA1106" Action="Warning" /> <!-- Code should not contain empty statements -->
<Rule Id="SA1107" Action="Warning" /> <!-- Code should not contain multiple statements on one line -->
<Rule Id="SA1108" Action="Warning" /> <!-- Block statements should not contain embedded comments -->
<Rule Id="SA1109" Action="None" /> <!-- Block statements should not contain embedded regions -->
<Rule Id="SA1110" Action="Warning" /> <!-- Opening parenthesis or bracket should be on declaration line -->
<Rule Id="SA1111" Action="Warning" /> <!-- Closing parenthesis should be on line of last parameter -->
<Rule Id="SA1112" Action="Warning" /> <!-- Closing parenthesis should be on line of opening parenthesis -->
<Rule Id="SA1113" Action="Warning" /> <!-- Comma should be on the same line as previous parameter -->
<Rule Id="SA1114" Action="Warning" /> <!-- Parameter list should follow declaration -->
<Rule Id="SA1115" Action="Warning" /> <!-- Parameter should follow comma -->
<Rule Id="SA1116" Action="Warning" /> <!-- Split parameters should start on line after declaration -->
<Rule Id="SA1117" Action="Warning" /> <!-- Parameters should be on same line or separate lines -->
<Rule Id="SA1118" Action="Warning" /> <!-- Parameter should not span multiple lines -->
<Rule Id="SA1120" Action="None" /> <!-- Comments should contain text -->
<Rule Id="SA1121" Action="Warning" /> <!-- Use built-in type alias -->
<Rule Id="SA1122" Action="Warning" /> <!-- Use string.Empty for empty strings -->
<Rule Id="SA1123" Action="Warning" /> <!-- Do not place regions within elements -->
<Rule Id="SA1124" Action="Warning" /> <!-- Do not use regions -->
<Rule Id="SA1125" Action="Warning" /> <!-- Use shorthand for nullable types -->
<Rule Id="SA1126" Action="None" /> <!-- Prefix calls correctly -->
<Rule Id="SA1127" Action="Warning" /> <!-- Generic type constraints should be on their own line -->
<Rule Id="SA1128" Action="Warning" /> <!-- Put constructor initializers on their own line -->
<Rule Id="SA1129" Action="Warning" /> <!-- Do not use default value type constructor -->
<Rule Id="SA1130" Action="Warning" /> <!-- Use lambda syntax -->
<Rule Id="SA1131" Action="Warning" /> <!-- Use readable conditions -->
<Rule Id="SA1132" Action="Warning" /> <!-- Do not combine fields -->
<Rule Id="SA1133" Action="Warning" /> <!-- Do not combine attributes -->
<Rule Id="SA1134" Action="Warning" /> <!-- Attributes should not share line -->
<Rule Id="SA1135" Action="Warning" /> <!-- Using directives should be qualified -->
<Rule Id="SA1136" Action="Warning" /> <!-- Enum values should be on separate lines -->
<Rule Id="SA1137" Action="Warning" /> <!-- Elements should have the same indentation -->
<Rule Id="SA1139" Action="Warning" /> <!-- Use literal suffix notation instead of casting -->
<Rule Id="SX1101" Action="None" /> <!-- Do not prefix local calls with 'this.' -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.OrderingRules">
<Rule Id="SA1200" Action="Warning" /> <!-- Using directives should be placed correctly -->
<Rule Id="SA1201" Action="Warning" /> <!-- Elements should appear in the correct order -->
<Rule Id="SA1202" Action="Warning" /> <!-- Elements should be ordered by access -->
<Rule Id="SA1203" Action="Warning" /> <!-- Constants should appear before fields -->
<Rule Id="SA1204" Action="Warning" /> <!-- Static elements should appear before instance elements -->
<Rule Id="SA1205" Action="Warning" /> <!-- Partial elements should declare access -->
<Rule Id="SA1206" Action="Warning" /> <!-- Declaration keywords should follow order -->
<Rule Id="SA1207" Action="Warning" /> <!-- Protected should come before internal -->
<Rule Id="SA1208" Action="Warning" /> <!-- System using directives should be placed before other using directives -->
<Rule Id="SA1209" Action="Warning" /> <!-- Using alias directives should be placed after other using directives -->
<Rule Id="SA1210" Action="Warning" /> <!-- Using directives should be ordered alphabetically by namespace -->
<Rule Id="SA1211" Action="Warning" /> <!-- Using alias directives should be ordered alphabetically by alias name -->
<Rule Id="SA1212" Action="Warning" /> <!-- Property accessors should follow order -->
<Rule Id="SA1213" Action="Warning" /> <!-- Event accessors should follow order -->
<Rule Id="SA1214" Action="Warning" /> <!-- Readonly fields should appear before non-readonly fields -->
<Rule Id="SA1216" Action="Warning" /> <!-- Using static directives should be placed at the correct location -->
<Rule Id="SA1217" Action="Warning" /> <!-- Using static directives should be ordered alphabetically -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.NamingRules">
<Rule Id="SA1300" Action="Warning" /> <!-- Element should begin with upper-case letter -->
<Rule Id="SA1301" Action="None" /> <!-- Element should begin with lower-case letter -->
<Rule Id="SA1302" Action="Warning" /> <!-- Interface names should begin with I -->
<Rule Id="SA1303" Action="Warning" /> <!-- Const field names should begin with upper-case letter -->
<Rule Id="SA1304" Action="Warning" /> <!-- Non-private readonly fields should begin with upper-case letter -->
<Rule Id="SA1305" Action="None" /> <!-- Field names should not use Hungarian notation -->
<Rule Id="SA1306" Action="Warning" /> <!-- Field names should begin with lower-case letter -->
<Rule Id="SA1307" Action="Warning" /> <!-- Accessible fields should begin with upper-case letter -->
<Rule Id="SA1308" Action="Warning" /> <!-- Variable names should not be prefixed -->
<Rule Id="SA1309" Action="Warning" /> <!-- Field names should not begin with underscore -->
<Rule Id="SA1310" Action="None" /> <!-- Field names should not contain underscore -->
<Rule Id="SA1311" Action="Warning" /> <!-- Static readonly fields should begin with upper-case letter -->
<Rule Id="SA1312" Action="Warning" /> <!-- Variable names should begin with lower-case letter -->
<Rule Id="SA1313" Action="Warning" /> <!-- Parameter names should begin with lower-case letter -->
<Rule Id="SA1314" Action="Warning" /> <!-- Type parameter names should begin with T -->
<Rule Id="SX1309" Action="None" /> <!-- Field names should begin with underscore -->
<Rule Id="SX1309S" Action="None" /> <!-- Static field names should begin with underscore -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.MaintainabilityRules">
<Rule Id="SA1119" Action="Warning" /> <!-- Statement should not use unnecessary parenthesis -->
<Rule Id="SA1400" Action="Warning" /> <!-- Access modifier should be declared -->
<Rule Id="SA1401" Action="Warning" /> <!-- Fields should be private -->
<Rule Id="SA1402" Action="Warning" /> <!-- File may only contain a single type -->
<Rule Id="SA1403" Action="Warning" /> <!-- File may only contain a single namespace -->
<Rule Id="SA1404" Action="Warning" /> <!-- Code analysis suppression should have justification -->
<Rule Id="SA1405" Action="Warning" /> <!-- Debug.Assert should provide message text -->
<Rule Id="SA1406" Action="Warning" /> <!-- Debug.Fail should provide message text -->
<Rule Id="SA1407" Action="Warning" /> <!-- Arithmetic expressions should declare precedence -->
<Rule Id="SA1408" Action="Warning" /> <!-- Conditional expressions should declare precedence -->
<Rule Id="SA1409" Action="None" /> <!-- Remove unnecessary code -->
<Rule Id="SA1410" Action="Warning" /> <!-- Remove delegate parenthesis when possible -->
<Rule Id="SA1411" Action="Warning" /> <!-- Attribute constructor should not use unnecessary parenthesis -->
<Rule Id="SA1412" Action="None" /> <!-- Store files as UTF-8 with byte order mark -->
<Rule Id="SA1413" Action="Warning" /> <!-- Use trailing comma in multi-line initializers -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.LayoutRules">
<Rule Id="SA1500" Action="Warning" /> <!-- Braces for multi-line statements should not share line -->
<Rule Id="SA1501" Action="Warning" /> <!-- Statement should not be on a single line -->
<Rule Id="SA1502" Action="Warning" /> <!-- Element should not be on a single line -->
<Rule Id="SA1503" Action="Warning" /> <!-- Braces should not be omitted -->
<Rule Id="SA1504" Action="Warning" /> <!-- All accessors should be single-line or multi-line -->
<Rule Id="SA1505" Action="Warning" /> <!-- Opening braces should not be followed by blank line -->
<Rule Id="SA1506" Action="Warning" /> <!-- Element documentation headers should not be followed by blank line -->
<Rule Id="SA1507" Action="Warning" /> <!-- Code should not contain multiple blank lines in a row -->
<Rule Id="SA1508" Action="Warning" /> <!-- Closing braces should not be preceded by blank line -->
<Rule Id="SA1509" Action="Warning" /> <!-- Opening braces should not be preceded by blank line -->
<Rule Id="SA1510" Action="Warning" /> <!-- Chained statement blocks should not be preceded by blank line -->
<Rule Id="SA1511" Action="Warning" /> <!-- While-do footer should not be preceded by blank line -->
<Rule Id="SA1512" Action="Warning" /> <!-- Single-line comments should not be followed by blank line -->
<Rule Id="SA1513" Action="Warning" /> <!-- Closing brace should be followed by blank line -->
<Rule Id="SA1514" Action="Warning" /> <!-- Element documentation header should be preceded by blank line -->
<Rule Id="SA1515" Action="Warning" /> <!-- Single-line comment should be preceded by blank line -->
<Rule Id="SA1516" Action="Warning" /> <!-- Elements should be separated by blank line -->
<Rule Id="SA1517" Action="Warning" /> <!-- Code should not contain blank lines at start of file -->
<Rule Id="SA1518" Action="Warning" /> <!-- Use line endings correctly at end of file -->
<Rule Id="SA1519" Action="Warning" /> <!-- Braces should not be omitted from multi-line child statement -->
<Rule Id="SA1520" Action="Warning" /> <!-- Use braces consistently -->
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.DocumentationRules">
<Rule Id="SA1600" Action="None" /> <!-- Elements should be documented -->
<Rule Id="SA1601" Action="Warning" /> <!-- Partial elements should be documented -->
<Rule Id="SA1602" Action="Warning" /> <!-- Enumeration items should be documented -->
<Rule Id="SA1603" Action="None" /> <!-- Documentation should contain valid XML -->
<Rule Id="SA1604" Action="Warning" /> <!-- Element documentation should have summary -->
<Rule Id="SA1605" Action="Warning" /> <!-- Partial element documentation should have summary -->
<Rule Id="SA1606" Action="Warning" /> <!-- Element documentation should have summary text -->
<Rule Id="SA1607" Action="Warning" /> <!-- Partial element documentation should have summary text -->
<Rule Id="SA1608" Action="Warning" /> <!-- Element documentation should not have default summary -->
<Rule Id="SA1609" Action="None" /> <!-- Property documentation should have value -->
<Rule Id="SA1610" Action="Warning" /> <!-- Property documentation should have value text -->
<Rule Id="SA1611" Action="Warning" /> <!-- Element parameters should be documented -->
<Rule Id="SA1612" Action="Warning" /> <!-- Element parameter documentation should match element parameters -->
<Rule Id="SA1613" Action="Warning" /> <!-- Element parameter documentation should declare parameter name -->
<Rule Id="SA1614" Action="Warning" /> <!-- Element parameter documentation should have text -->
<Rule Id="SA1615" Action="Warning" /> <!-- Element return value should be documented -->
<Rule Id="SA1616" Action="Warning" /> <!-- Element return value documentation should have text -->
<Rule Id="SA1617" Action="Warning" /> <!-- Void return value should not be documented -->
<Rule Id="SA1618" Action="Warning" /> <!-- Generic type parameters should be documented -->
<Rule Id="SA1619" Action="Warning" /> <!-- Generic type parameters should be documented partial class -->
<Rule Id="SA1620" Action="Warning" /> <!-- Generic type parameter documentation should match type parameters -->
<Rule Id="SA1621" Action="Warning" /> <!-- Generic type parameter documentation should declare parameter name -->
<Rule Id="SA1622" Action="Warning" /> <!-- Generic type parameter documentation should have text -->
<Rule Id="SA1623" Action="Warning" /> <!-- Property summary documentation should match accessors -->
<Rule Id="SA1624" Action="Warning" /> <!-- Property summary documentation should omit accessor with restricted access -->
<Rule Id="SA1625" Action="Warning" /> <!-- Element documentation should not be copied and pasted -->
<Rule Id="SA1626" Action="Warning" /> <!-- Single-line comments should not use documentation style slashes -->
<Rule Id="SA1627" Action="Warning" /> <!-- Documentation text should not be empty -->
<Rule Id="SA1628" Action="None" /> <!-- Documentation text should begin with a capital letter -->
<Rule Id="SA1629" Action="Warning" /> <!-- Documentation text should end with a period -->
<Rule Id="SA1630" Action="None" /> <!-- Documentation text should contain whitespace -->
<Rule Id="SA1631" Action="None" /> <!-- Documentation should meet character percentage -->
<Rule Id="SA1632" Action="None" /> <!-- Documentation text should meet minimum character length -->
<Rule Id="SA1633" Action="None" /> <!-- File should have header -->
<Rule Id="SA1634" Action="Warning" /> <!-- File header should show copyright -->
<Rule Id="SA1635" Action="Warning" /> <!-- File header should have copyright text -->
<Rule Id="SA1636" Action="Warning" /> <!-- File header copyright text should match -->
<Rule Id="SA1637" Action="Warning" /> <!-- File header should contain file name -->
<Rule Id="SA1638" Action="Warning" /> <!-- File header file name documentation should match file name -->
<Rule Id="SA1639" Action="Warning" /> <!-- File header should have summary -->
<Rule Id="SA1640" Action="Warning" /> <!-- File header should have valid company text -->
<Rule Id="SA1641" Action="Warning" /> <!-- File header company name text should match -->
<Rule Id="SA1642" Action="Warning" /> <!-- Constructor summary documentation should begin with standard text -->
<Rule Id="SA1643" Action="Warning" /> <!-- Destructor summary documentation should begin with standard text -->
<Rule Id="SA1644" Action="None" /> <!-- Documentation headers should not contain blank lines -->
<Rule Id="SA1645" Action="None" /> <!-- Included documentation file does not exist -->
<Rule Id="SA1646" Action="None" /> <!-- Included documentation XPath does not exist -->
<Rule Id="SA1647" Action="None" /> <!-- Include node does not contain valid file and path -->
<Rule Id="SA1648" Action="Warning" /> <!-- Inheritdoc should be used with inheriting class -->
<Rule Id="SA1649" Action="Warning" /> <!-- File name should match first type name -->
<Rule Id="SA1650" Action="None" /> <!-- Element documentation should be spelled correctly -->
<Rule Id="SA1651" Action="Warning" /> <!-- Do not use placeholder elements -->
</Rules>
</RuleSet>

View File

@ -1,6 +1,6 @@
<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:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
xmlns:s="clr-namespace:System;assembly=mscorlib" <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve"> <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
<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

@ -15,7 +15,6 @@ internal sealed class MouseHook : IDisposable
[FieldOffset(4)] public readonly int Y; [FieldOffset(4)] public readonly int Y;
} }
// ReSharper disable once EventNeverSubscribedTo.Global // ReSharper disable once EventNeverSubscribedTo.Global
public event MouseEventHandler MouseEvent = delegate { }; public event MouseEventHandler MouseEvent = delegate { };
private const int _WH_MOUSE_LL = 14; private const int _WH_MOUSE_LL = 14;
@ -34,7 +33,6 @@ internal sealed class MouseHook : IDisposable
Dispose(false); Dispose(false);
} }
private void Dispose(bool disposing) private void Dispose(bool disposing)
{ {
if (_disposed) return; if (_disposed) return;
@ -46,7 +44,6 @@ internal sealed class MouseHook : IDisposable
_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))
@ -68,7 +65,6 @@ internal sealed class MouseHook : IDisposable
return Win32.SetWindowsHookEx(_WH_MOUSE_LL, proc, Win32.GetModuleHandle(curModule.ModuleName), 0); return Win32.SetWindowsHookEx(_WH_MOUSE_LL, proc, Win32.GetModuleHandle(curModule.ModuleName), 0);
} }
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);

View File

@ -33,7 +33,6 @@ internal class WinInfo : Form
Controls.Add(_pbox); Controls.Add(_pbox);
} }
~WinInfo() ~WinInfo()
{ {
Dispose(false); Dispose(false);
@ -58,7 +57,6 @@ internal class WinInfo : Form
_disposed = true; _disposed = true;
} }
public void UpdateImage(Bitmap img, int x, int y) public void UpdateImage(Bitmap img, int x, int y)
{ {
// 计算复制小图的区域 // 计算复制小图的区域

View File

@ -24,7 +24,6 @@ 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"

View File

@ -9,28 +9,24 @@ internal class DirOption : OptionBase
[Localization(typeof(Str))] [Localization(typeof(Str))]
public IEnumerable<string> ExcludeRegexes { get; set; } public IEnumerable<string> ExcludeRegexes { get; set; }
[CommandOption("-f|--filter")] [CommandOption("-f|--filter")]
[Description(nameof(Str.FileSearchPattern))] [Description(nameof(Str.FileSearchPattern))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue("*")] [DefaultValue("*")]
public string Filter { get; set; } public string Filter { get; set; }
[CommandOption("-d|--max-depth")] [CommandOption("-d|--max-depth")]
[Description(nameof(Str.MaxRecursionDepth))] [Description(nameof(Str.MaxRecursionDepth))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue(int.MaxValue)] [DefaultValue(int.MaxValue)]
public int MaxRecursionDepth { get; set; } public int MaxRecursionDepth { get; set; }
[CommandArgument(0, "[path]")] [CommandArgument(0, "[path]")]
[Description(nameof(Str.FolderPath))] [Description(nameof(Str.FolderPath))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue(".")] [DefaultValue(".")]
public string Path { get; set; } public string Path { get; set; }
[CommandOption("-w|--write")] [CommandOption("-w|--write")]
[Description(nameof(Str.WriteMode))] [Description(nameof(Str.WriteMode))]
[Localization(typeof(Str))] [Localization(typeof(Str))]

View File

@ -51,7 +51,6 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
AnsiConsole.Write(new Panel(grid).Header(Str.WriteFileStats)); AnsiConsole.Write(new Panel(grid).Header(Str.WriteFileStats));
} }
// ReSharper disable once ReturnTypeCanBeEnumerable.Local // ReSharper disable once ReturnTypeCanBeEnumerable.Local
private string[] EnumerateFiles(string path, string searchPattern, out int excludeCnt) private string[] EnumerateFiles(string path, string searchPattern, out int excludeCnt)
{ {
@ -84,17 +83,14 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption> where TOption : D
return CoreInternal(); return CoreInternal();
} }
protected static FileStream CreateTempFile(out string file) protected static FileStream CreateTempFile(out string file)
{ {
file = Path.Combine(Path.GetTempPath(), $"{System.Guid.NewGuid()}.tmp"); file = Path.Combine(Path.GetTempPath(), $"{System.Guid.NewGuid()}.tmp");
return OpenFileStream(file, FileMode.OpenOrCreate, FileAccess.Write); return OpenFileStream(file, FileMode.OpenOrCreate, FileAccess.Write);
} }
protected abstract ValueTask FileHandle(string file, CancellationToken cancelToken); protected abstract ValueTask FileHandle(string file, CancellationToken cancelToken);
protected static FileStream OpenFileStream(string file, FileMode mode, FileAccess access protected static FileStream OpenFileStream(string file, FileMode mode, FileAccess access
, FileShare share = FileShare.Read) , FileShare share = FileShare.Read)
{ {
@ -130,7 +126,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

@ -35,7 +35,6 @@ internal partial class Main : ToolBase<Option>
return path; return path;
} }
private static bool GetUseablePath(ref string path) private static bool GetUseablePath(ref string path)
{ {
var dir = Path.GetDirectoryName(path); var dir = Path.GetDirectoryName(path);
@ -55,7 +54,6 @@ internal partial class Main : ToolBase<Option>
return ret; return ret;
} }
private static void MergeParts(string mainFilePath) private static void MergeParts(string mainFilePath)
{ {
var files = Directory.GetFiles(Path.GetDirectoryName(mainFilePath)! // var files = Directory.GetFiles(Path.GetDirectoryName(mainFilePath)! //
@ -120,7 +118,6 @@ internal partial class Main : ToolBase<Option>
}); });
AnsiConsole.Write(table); AnsiConsole.Write(table);
var timer = DateTime.Now; var timer = DateTime.Now;
var mainFilePath = BuildFilePath(Opt.Output, attachment); var mainFilePath = BuildFilePath(Opt.Output, attachment);
await AnsiConsole.Progress() await AnsiConsole.Progress()
@ -155,7 +152,6 @@ internal partial class Main : ToolBase<Option>
tParent.MaxValue = contentLength; tParent.MaxValue = contentLength;
var chunkSize = contentLength / Opt.ChunkNumbers; var chunkSize = contentLength / Opt.ChunkNumbers;
Parallel.For(0, Opt.ChunkNumbers Parallel.For(0, Opt.ChunkNumbers
, new ParallelOptions { MaxDegreeOfParallelism = Opt.MaxParallel } // , new ParallelOptions { MaxDegreeOfParallelism = Opt.MaxParallel } //
, i => { , i => {

View File

@ -17,21 +17,18 @@ internal class Option : OptionBase
[DefaultValue(5)] [DefaultValue(5)]
public int ChunkNumbers { get; set; } public int ChunkNumbers { get; set; }
[CommandOption("-m|--max-parallel")] [CommandOption("-m|--max-parallel")]
[Description(nameof(Str.MaxParallel))] [Description(nameof(Str.MaxParallel))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue(5)] [DefaultValue(5)]
public int MaxParallel { get; set; } public int MaxParallel { get; set; }
[CommandOption("-o|--output")] [CommandOption("-o|--output")]
[Description(nameof(Str.OutputPath))] [Description(nameof(Str.OutputPath))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue(".")] [DefaultValue(".")]
public string Output { get; set; } public string Output { get; set; }
[CommandArgument(0, "<url>")] [CommandArgument(0, "<url>")]
[Description(nameof(Str.Url))] [Description(nameof(Str.Url))]
[Localization(typeof(Str))] [Localization(typeof(Str))]

View File

@ -15,7 +15,6 @@ internal class Main : ToolBase<Option>
private ConcurrentDictionary<string, StringBuilder> _repoRsp; //仓库信息容器 private ConcurrentDictionary<string, StringBuilder> _repoRsp; //仓库信息容器
private ConcurrentDictionary<string, TaskStatusColumn.Statues> _repoStatus; private ConcurrentDictionary<string, TaskStatusColumn.Statues> _repoStatus;
private async Task CoreInternal() private async Task CoreInternal()
{ {
_gitOutputEnc = Encoding.GetEncoding(Opt.GitOutputEncoding); _gitOutputEnc = Encoding.GetEncoding(Opt.GitOutputEncoding);
@ -63,7 +62,6 @@ internal class Main : ToolBase<Option>
$"{Str.ZeroCode}: [green]{_repoStatus.Count(x => x.Value == TaskStatusColumn.Statues $"{Str.ZeroCode}: [green]{_repoStatus.Count(x => x.Value == TaskStatusColumn.Statues
.Succeed)}[/]/{_repoStatus.Count}"); .Succeed)}[/]/{_repoStatus.Count}");
foreach (var repo in _repoRsp) { foreach (var repo in _repoRsp) {
var status = _repoStatus[repo.Key].Desc(); var status = _repoStatus[repo.Key].Desc();
table.AddRow(status.Replace(_repoStatus[repo.Key].ToString(), new DirectoryInfo(repo.Key).Name), Opt.Args table.AddRow(status.Replace(_repoStatus[repo.Key].ToString(), new DirectoryInfo(repo.Key).Name), Opt.Args
@ -73,7 +71,6 @@ internal class Main : ToolBase<Option>
AnsiConsole.Write(table); AnsiConsole.Write(table);
} }
private async ValueTask DirHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _) private async ValueTask DirHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _)
{ {
payload.Value.StartTask(); payload.Value.StartTask();

View File

@ -23,7 +23,6 @@ internal class Option : OptionBase
[DefaultValue(int.MaxValue)] [DefaultValue(int.MaxValue)]
public int MaxRecursionDepth { get; set; } public int MaxRecursionDepth { get; set; }
[CommandArgument(0, "[path]")] [CommandArgument(0, "[path]")]
[Description(nameof(Str.FolderPath))] [Description(nameof(Str.FolderPath))]
[Localization(typeof(Str))] [Localization(typeof(Str))]

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
#if NET7_0_WINDOWS #if NET7_0_WINDOWS
using TextCopy; using TextCopy;
#endif #endif

View File

@ -6,7 +6,6 @@ using NSExt.Extensions;
using TextCopy; using TextCopy;
#endif #endif
namespace Dot.Json; namespace Dot.Json;
[Description(nameof(Str.Json))] [Description(nameof(Str.Json))]
@ -15,7 +14,6 @@ internal class Main : ToolBase<Option>
{ {
private object _inputObj; private object _inputObj;
private async Task<string> ConvertToString() private async Task<string> ConvertToString()
{ {
var ret = await JsonCompress(); var ret = await JsonCompress();
@ -81,7 +79,6 @@ internal class Main : ToolBase<Option>
throw new ArgumentException(Str.InvalidJsonString); throw new ArgumentException(Str.InvalidJsonString);
} }
return CoreInternal(); return CoreInternal();
} }
} }

View File

@ -11,21 +11,18 @@ internal class Option : OptionBase
[DefaultValue(false)] [DefaultValue(false)]
public bool Compress { get; set; } public bool Compress { get; set; }
[CommandOption("-s|--convert-to-string")] [CommandOption("-s|--convert-to-string")]
[Description(nameof(Str.JsonToString))] [Description(nameof(Str.JsonToString))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue(false)] [DefaultValue(false)]
public bool ConvertToString { get; set; } public bool ConvertToString { get; set; }
[CommandOption("-f|--format")] [CommandOption("-f|--format")]
[Description(nameof(Str.FormatJson))] [Description(nameof(Str.FormatJson))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
[DefaultValue(true)] [DefaultValue(true)]
public bool Format { get; set; } public bool Format { get; set; }
[CommandArgument(0, "[input text]")] [CommandArgument(0, "[input text]")]
[Description(nameof(Str.TextTobeProcessed))] [Description(nameof(Str.TextTobeProcessed))]
[Localization(typeof(Str))] [Localization(typeof(Str))]

View File

@ -23,7 +23,6 @@ app.Configure(config => {
config.AddCommand<Dot.ToLf.Main>(nameof(Dot.ToLf).ToLower()); config.AddCommand<Dot.ToLf.Main>(nameof(Dot.ToLf).ToLower());
config.AddCommand<Dot.Get.Main>(nameof(Dot.Get).ToLower()); config.AddCommand<Dot.Get.Main>(nameof(Dot.Get).ToLower());
config.ValidateExamples(); config.ValidateExamples();
}); });

View File

@ -5,7 +5,6 @@ using NSExt.Extensions;
using TextCopy; using TextCopy;
#endif #endif
namespace Dot.Pwd; namespace Dot.Pwd;
[Description(nameof(Str.RandomPasswordGenerator))] [Description(nameof(Str.RandomPasswordGenerator))]
@ -19,7 +18,6 @@ internal sealed class Main : ToolBase<Option>
, "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".ToCharArray() , "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".ToCharArray()
}; };
protected override Task Core() protected override Task Core()
{ {
unsafe { unsafe {
@ -31,7 +29,6 @@ internal sealed class Main : ToolBase<Option>
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;
@ -40,12 +37,10 @@ internal sealed class Main : ToolBase<Option>
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());

View File

@ -14,13 +14,11 @@ internal class Option : OptionBase
, SpecialCharacter = 0b1000 , SpecialCharacter = 0b1000
} }
[CommandArgument(1, "<password length>")] [CommandArgument(1, "<password length>")]
[Description(nameof(Str.PwdLength))] [Description(nameof(Str.PwdLength))]
[Localization(typeof(Str))] [Localization(typeof(Str))]
public int Length { get; set; } public int Length { get; set; }
[CommandArgument(0, "<generate type>")] [CommandArgument(0, "<generate type>")]
[Description(nameof(Str.PwdGenerateTypes))] [Description(nameof(Str.PwdGenerateTypes))]
[Localization(typeof(Str))] [Localization(typeof(Str))]

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
namespace Dot.Rbom; namespace Dot.Rbom;
[Description(nameof(Str.TrimUtf8Bom))] [Description(nameof(Str.TrimUtf8Bom))]
@ -9,7 +8,6 @@ internal sealed class Main : FilesTool<Option>
{ {
private readonly byte[] _utf8Bom = { 0xef, 0xbb, 0xbf }; private readonly byte[] _utf8Bom = { 0xef, 0xbb, 0xbf };
private bool CloneFileWithoutBom(Stream fsr, ref string tempFile) private bool CloneFileWithoutBom(Stream fsr, ref string tempFile)
{ {
Span<byte> buffer = stackalloc byte[_utf8Bom.Length]; Span<byte> buffer = stackalloc byte[_utf8Bom.Length];
@ -22,7 +20,6 @@ internal sealed class Main : FilesTool<Option>
return true; return true;
} }
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken) protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
{ {
ShowMessage(1, 0, 0); ShowMessage(1, 0, 0);

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
namespace Dot.Rbom; namespace Dot.Rbom;
internal class Option : DirOption { } internal class Option : DirOption { }

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using NSExt.Extensions; using NSExt.Extensions;
@ -33,7 +32,6 @@ internal sealed class Main : ToolBase<Option>
public ReadOnlySpan<char> UrlEncode; public ReadOnlySpan<char> UrlEncode;
} }
private static Output BuildOutput(string text, Encoding enc) private static Output BuildOutput(string text, Encoding enc)
{ {
Output ret; Output ret;
@ -53,7 +51,6 @@ internal sealed class Main : ToolBase<Option>
ret.HtmlDecode = text.HtmlDe(); ret.HtmlDecode = text.HtmlDe();
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 {
@ -67,7 +64,6 @@ internal sealed class Main : ToolBase<Option>
ret.Base64DeCodeHex = base64DeHex.String(); ret.Base64DeCodeHex = base64DeHex.String();
ret.Base64DeCode = enc.GetString(base64DeHex); ret.Base64DeCode = enc.GetString(base64DeHex);
return ret; return ret;
} }
@ -78,7 +74,6 @@ internal sealed class Main : ToolBase<Option>
var unicodeLittleEndian = BuildOutput(text, Encoding.Unicode); var unicodeLittleEndian = BuildOutput(text, Encoding.Unicode);
var unicodeBigEndian = BuildOutput(text, Encoding.BigEndianUnicode); var unicodeBigEndian = BuildOutput(text, Encoding.BigEndianUnicode);
PrintOutput(ansi); PrintOutput(ansi);
PrintOutput(utf8); PrintOutput(utf8);
PrintOutput(unicodeLittleEndian); PrintOutput(unicodeLittleEndian);
@ -122,7 +117,6 @@ html-decode: {o.HtmlDecode}
#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);
#if !NET7_0_WINDOWS #if !NET7_0_WINDOWS
return Task.CompletedTask; return Task.CompletedTask;

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
namespace Dot.Text; namespace Dot.Text;
internal class Option : OptionBase internal class Option : OptionBase

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
using System.Net.Sockets; using System.Net.Sockets;
namespace Dot.Time; namespace Dot.Time;
@ -32,10 +31,8 @@ internal sealed class Main : ToolBase<Option>
private double _offsetAvg; private double _offsetAvg;
private int _successCnt; private int _successCnt;
private TimeSpan GetNtpOffset(string server) private TimeSpan GetNtpOffset(string server)
{ {
Span<byte> ntpData = stackalloc byte[48]; Span<byte> ntpData = stackalloc byte[48];
@ -45,7 +42,6 @@ internal sealed class Main : ToolBase<Option>
ReceiveTimeout = Opt.Timeout ReceiveTimeout = Opt.Timeout
}; };
try { try {
socket.Connect(server, _NTP_PORT); socket.Connect(server, _NTP_PORT);
socket.Send(ntpData); socket.Send(ntpData);
@ -91,7 +87,6 @@ internal sealed class Main : ToolBase<Option>
return ValueTask.CompletedTask; return ValueTask.CompletedTask;
} }
private static void SetSysteTime(DateTime time) private static void SetSysteTime(DateTime time)
{ {
var timeToSet = new Win32.Systemtime { var timeToSet = new Win32.Systemtime {
@ -107,7 +102,6 @@ internal sealed class Main : ToolBase<Option>
Win32.SetLocalTime(timeToSet); Win32.SetLocalTime(timeToSet);
} }
protected override async Task Core() protected override async Task Core()
{ {
await AnsiConsole.Progress() await AnsiConsole.Progress()
@ -133,7 +127,6 @@ internal sealed class Main : ToolBase<Option>
AnsiConsole.MarkupLine(Str.NtpReceiveDone, $"[green]{_successCnt}[/]", _ntpServers.Length AnsiConsole.MarkupLine(Str.NtpReceiveDone, $"[green]{_successCnt}[/]", _ntpServers.Length
, $"[yellow]{_offsetAvg:f2}[/]"); , $"[yellow]{_offsetAvg:f2}[/]");
if (Opt.Sync) { if (Opt.Sync) {
SetSysteTime(DateTime.Now.AddMilliseconds(-_offsetAvg)); SetSysteTime(DateTime.Now.AddMilliseconds(-_offsetAvg));
AnsiConsole.MarkupLine($"[green]{Str.LocalTimeSyncDone}[/]"); AnsiConsole.MarkupLine($"[green]{Str.LocalTimeSyncDone}[/]");

View File

@ -11,7 +11,6 @@ internal class Option : OptionBase
[DefaultValue(false)] [DefaultValue(false)]
public bool Sync { get; set; } public bool Sync { get; set; }
[CommandOption("-t|--timeout")] [CommandOption("-t|--timeout")]
[Description(nameof(Str.TimeoutMillSecs))] [Description(nameof(Str.TimeoutMillSecs))]
[Localization(typeof(Str))] [Localization(typeof(Str))]

View File

@ -1,7 +1,6 @@
// ReSharper disable MemberCanBePrivate.Global // ReSharper disable MemberCanBePrivate.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using NSExt.Extensions; using NSExt.Extensions;
using Spectre.Console.Rendering; using Spectre.Console.Rendering;

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
namespace Dot.ToLf; namespace Dot.ToLf;
[Description(nameof(Str.ConvertEndOfLineToLF))] [Description(nameof(Str.ConvertEndOfLineToLF))]
@ -23,7 +22,6 @@ internal sealed class Main : FilesTool<Option>
return; return;
} }
await using var fsw = CreateTempFile(out tmpFile); await using var fsw = CreateTempFile(out tmpFile);
while ((data = fsr.ReadByte()) != -1) { while ((data = fsr.ReadByte()) != -1) {
@ -49,7 +47,6 @@ 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

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
namespace Dot.ToLf; namespace Dot.ToLf;
internal class Option : DirOption { } internal class Option : DirOption { }

View File

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
using NSExt.Extensions; using NSExt.Extensions;
namespace Dot.Trim; namespace Dot.Trim;
@ -27,7 +26,6 @@ internal sealed class Main : FilesTool<Option>
return trimLen; return trimLen;
} }
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken) protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
{ {
ShowMessage(1, 0, 0); ShowMessage(1, 0, 0);
@ -35,7 +33,6 @@ internal sealed class Main : FilesTool<Option>
await using var fsrw = OpenFileStream(file, FileMode.Open, FileAccess.ReadWrite); await using var fsrw = OpenFileStream(file, FileMode.Open, FileAccess.ReadWrite);
if (fsrw is null || fsrw.Length == 0 || (spacesCnt = GetSpacesCnt(fsrw)) == 0) { if (fsrw is null || fsrw.Length == 0 || (spacesCnt = GetSpacesCnt(fsrw)) == 0) {
ShowMessage(0, 0, 1); ShowMessage(0, 0, 1);
return; return;
@ -47,7 +44,6 @@ internal sealed class Main : FilesTool<Option>
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

@ -1,6 +1,5 @@
// ReSharper disable ClassNeverInstantiated.Global // ReSharper disable ClassNeverInstantiated.Global
namespace Dot.Trim; namespace Dot.Trim;
internal class Option : DirOption { } internal class Option : DirOption { }

View File

@ -27,18 +27,15 @@ public static partial class Win32
private const string _USER32_DLL = "user32.dll"; private const string _USER32_DLL = "user32.dll";
public const int SW_HIDE = 0; public const int SW_HIDE = 0;
[LibraryImport(_USER32_DLL)] [LibraryImport(_USER32_DLL)]
internal static partial nint CallNextHookEx(nint hhk, int nCode, nint wParam, nint lParam); internal static partial nint CallNextHookEx(nint hhk, int nCode, nint wParam, nint lParam);
[LibraryImport(_KERNEL32_DLL)] [LibraryImport(_KERNEL32_DLL)]
internal static partial nint GetConsoleWindow(); internal static partial nint GetConsoleWindow();
[LibraryImport(_USER32_DLL)] [LibraryImport(_USER32_DLL)]
internal static partial nint GetDesktopWindow(); internal static partial nint GetDesktopWindow();
[LibraryImport(_KERNEL32_DLL, StringMarshalling = StringMarshalling.Utf16)] [LibraryImport(_KERNEL32_DLL, StringMarshalling = StringMarshalling.Utf16)]
internal static partial nint GetModuleHandle(string lpModuleName); internal static partial nint GetModuleHandle(string lpModuleName);
@ -51,7 +48,6 @@ public static partial class Win32
[LibraryImport(_USER32_DLL)] [LibraryImport(_USER32_DLL)]
internal static partial int ReleaseDC(nint hWnd, nint dc); internal static partial int ReleaseDC(nint hWnd, nint dc);
[LibraryImport(_KERNEL32_DLL)] [LibraryImport(_KERNEL32_DLL)]
internal static partial void SetLocalTime(Systemtime st); internal static partial void SetLocalTime(Systemtime st);

View File

@ -7,6 +7,7 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>CA1416;S1075</NoWarn> <NoWarn>CA1416;S1075</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>../StyleCopAnalyzers.ruleset</CodeAnalysisRuleSet>
</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>
@ -15,6 +16,10 @@
<PackageReference Include="NSExt" Version="1.0.9-alpha.0.1"/> <PackageReference Include="NSExt" Version="1.0.9-alpha.0.1"/>
<PackageReference Include="Spectre.Console.Cli.NS" Version="0.45.1-preview.0.48"/> <PackageReference Include="Spectre.Console.Cli.NS" Version="0.45.1-preview.0.48"/>
<PackageReference Include="Spectre.Console.NS" Version="0.45.1-preview.0.48"/> <PackageReference Include="Spectre.Console.NS" Version="0.45.1-preview.0.48"/>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Condition="'$(TargetFramework)' == 'net7.0-windows'" Include="TextCopy" Version="6.2.0"/> <PackageReference Condition="'$(TargetFramework)' == 'net7.0-windows'" Include="TextCopy" Version="6.2.0"/>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>