mirror of
https://github.com/nsnail/dot.git
synced 2025-06-17 13:03:22 +08:00
<chore>
This commit is contained in:
parent
7d1763246f
commit
ab0af253a4
@ -13,14 +13,20 @@ trim_trailing_whitespace = true
|
|||||||
[*.cs]
|
[*.cs]
|
||||||
dotnet_analyzer_diagnostic.severity = warning
|
dotnet_analyzer_diagnostic.severity = warning
|
||||||
dotnet_diagnostic.CA1707.severity = none
|
dotnet_diagnostic.CA1707.severity = none
|
||||||
|
dotnet_diagnostic.CA1716.severity = none
|
||||||
|
dotnet_diagnostic.CA1848.severity = none
|
||||||
|
dotnet_diagnostic.CA2254.severity = none
|
||||||
dotnet_diagnostic.CA5350.severity = none
|
dotnet_diagnostic.CA5350.severity = none
|
||||||
dotnet_diagnostic.CA5351.severity = none
|
dotnet_diagnostic.CA5351.severity = none
|
||||||
|
dotnet_diagnostic.IDE0005.severity = none
|
||||||
dotnet_diagnostic.IDE0008.severity = none
|
dotnet_diagnostic.IDE0008.severity = none
|
||||||
|
dotnet_diagnostic.IDE0010.severity = none
|
||||||
dotnet_diagnostic.IDE0017.severity = none
|
dotnet_diagnostic.IDE0017.severity = none
|
||||||
dotnet_diagnostic.IDE0048.severity = none
|
dotnet_diagnostic.IDE0048.severity = none
|
||||||
dotnet_diagnostic.IDE0055.severity = none
|
dotnet_diagnostic.IDE0055.severity = none
|
||||||
dotnet_diagnostic.IDE0058.severity = none
|
dotnet_diagnostic.IDE0058.severity = none
|
||||||
dotnet_diagnostic.IDE0160.severity = none
|
dotnet_diagnostic.IDE0160.severity = none
|
||||||
|
dotnet_diagnostic.SYSLIB1045.severity = none
|
||||||
|
|
||||||
|
|
||||||
# ReSharper properties
|
# ReSharper properties
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -29,7 +29,7 @@ x86/
|
|||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
# [Ll]og/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
@ -399,6 +399,6 @@ FodyWeavers.xsd
|
|||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
# User Define
|
# User Define
|
||||||
build/
|
dist/
|
||||||
nuget.config
|
nuget.config
|
||||||
*.[Dd]esigner.cs
|
*.[Dd]esigner.cs
|
@ -1,16 +1,27 @@
|
|||||||
|
#r "nuget: Newtonsoft.Json, 13.0.0"
|
||||||
|
|
||||||
|
using System.Xml;
|
||||||
|
using System.IO;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
var path = Directory.GetFiles(@".idea", "workspace.xml", SearchOption.AllDirectories).First();
|
var path = Directory.GetFiles(@".idea", "workspace.xml", SearchOption.AllDirectories).First();
|
||||||
const string findStr = """
|
XmlDocument xdoc = new XmlDocument();
|
||||||
"keyToString": {
|
using(var fs = File.Open(path, FileMode.Open)){
|
||||||
""";
|
xdoc.Load(fs);
|
||||||
const string replaceStr = """
|
fs.Seek(0, SeekOrigin.Begin);
|
||||||
"keyToString": {
|
var propertiesComponent = xdoc.SelectSingleNode("""//component[@name="PropertiesComponent"]""");
|
||||||
"rider.code.cleanup.on.save": "true",
|
var jsonStr = propertiesComponent.InnerText;
|
||||||
""";
|
var jsonObj = JObject.Parse(jsonStr);
|
||||||
var content = File.ReadAllText(path);
|
var keyToStringObj = jsonObj["keyToString"] as JObject;
|
||||||
if(content.Contains("rider.code.cleanup.on.save")){
|
if (keyToStringObj.ContainsKey("rider.code.cleanup.on.save")) return;
|
||||||
Console.WriteLine("alreay added");
|
|
||||||
return;
|
keyToStringObj.Add(new JProperty("rider.code.cleanup.on.save", "true"));
|
||||||
}
|
var newNode = xdoc.CreateCDataSection(jsonObj.ToString());
|
||||||
content = content.Replace(findStr, replaceStr);
|
propertiesComponent.InnerText=string.Empty;
|
||||||
Console.WriteLine(content);
|
propertiesComponent.AppendChild(newNode);
|
||||||
File.WriteAllText(path, content);
|
var settings = new XmlWriterSettings { Indent = true };
|
||||||
|
using(var writer = XmlWriter.Create(fs, settings)){
|
||||||
|
xdoc.WriteTo(writer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -13,5 +13,9 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<!-- <PackageReference Include="NSCodeAnalysis" Version="1.0.1-alpha.0.2">-->
|
||||||
|
<!-- <PrivateAssets>all</PrivateAssets>-->
|
||||||
|
<!-- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
|
||||||
|
<!-- </PackageReference>-->
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -1,10 +1,26 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<Authors>nsnail</Authors>
|
||||||
<BaseOutputPath>../dist</BaseOutputPath>
|
|
||||||
<BaseIntermediateOutputPath>../dist</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath>../dist</BaseIntermediateOutputPath>
|
||||||
<OutputPath>$(BaseOutputPath)/$(MSBuildProjectName)/bin</OutputPath>
|
<BaseOutputPath>../dist</BaseOutputPath>
|
||||||
|
<Copyright>© 2006-2023 nsnail</Copyright>
|
||||||
|
<Description>功能全面的实用工具 - 程序员的瑞士军刀</Description>
|
||||||
|
<EnableBaseIntermediateOutputPathMismatchWarning>false</EnableBaseIntermediateOutputPathMismatchWarning>
|
||||||
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)/$(MSBuildProjectName)/obj</IntermediateOutputPath>
|
<IntermediateOutputPath>$(BaseIntermediateOutputPath)/$(MSBuildProjectName)/obj</IntermediateOutputPath>
|
||||||
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)/$(MSBuildProjectName)/obj</MSBuildProjectExtensionsPath>
|
<MSBuildProjectExtensionsPath>$(BaseIntermediateOutputPath)/$(MSBuildProjectName)/obj</MSBuildProjectExtensionsPath>
|
||||||
|
<OutputPath>$(BaseOutputPath)/$(MSBuildProjectName)/bin</OutputPath>
|
||||||
|
<Product>dot</Product>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<RepositoryUrl>https://github.com/nsnail/dot.git</RepositoryUrl>
|
||||||
|
<RootNamespace>Dot</RootNamespace>
|
||||||
|
<Title>$(AssemblyName)</Title>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MinVer" Version="4.3.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -1,9 +1,9 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||||
<ItemGroup Condition="!Exists('$(ProjectDir)\Lang\Str.Designer.cs')">
|
<ItemGroup Condition="!Exists('$(ProjectDir)\Languages\Ln.Designer.cs')">
|
||||||
<Compile Include="$(ProjectDir)\Lang\Str.Designer.cs"/>
|
<Compile Include="$(ProjectDir)\Languages\Ln.Designer.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Exec Command="dotnet tool restore" StdOutEncoding="utf-8"/>
|
<Exec Command="dotnet tool restore" StdOutEncoding="utf-8" />
|
||||||
<Exec WorkingDirectory="$(ProjectDir)\Lang" Command="dotnet t4 Str.tt" StdOutEncoding="utf-8"/>
|
<Exec WorkingDirectory="$(ProjectDir)\Languages" Command="dotnet t4 Ln.tt" StdOutEncoding="utf-8" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
@ -3,219 +3,211 @@
|
|||||||
Description="StyleCop.Analyzers with default action. Rules with IsEnabledByDefault = false are disabled."
|
Description="StyleCop.Analyzers with default action. Rules with IsEnabledByDefault = false are disabled."
|
||||||
ToolsVersion="14.0">
|
ToolsVersion="14.0">
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpecialRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpecialRules">
|
||||||
<Rule Id="SA0001" Action="Warning"/> <!-- XML comment analysis disabled -->
|
<Rule Id="SA0001" Action="Warning" /> <!-- XML comment analysis disabled -->
|
||||||
<Rule Id="SA0002" Action="Warning"/> <!-- Invalid settings file -->
|
<Rule Id="SA0002" Action="Warning" /> <!-- Invalid settings file -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpacingRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpacingRules">
|
||||||
<Rule Id="SA1000" Action="Warning"/> <!-- Keywords should be spaced correctly -->
|
<Rule Id="SA1000" Action="Warning" /> <!-- Keywords should be spaced correctly -->
|
||||||
<Rule Id="SA1001" Action="None"/> <!-- Commas 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="SA1002" Action="Warning" /> <!-- Semicolons should be spaced correctly -->
|
||||||
<Rule Id="SA1003" Action="Warning"/> <!-- Symbols 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="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="SA1005" Action="Warning" /> <!-- Single line comments should begin with single space -->
|
||||||
<Rule Id="SA1006" Action="Warning"/> <!-- Preprocessor keywords should not be preceded by 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="SA1007" Action="Warning" /> <!-- Operator keyword should be followed by space -->
|
||||||
<Rule Id="SA1008" Action="None"/> <!-- Opening parenthesis should be spaced correctly -->
|
<Rule Id="SA1008" Action="None" /> <!-- Opening parenthesis should be spaced correctly -->
|
||||||
<Rule Id="SA1009" Action="Warning"/> <!-- Closing 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="SA1010" Action="Warning" /> <!-- Opening square brackets should be spaced correctly -->
|
||||||
<Rule Id="SA1011" Action="Warning"/> <!-- Closing 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="SA1012" Action="Warning" /> <!-- Opening braces should be spaced correctly -->
|
||||||
<Rule Id="SA1013" Action="Warning"/> <!-- Closing 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="SA1014" Action="Warning" /> <!-- Opening generic brackets should be spaced correctly -->
|
||||||
<Rule Id="SA1015" Action="Warning"/> <!-- Closing 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="SA1016" Action="Warning" /> <!-- Opening attribute brackets should be spaced correctly -->
|
||||||
<Rule Id="SA1017" Action="Warning"/> <!-- Closing 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="SA1018" Action="Warning" /> <!-- Nullable type symbols should be spaced correctly -->
|
||||||
<Rule Id="SA1019" Action="Warning"/> <!-- Member access 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="SA1020" Action="Warning" /> <!-- Increment decrement symbols should be spaced correctly -->
|
||||||
<Rule Id="SA1021" Action="Warning"/> <!-- Negative signs 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="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="SA1023" Action="Warning" /> <!-- Dereference and access of symbols should be spaced correctly -->
|
||||||
<Rule Id="SA1024" Action="Warning"/> <!-- Colons 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="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="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="SA1027" Action="Warning" /> <!-- Use tabs correctly -->
|
||||||
<Rule Id="SA1028" Action="Warning"/> <!-- Code should not contain trailing whitespace -->
|
<Rule Id="SA1028" Action="Warning" /> <!-- Code should not contain trailing whitespace -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.ReadabilityRules">
|
<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="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="SA1101" Action="None" /> <!-- Prefix local calls with this -->
|
||||||
<Rule Id="SA1102" Action="Warning"/> <!-- Query clause should follow previous clause -->
|
<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="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="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="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="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="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="SA1108" Action="Warning" /> <!-- Block statements should not contain embedded comments -->
|
||||||
<Rule Id="SA1109" Action="Warning"/> <!-- Block statements should not contain embedded regions -->
|
<Rule Id="SA1109" Action="Warning" /> <!-- Block statements should not contain embedded regions -->
|
||||||
<Rule Id="SA1110" Action="Warning"/> <!-- Opening parenthesis or bracket should be on declaration line -->
|
<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="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="SA1112" Action="Warning" /> <!-- Closing parenthesis should be on line of opening parenthesis -->
|
||||||
<Rule Id="SA1113" Action="None"/> <!-- Comma should be on the same line as previous parameter -->
|
<Rule Id="SA1113" Action="None" /> <!-- Comma should be on the same line as previous parameter -->
|
||||||
<Rule Id="SA1114" Action="Warning"/> <!-- Parameter list should follow declaration -->
|
<Rule Id="SA1114" Action="Warning" /> <!-- Parameter list should follow declaration -->
|
||||||
<Rule Id="SA1115" Action="Warning"/> <!-- Parameter should follow comma -->
|
<Rule Id="SA1115" Action="Warning" /> <!-- Parameter should follow comma -->
|
||||||
<Rule Id="SA1116" Action="Warning"/> <!-- Split parameters should start on line after declaration -->
|
<Rule Id="SA1116" Action="Warning" /> <!-- Split parameters should start on line after declaration -->
|
||||||
<Rule Id="SA1117" Action="None"/> <!-- Parameters should be on same line or separate lines -->
|
<Rule Id="SA1117" Action="None" /> <!-- Parameters should be on same line or separate lines -->
|
||||||
<Rule Id="SA1118" Action="Warning"/> <!-- Parameter should not span multiple lines -->
|
<Rule Id="SA1118" Action="Warning" /> <!-- Parameter should not span multiple lines -->
|
||||||
<Rule Id="SA1120" Action="None"/> <!-- Comments should contain text -->
|
<Rule Id="SA1120" Action="None" /> <!-- Comments should contain text -->
|
||||||
<Rule Id="SA1121" Action="Warning"/> <!-- Use built-in type alias -->
|
<Rule Id="SA1121" Action="Warning" /> <!-- Use built-in type alias -->
|
||||||
<Rule Id="SA1122" Action="Warning"/> <!-- Use string.Empty for empty strings -->
|
<Rule Id="SA1122" Action="Warning" /> <!-- Use string.Empty for empty strings -->
|
||||||
<Rule Id="SA1123" Action="Warning"/> <!-- Do not place regions within elements -->
|
<Rule Id="SA1123" Action="Warning" /> <!-- Do not place regions within elements -->
|
||||||
<Rule Id="SA1124" Action="Warning"/> <!-- Do not use regions -->
|
<Rule Id="SA1124" Action="Warning" /> <!-- Do not use regions -->
|
||||||
<Rule Id="SA1125" Action="Warning"/> <!-- Use shorthand for nullable types -->
|
<Rule Id="SA1125" Action="Warning" /> <!-- Use shorthand for nullable types -->
|
||||||
<Rule Id="SA1126" Action="Warning"/> <!-- Prefix calls correctly -->
|
<Rule Id="SA1126" Action="Warning" /> <!-- Prefix calls correctly -->
|
||||||
<Rule Id="SA1127" Action="Warning"/> <!-- Generic type constraints should be on their own line -->
|
<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="SA1128" Action="Warning" /> <!-- Put constructor initializers on their own line -->
|
||||||
<Rule Id="SA1129" Action="Warning"/> <!-- Do not use default value type constructor -->
|
<Rule Id="SA1129" Action="Warning" /> <!-- Do not use default value type constructor -->
|
||||||
<Rule Id="SA1130" Action="Warning"/> <!-- Use lambda syntax -->
|
<Rule Id="SA1130" Action="Warning" /> <!-- Use lambda syntax -->
|
||||||
<Rule Id="SA1131" Action="Warning"/> <!-- Use readable conditions -->
|
<Rule Id="SA1131" Action="Warning" /> <!-- Use readable conditions -->
|
||||||
<Rule Id="SA1132" Action="Warning"/> <!-- Do not combine fields -->
|
<Rule Id="SA1132" Action="Warning" /> <!-- Do not combine fields -->
|
||||||
<Rule Id="SA1133" Action="Warning"/> <!-- Do not combine attributes -->
|
<Rule Id="SA1133" Action="Warning" /> <!-- Do not combine attributes -->
|
||||||
<Rule Id="SA1134" Action="None"/> <!-- Attributes should not share line -->
|
<Rule Id="SA1134" Action="Warning" /> <!-- Attributes should not share line -->
|
||||||
<Rule Id="SA1135" Action="Warning"/> <!-- Using directives should be qualified -->
|
<Rule Id="SA1135" Action="Warning" /> <!-- Using directives should be qualified -->
|
||||||
<Rule Id="SA1136" Action="Warning"/> <!-- Enum values should be on separate lines -->
|
<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="SA1137" Action="Warning" /> <!-- Elements should have the same indentation -->
|
||||||
<Rule Id="SA1139" Action="Warning"/> <!-- Use literal suffix notation instead of casting -->
|
<Rule Id="SA1139" Action="Warning" /> <!-- Use literal suffix notation instead of casting -->
|
||||||
<Rule Id="SX1101" Action="Warning"/> <!-- Do not prefix local calls with 'this.' -->
|
<Rule Id="SX1101" Action="Warning" /> <!-- Do not prefix local calls with 'this.' -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.OrderingRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.OrderingRules">
|
||||||
<Rule Id="SA1200" Action="None"/> <!-- Using directives should be placed correctly -->
|
<Rule Id="SA1200" Action="None" /> <!-- Using directives should be placed correctly -->
|
||||||
<Rule Id="SA1201" Action="Warning"/> <!-- Elements should appear in the correct order -->
|
<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="SA1202" Action="Warning" /> <!-- Elements should be ordered by access -->
|
||||||
<Rule Id="SA1203" Action="Warning"/> <!-- Constants should appear before fields -->
|
<Rule Id="SA1203" Action="Warning" /> <!-- Constants should appear before fields -->
|
||||||
<Rule Id="SA1204" Action="Warning"/> <!-- Static elements should appear before instance elements -->
|
<Rule Id="SA1204" Action="Warning" /> <!-- Static elements should appear before instance elements -->
|
||||||
<Rule Id="SA1205" Action="Warning"/> <!-- Partial elements should declare access -->
|
<Rule Id="SA1205" Action="Warning" /> <!-- Partial elements should declare access -->
|
||||||
<Rule Id="SA1206" Action="Warning"/> <!-- Declaration keywords should follow order -->
|
<Rule Id="SA1206" Action="Warning" /> <!-- Declaration keywords should follow order -->
|
||||||
<Rule Id="SA1207" Action="Warning"/> <!-- Protected should come before internal -->
|
<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="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="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="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="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="SA1212" Action="Warning" /> <!-- Property accessors should follow order -->
|
||||||
<Rule Id="SA1213" Action="Warning"/> <!-- Event 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="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="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 -->
|
<Rule Id="SA1217" Action="Warning" /> <!-- Using static directives should be ordered alphabetically -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.NamingRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.NamingRules">
|
||||||
<Rule Id="SA1300" Action="Warning"/> <!-- Element should begin with upper-case letter -->
|
<Rule Id="SA1300" Action="Warning" /> <!-- Element should begin with upper-case letter -->
|
||||||
<Rule Id="SA1301" Action="Warning"/> <!-- Element should begin with lower-case letter -->
|
<Rule Id="SA1301" Action="Warning" /> <!-- Element should begin with lower-case letter -->
|
||||||
<Rule Id="SA1302" Action="Warning"/> <!-- Interface names should begin with I -->
|
<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="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="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="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="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="SA1307" Action="Warning" /> <!-- Accessible fields should begin with upper-case letter -->
|
||||||
<Rule Id="SA1308" Action="Warning"/> <!-- Variable names should not be prefixed -->
|
<Rule Id="SA1308" Action="Warning" /> <!-- Variable names should not be prefixed -->
|
||||||
<Rule Id="SA1309" Action="None"/> <!-- Field names should not begin with underscore -->
|
<Rule Id="SA1309" Action="None" /> <!-- Field names should not begin with underscore -->
|
||||||
<Rule Id="SA1310" Action="None"/> <!-- Field names should not contain 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="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="SA1312" Action="Warning" /> <!-- Variable names should begin with lower-case letter -->
|
||||||
<Rule Id="SA1313" Action="None"/> <!-- Parameter 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="SA1314" Action="Warning" /> <!-- Type parameter names should begin with T -->
|
||||||
<Rule Id="SX1309" Action="Warning"/> <!-- Field names should begin with underscore -->
|
<Rule Id="SX1309" Action="Warning" /> <!-- Field names should begin with underscore -->
|
||||||
<Rule Id="SX1309S" Action="Warning"/> <!-- Static field names should begin with underscore -->
|
<Rule Id="SX1309S" Action="Warning" /> <!-- Static field names should begin with underscore -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.MaintainabilityRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.MaintainabilityRules">
|
||||||
<Rule Id="SA1119" Action="Warning"/> <!-- Statement should not use unnecessary parenthesis -->
|
<Rule Id="SA1119" Action="Warning" /> <!-- Statement should not use unnecessary parenthesis -->
|
||||||
<Rule Id="SA1400" Action="Warning"/> <!-- Access modifier should be declared -->
|
<Rule Id="SA1400" Action="Warning" /> <!-- Access modifier should be declared -->
|
||||||
<Rule Id="SA1401" Action="Warning"/> <!-- Fields should be private -->
|
<Rule Id="SA1401" Action="Warning" /> <!-- Fields should be private -->
|
||||||
<Rule Id="SA1402" Action="Warning"/> <!-- File may only contain a single type -->
|
<Rule Id="SA1402" Action="None" /> <!-- File may only contain a single type -->
|
||||||
<Rule Id="SA1403" Action="Warning"/> <!-- File may only contain a single namespace -->
|
<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="SA1404" Action="Warning" /> <!-- Code analysis suppression should have justification -->
|
||||||
<Rule Id="SA1405" Action="Warning"/> <!-- Debug.Assert should provide message text -->
|
<Rule Id="SA1405" Action="Warning" /> <!-- Debug.Assert should provide message text -->
|
||||||
<Rule Id="SA1406" Action="Warning"/> <!-- Debug.Fail should provide message text -->
|
<Rule Id="SA1406" Action="Warning" /> <!-- Debug.Fail should provide message text -->
|
||||||
<Rule Id="SA1407" Action="None"/> <!-- Arithmetic expressions should declare precedence -->
|
<Rule Id="SA1407" Action="None" /> <!-- Arithmetic expressions should declare precedence -->
|
||||||
<Rule Id="SA1408" Action="Warning"/> <!-- Conditional expressions should declare precedence -->
|
<Rule Id="SA1408" Action="Warning" /> <!-- Conditional expressions should declare precedence -->
|
||||||
<Rule Id="SA1409" Action="Warning"/> <!-- Remove unnecessary code -->
|
<Rule Id="SA1409" Action="Warning" /> <!-- Remove unnecessary code -->
|
||||||
<Rule Id="SA1410" Action="Warning"/> <!-- Remove delegate parenthesis when possible -->
|
<Rule Id="SA1410" Action="Warning" /> <!-- Remove delegate parenthesis when possible -->
|
||||||
<Rule Id="SA1411" Action="Warning"/> <!-- Attribute constructor should not use unnecessary parenthesis -->
|
<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="SA1412" Action="None" /> <!-- Store files as UTF-8 with byte order mark -->
|
||||||
<Rule Id="SA1413" Action="None"/> <!-- Use trailing comma in multi-line initializers -->
|
<Rule Id="SA1413" Action="None" /> <!-- Use trailing comma in multi-line initializers -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.LayoutRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.LayoutRules">
|
||||||
<Rule Id="SA1500" Action="None"/> <!-- Braces for multi-line statements should not share line -->
|
<Rule Id="SA1500" Action="None" /> <!-- Braces for multi-line statements should not share line -->
|
||||||
<Rule Id="SA1501" Action="Warning"/> <!-- Statement should not be on a single line -->
|
<Rule Id="SA1501" Action="Warning" /> <!-- Statement should not be on a single line -->
|
||||||
<Rule Id="SA1502" Action="None"/> <!-- Element should not be on a single line -->
|
<Rule Id="SA1502" Action="None" /> <!-- Element should not be on a single line -->
|
||||||
<Rule Id="SA1503" Action="None"/> <!-- Braces should not be omitted -->
|
<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="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="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="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="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="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="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="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="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="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="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="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="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="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="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="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="SA1519" Action="Warning" /> <!-- Braces should not be omitted from multi-line child statement -->
|
||||||
<Rule Id="SA1520" Action="Warning"/> <!-- Use braces consistently -->
|
<Rule Id="SA1520" Action="Warning" /> <!-- Use braces consistently -->
|
||||||
</Rules>
|
</Rules>
|
||||||
|
|
||||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.DocumentationRules">
|
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.DocumentationRules">
|
||||||
<Rule Id="SA1600" Action="None"/> <!-- Elements should be documented -->
|
<Rule Id="SA1600" Action="None" /> <!-- Elements should be documented -->
|
||||||
<Rule Id="SA1601" Action="None"/> <!-- Partial elements should be documented -->
|
<Rule Id="SA1601" Action="None" /> <!-- Partial elements should be documented -->
|
||||||
<Rule Id="SA1602" Action="None"/> <!-- Enumeration items should be documented -->
|
<Rule Id="SA1602" Action="None" /> <!-- Enumeration items should be documented -->
|
||||||
<Rule Id="SA1603" Action="Warning"/> <!-- Documentation should contain valid XML -->
|
<Rule Id="SA1603" Action="Warning" /> <!-- Documentation should contain valid XML -->
|
||||||
<Rule Id="SA1604" Action="Warning"/> <!-- Element documentation should have summary -->
|
<Rule Id="SA1604" Action="Warning" /> <!-- Element documentation should have summary -->
|
||||||
<Rule Id="SA1605" Action="Warning"/> <!-- Partial 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="SA1606" Action="Warning" /> <!-- Element documentation should have summary text -->
|
||||||
<Rule Id="SA1607" Action="Warning"/> <!-- Partial 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="SA1608" Action="Warning" /> <!-- Element documentation should not have default summary -->
|
||||||
<Rule Id="SA1609" Action="Warning"/> <!-- Property documentation should have value -->
|
<Rule Id="SA1609" Action="None" /> <!-- Property documentation should have value -->
|
||||||
<Rule Id="SA1610" Action="Warning"/> <!-- Property documentation should have value text -->
|
<Rule Id="SA1610" Action="Warning" /> <!-- Property documentation should have value text -->
|
||||||
<Rule Id="SA1611" Action="None"/> <!-- Element parameters should be documented -->
|
<Rule Id="SA1611" Action="None" /> <!-- Element parameters should be documented -->
|
||||||
<Rule Id="SA1612" Action="Warning"/> <!-- Element parameter documentation should match element parameters -->
|
<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="SA1613" Action="Warning" /> <!-- Element parameter documentation should declare parameter name -->
|
||||||
<Rule Id="SA1614" Action="Warning"/> <!-- Element parameter documentation should have text -->
|
<Rule Id="SA1614" Action="Warning" /> <!-- Element parameter documentation should have text -->
|
||||||
<Rule Id="SA1615" Action="None"/> <!-- Element return value should be documented -->
|
<Rule Id="SA1615" Action="None" /> <!-- Element return value should be documented -->
|
||||||
<Rule Id="SA1616" Action="Warning"/> <!-- Element return value documentation should have text -->
|
<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="SA1617" Action="Warning" /> <!-- Void return value should not be documented -->
|
||||||
<Rule Id="SA1618" Action="None"/> <!-- Generic type parameters should be documented -->
|
<Rule Id="SA1618" Action="None" /> <!-- Generic type parameters should be documented -->
|
||||||
<Rule Id="SA1619" Action="None"/> <!-- Generic type parameters should be documented partial class -->
|
<Rule Id="SA1619" Action="None" /> <!-- Generic type parameters should be documented partial class -->
|
||||||
<Rule Id="SA1620" Action="Warning"/> <!-- Generic type parameter documentation should match type parameters -->
|
<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="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="SA1622" Action="Warning" /> <!-- Generic type parameter documentation should have text -->
|
||||||
<Rule Id="SA1623" Action="Warning"/> <!-- Property summary documentation should match accessors -->
|
<Rule Id="SA1623" Action="None" /> <!-- Property summary documentation should match accessors -->
|
||||||
<Rule Id="SA1624" Action="Warning"/> <!-- Property summary documentation should omit accessor with restricted access -->
|
<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="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="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="SA1627" Action="Warning" /> <!-- Documentation text should not be empty -->
|
||||||
<Rule Id="SA1628" Action="Warning"/> <!-- Documentation text should begin with a capital letter -->
|
<Rule Id="SA1628" Action="Warning" /> <!-- Documentation text should begin with a capital letter -->
|
||||||
<Rule Id="SA1629" Action="Warning"/> <!-- Documentation text should end with a period -->
|
<Rule Id="SA1629" Action="None" /> <!-- Documentation text should end with a period -->
|
||||||
<Rule Id="SA1630" Action="Warning"/> <!-- Documentation text should contain whitespace -->
|
<Rule Id="SA1630" Action="Warning" /> <!-- Documentation text should contain whitespace -->
|
||||||
<Rule Id="SA1631" Action="Warning"/> <!-- Documentation should meet character percentage -->
|
<Rule Id="SA1631" Action="Warning" /> <!-- Documentation should meet character percentage -->
|
||||||
<Rule Id="SA1632" Action="Warning"/> <!-- Documentation text should meet minimum character length -->
|
<Rule Id="SA1632" Action="Warning" /> <!-- Documentation text should meet minimum character length -->
|
||||||
<Rule Id="SA1633" Action="None"/> <!-- File should have header -->
|
<Rule Id="SA1633" Action="None" /> <!-- File should have header -->
|
||||||
<Rule Id="SA1634" Action="Warning"/> <!-- File header should show copyright -->
|
<Rule Id="SA1634" Action="Warning" /> <!-- File header should show copyright -->
|
||||||
<Rule Id="SA1635" Action="Warning"/> <!-- File header should have copyright text -->
|
<Rule Id="SA1635" Action="Warning" /> <!-- File header should have copyright text -->
|
||||||
<Rule Id="SA1636" Action="Warning"/> <!-- File header copyright text should match -->
|
<Rule Id="SA1636" Action="Warning" /> <!-- File header copyright text should match -->
|
||||||
<Rule Id="SA1637" Action="Warning"/> <!-- File header should contain file name -->
|
<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="SA1638" Action="Warning" /> <!-- File header file name documentation should match file name -->
|
||||||
<Rule Id="SA1639" Action="Warning"/> <!-- File header should have summary -->
|
<Rule Id="SA1639" Action="Warning" /> <!-- File header should have summary -->
|
||||||
<Rule Id="SA1640" Action="Warning"/> <!-- File header should have valid company text -->
|
<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="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="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="SA1643" Action="Warning" /> <!-- Destructor summary documentation should begin with standard text -->
|
||||||
<Rule Id="SA1644" Action="Warning"/> <!-- Documentation headers should not contain blank lines -->
|
<Rule Id="SA1644" Action="Warning" /> <!-- Documentation headers should not contain blank lines -->
|
||||||
<Rule Id="SA1645" Action="Warning"/> <!-- Included documentation file does not exist -->
|
<Rule Id="SA1645" Action="Warning" /> <!-- Included documentation file does not exist -->
|
||||||
<Rule Id="SA1646" Action="Warning"/> <!-- Included documentation XPath does not exist -->
|
<Rule Id="SA1646" Action="Warning" /> <!-- Included documentation XPath does not exist -->
|
||||||
<Rule Id="SA1647" Action="Warning"/> <!-- Include node does not contain valid file and path -->
|
<Rule Id="SA1647" Action="Warning" /> <!-- Include node does not contain valid file and path -->
|
||||||
<Rule Id="SA1648" Action="Warning"/> <!-- Inheritdoc should be used with inheriting class -->
|
<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="SA1649" Action="Warning" /> <!-- File name should match first type name -->
|
||||||
<Rule Id="SA1650" Action="Warning"/> <!-- Element documentation should be spelled correctly -->
|
<Rule Id="SA1650" Action="Warning" /> <!-- Element documentation should be spelled correctly -->
|
||||||
<Rule Id="SA1651" Action="Warning"/> <!-- Do not use placeholder elements -->
|
<Rule Id="SA1651" Action="Warning" /> <!-- Do not use placeholder elements -->
|
||||||
|
|
||||||
</Rules>
|
</Rules>
|
||||||
</RuleSet>
|
</RuleSet>
|
@ -6,7 +6,7 @@ var slnFile = Directory.GetFiles(@".", "*.sln").First();
|
|||||||
$"""
|
$"""
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
{string.Join('\n',
|
{string.Join('\n',
|
||||||
Directory.GetFiles(@".", "*").Where(x => !x.EndsWith(".sln"))
|
Directory.GetFiles(@".", "*").Where(x => !x.EndsWith(".sln") && !x.EndsWith(".user"))
|
||||||
.Select(x=>$"\t\t{Path.GetFileName(x)} = {Path.GetFileName(x)}"))}
|
.Select(x=>$"\t\t{Path.GetFileName(x)} = {Path.GetFileName(x)}"))}
|
||||||
{'\t'}EndProjectSection
|
{'\t'}EndProjectSection
|
||||||
""");
|
""");
|
4
dot.sln
4
dot.sln
@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{AD79881E-7
|
|||||||
.gitattributes = .gitattributes
|
.gitattributes = .gitattributes
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
.tgitconfig = .tgitconfig
|
.tgitconfig = .tgitconfig
|
||||||
AddMetaFilesToSln.csx = AddMetaFilesToSln.csx
|
|
||||||
build.cake = build.cake
|
build.cake = build.cake
|
||||||
code-format.cmd = code-format.cmd
|
code-format.cmd = code-format.cmd
|
||||||
CodeCleanupOnSave.csx = CodeCleanupOnSave.csx
|
CodeCleanupOnSave.csx = CodeCleanupOnSave.csx
|
||||||
@ -31,7 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{AD79881E-7
|
|||||||
StyleCopAnalyzers.ruleset = StyleCopAnalyzers.ruleset
|
StyleCopAnalyzers.ruleset = StyleCopAnalyzers.ruleset
|
||||||
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.nsext.json = switcher.nsext.json
|
||||||
|
SyncMetaFiles.csx = SyncMetaFiles.csx
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{15EF00AD-DFA8-4BE2-985E-85DA8092CB2F}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests", "tests\tests.csproj", "{15EF00AD-DFA8-4BE2-985E-85DA8092CB2F}"
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
<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">
|
<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">
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedAutoPropertyAccessor_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedAutoPropertyAccessor_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_RECORD_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
<s:Boolean x:Key="/Default/ReSpeller/ReSpellerEnabled/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/ReSpeller/ReSpellerEnabled/@EntryValue">False</s:Boolean>
|
||||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
|
||||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
||||||
|
@ -4,8 +4,8 @@ using System.Runtime.Versioning;
|
|||||||
|
|
||||||
namespace Dot.Color;
|
namespace Dot.Color;
|
||||||
|
|
||||||
[Description(nameof(Str.ScreenPixelTool))]
|
[Description(nameof(Ln.ScreenPixelTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
||||||
|
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
|
@ -9,30 +9,30 @@ namespace Dot.Color;
|
|||||||
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
||||||
internal sealed class WinInfo : Form
|
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; // 缩放倍率
|
||||||
private readonly Graphics _graphics;
|
private readonly Graphics _graphics;
|
||||||
private readonly PictureBox _pbox;
|
private readonly PictureBox _pbox;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
public WinInfo()
|
public WinInfo()
|
||||||
{
|
{
|
||||||
FormBorderStyle = FormBorderStyle.None;
|
FormBorderStyle = FormBorderStyle.None;
|
||||||
TopMost = true;
|
TopMost = true;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
Size = new Size(_WINDOW_SIZE, _WINDOW_SIZE);
|
Size = new Size(_WINDOW_SIZE, _WINDOW_SIZE);
|
||||||
StartPosition = FormStartPosition.Manual;
|
StartPosition = FormStartPosition.Manual;
|
||||||
Location = new Point(0, 0);
|
Location = new Point(0, 0);
|
||||||
_pbox = new PictureBox();
|
_pbox = new PictureBox();
|
||||||
_pbox.Location = new Point(0, 0);
|
_pbox.Location = new Point(0, 0);
|
||||||
_pbox.Size = Size;
|
_pbox.Size = Size;
|
||||||
_pbox.Image = new Bitmap(_WINDOW_SIZE, _WINDOW_SIZE);
|
_pbox.Image = new Bitmap(_WINDOW_SIZE, _WINDOW_SIZE);
|
||||||
_graphics = Graphics.FromImage(_pbox.Image);
|
_graphics = Graphics.FromImage(_pbox.Image);
|
||||||
_graphics.InterpolationMode = InterpolationMode.NearestNeighbor; //指定最临近插值法,禁止平滑缩放(模糊)
|
_graphics.InterpolationMode = InterpolationMode.NearestNeighbor; // 指定最临近插值法,禁止平滑缩放(模糊)
|
||||||
_graphics.CompositingQuality = CompositingQuality.HighQuality;
|
_graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||||
_graphics.SmoothingMode = SmoothingMode.None;
|
_graphics.SmoothingMode = SmoothingMode.None;
|
||||||
_pbox.MouseEnter += PboxOnMouseEnter;
|
_pbox.MouseEnter += PboxOnMouseEnter;
|
||||||
Controls.Add(_pbox);
|
Controls.Add(_pbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,13 +46,13 @@ internal sealed class WinInfo : Form
|
|||||||
// 计算复制小图的区域
|
// 计算复制小图的区域
|
||||||
var copySize = new Size(_WINDOW_SIZE / _ZOOM_RATE, _WINDOW_SIZE / _ZOOM_RATE);
|
var copySize = new Size(_WINDOW_SIZE / _ZOOM_RATE, _WINDOW_SIZE / _ZOOM_RATE);
|
||||||
_graphics.DrawImage(img, new Rectangle(0, 0, _WINDOW_SIZE, _WINDOW_SIZE) //
|
_graphics.DrawImage(img, new Rectangle(0, 0, _WINDOW_SIZE, _WINDOW_SIZE) //
|
||||||
, x - copySize.Width / 2 // 左移x,使光标位置居中
|
, x - copySize.Width / 2 // 左移x,使光标位置居中
|
||||||
, y - copySize.Height / 2 // 上移y,使光标位置居中
|
, y - copySize.Height / 2 // 上移y,使光标位置居中
|
||||||
, copySize.Width, copySize.Height, GraphicsUnit.Pixel);
|
, copySize.Width, copySize.Height, GraphicsUnit.Pixel);
|
||||||
using var pen = new Pen(System.Drawing.Color.Aqua); //绘制准星
|
using var pen = new Pen(System.Drawing.Color.Aqua); // 绘制准星
|
||||||
_graphics.DrawRectangle(pen, _WINDOW_SIZE / 2 - _ZOOM_RATE / 2 //
|
_graphics.DrawRectangle(pen, _WINDOW_SIZE / 2 - _ZOOM_RATE / 2 //
|
||||||
, _WINDOW_SIZE / 2 - _ZOOM_RATE / 2 //
|
, _WINDOW_SIZE / 2 - _ZOOM_RATE / 2 //
|
||||||
, _ZOOM_RATE, _ZOOM_RATE);
|
, _ZOOM_RATE, _ZOOM_RATE);
|
||||||
|
|
||||||
// 取鼠标位置颜色
|
// 取鼠标位置颜色
|
||||||
var posColor = img.GetPixel(x, y);
|
var posColor = img.GetPixel(x, y);
|
||||||
@ -60,9 +60,9 @@ internal sealed class WinInfo : Form
|
|||||||
// 绘制底部文字信息
|
// 绘制底部文字信息
|
||||||
_graphics.FillRectangle(Brushes.Black, 0, _WINDOW_SIZE - 30, _WINDOW_SIZE, 30);
|
_graphics.FillRectangle(Brushes.Black, 0, _WINDOW_SIZE - 30, _WINDOW_SIZE, 30);
|
||||||
_graphics.DrawString( //
|
_graphics.DrawString( //
|
||||||
$"{Str.ClickCopyColor} X: {x} Y: {y} RGB({posColor.R},{posColor.G},{posColor.B})"
|
$"{Ln.ClickCopyColor} X: {x} Y: {y} RGB({posColor.R},{posColor.G},{posColor.B})"
|
||||||
, new Font(FontFamily.GenericSerif, 10) //
|
, new Font(FontFamily.GenericSerif, 10) //
|
||||||
, Brushes.White, 0, _WINDOW_SIZE - 20);
|
, Brushes.White, 0, _WINDOW_SIZE - 20);
|
||||||
|
|
||||||
// 触发重绘
|
// 触发重绘
|
||||||
_pbox.Refresh();
|
_pbox.Refresh();
|
||||||
|
@ -10,7 +10,7 @@ namespace Dot.Color;
|
|||||||
internal sealed class WinMain : Form
|
internal sealed class WinMain : Form
|
||||||
{
|
{
|
||||||
private readonly Bitmap _bmp;
|
private readonly Bitmap _bmp;
|
||||||
private readonly WinInfo _winInfo = new(); //小图窗口
|
private readonly WinInfo _winInfo = new(); // 小图窗口
|
||||||
|
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
@ -20,11 +20,11 @@ internal sealed class WinMain : Form
|
|||||||
Win32.ShowWindow(Win32.GetConsoleWindow(), Win32.SW_HIDE);
|
Win32.ShowWindow(Win32.GetConsoleWindow(), Win32.SW_HIDE);
|
||||||
|
|
||||||
FormBorderStyle = FormBorderStyle.None;
|
FormBorderStyle = FormBorderStyle.None;
|
||||||
Size = Screen.PrimaryScreen!.Bounds.Size;
|
Size = Screen.PrimaryScreen!.Bounds.Size;
|
||||||
StartPosition = FormStartPosition.Manual;
|
StartPosition = FormStartPosition.Manual;
|
||||||
Location = new Point(0, 0);
|
Location = new Point(0, 0);
|
||||||
Opacity = 0.01d; //主窗体加载截图过程设置为透明避免闪烁
|
Opacity = 0.01d; // 主窗体加载截图过程设置为透明避免闪烁
|
||||||
_bmp = new Bitmap(Size.Width, Size.Height);
|
_bmp = new Bitmap(Size.Width, Size.Height);
|
||||||
using var g = Graphics.FromImage(_bmp);
|
using var g = Graphics.FromImage(_bmp);
|
||||||
g.CopyFromScreen(0, 0, 0, 0, Size);
|
g.CopyFromScreen(0, 0, 0, 0, Size);
|
||||||
}
|
}
|
||||||
|
@ -5,31 +5,31 @@ namespace Dot;
|
|||||||
internal class DirOption : OptionBase
|
internal class DirOption : OptionBase
|
||||||
{
|
{
|
||||||
[CommandOption("-e|--exclude")]
|
[CommandOption("-e|--exclude")]
|
||||||
[Description(nameof(Str.ExcludePathRegexes))]
|
[Description(nameof(Ln.ExcludePathRegexes))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
public IEnumerable<string> ExcludeRegexes { get; set; }
|
public IEnumerable<string> ExcludeRegexes { get; set; }
|
||||||
|
|
||||||
[CommandOption("-f|--filter")]
|
[CommandOption("-f|--filter")]
|
||||||
[Description(nameof(Str.FileSearchPattern))]
|
[Description(nameof(Ln.FileSearchPattern))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.MaxRecursionDepth))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.FolderPath))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(".")]
|
[DefaultValue(".")]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
[CommandOption("-w|--write")]
|
[CommandOption("-w|--write")]
|
||||||
[Description(nameof(Str.WriteMode))]
|
[Description(nameof(Ln.WriteMode))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool WriteMode { get; set; }
|
public bool WriteMode { get; set; }
|
||||||
}
|
}
|
@ -10,14 +10,14 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
where TOption : DirOption
|
where TOption : DirOption
|
||||||
{
|
{
|
||||||
// ReSharper disable once StaticMemberInGenericType
|
// ReSharper disable once StaticMemberInGenericType
|
||||||
private static readonly object _lock = new(); //线程锁
|
private static readonly object _lock = new(); // 线程锁
|
||||||
private readonly ConcurrentDictionary<string, int> _writeStats = new(); //写入统计:后缀,数量
|
private readonly ConcurrentDictionary<string, int> _writeStats = new(); // 写入统计:后缀,数量
|
||||||
private int _breakCnt; //跳过文件数
|
private int _breakCnt; // 跳过文件数
|
||||||
private ProgressTask _childTask; //子任务进度
|
private ProgressTask _childTask; // 子任务进度
|
||||||
private int _excludeCnt; //排除文件数
|
private int _excludeCnt; // 排除文件数
|
||||||
private int _readCnt; //读取文件数
|
private int _readCnt; // 读取文件数
|
||||||
private int _totalCnt; //总文件数
|
private int _totalCnt; // 总文件数
|
||||||
private int _writeCnt; //写入文件数
|
private int _writeCnt; // 写入文件数
|
||||||
|
|
||||||
protected static FileStream CreateTempFile(out string file)
|
protected static FileStream CreateTempFile(out string file)
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
{
|
{
|
||||||
return !Directory.Exists(Opt.Path)
|
return !Directory.Exists(Opt.Path)
|
||||||
? throw new ArgumentException( //
|
? throw new ArgumentException( //
|
||||||
nameof(Opt.Path), string.Format(CultureInfo.InvariantCulture, Str.PathNotFound, Opt.Path))
|
nameof(Opt.Path), string.Format(CultureInfo.InvariantCulture, Ln.PathNotFound, Opt.Path))
|
||||||
: CoreInternal();
|
: CoreInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
}
|
}
|
||||||
|
|
||||||
_childTask.Description
|
_childTask.Description
|
||||||
= $"{Str.Read}: [green]{_readCnt}[/]/{_totalCnt}, {Str.Write}: [red]{_writeCnt}[/], {Str.Break}: [gray]{_breakCnt}[/], {Str.Exclude}: [yellow]{_excludeCnt}[/]";
|
= $"{Ln.Read}: [green]{_readCnt}[/]/{_totalCnt}, {Ln.Write}: [red]{_writeCnt}[/], {Ln.Break}: [gray]{_breakCnt}[/], {Ln.Exclude}: [yellow]{_excludeCnt}[/]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
private async Task CoreInternal()
|
private async Task CoreInternal()
|
||||||
{
|
{
|
||||||
if (!Opt.WriteMode) {
|
if (!Opt.WriteMode) {
|
||||||
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, "[gray]{0}[/]", Str.ExerciseMode);
|
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, "[gray]{0}[/]", Ln.ExerciseMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<string> fileList;
|
IEnumerable<string> fileList;
|
||||||
@ -93,7 +93,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
, new SpinnerColumn() //
|
, new SpinnerColumn() //
|
||||||
, new TaskDescriptionColumn { Alignment = Justify.Left }) //
|
, new TaskDescriptionColumn { Alignment = Justify.Left }) //
|
||||||
.StartAsync(async ctx => {
|
.StartAsync(async ctx => {
|
||||||
var taskSearchfile = ctx.AddTask(Str.SearchingFile).IsIndeterminate();
|
var taskSearchfile = ctx.AddTask(Ln.SearchingFile).IsIndeterminate();
|
||||||
_childTask = ctx.AddTask("-/-", false);
|
_childTask = ctx.AddTask("-/-", false);
|
||||||
fileList = EnumerateFiles(Opt.Path, Opt.Filter, out _excludeCnt);
|
fileList = EnumerateFiles(Opt.Path, Opt.Filter, out _excludeCnt);
|
||||||
_totalCnt = fileList.Count();
|
_totalCnt = fileList.Count();
|
||||||
@ -111,7 +111,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
_ = grid.AddRow(kv.Key, kv.Value.ToString(CultureInfo.InvariantCulture));
|
_ = grid.AddRow(kv.Key, kv.Value.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
AnsiConsole.Write(new Panel(grid).Header(Str.WriteFileStats));
|
AnsiConsole.Write(new Panel(grid).Header(Ln.WriteFileStats));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once ReturnTypeCanBeEnumerable.Local
|
// ReSharper disable once ReturnTypeCanBeEnumerable.Local
|
||||||
@ -119,7 +119,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
|||||||
{
|
{
|
||||||
var exCnt = 0;
|
var exCnt = 0;
|
||||||
|
|
||||||
//默认排除.git 、 node_modules 目录
|
// 默认排除.git 、 node_modules 目录
|
||||||
if (Opt.ExcludeRegexes?.FirstOrDefault() is null) {
|
if (Opt.ExcludeRegexes?.FirstOrDefault() is null) {
|
||||||
Opt.ExcludeRegexes = new[] { @"\.git", "node_modules" };
|
Opt.ExcludeRegexes = new[] { @"\.git", "node_modules" };
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ using NSExt.Extensions;
|
|||||||
|
|
||||||
namespace Dot.Get;
|
namespace Dot.Get;
|
||||||
|
|
||||||
[Description(nameof(Str.DownloadTool))]
|
[Description(nameof(Ln.DownloadTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed partial class Main : ToolBase<Option>
|
internal sealed partial class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
private const string _PART = "part";
|
private const string _PART = "part";
|
||||||
@ -15,13 +15,13 @@ internal sealed partial class Main : ToolBase<Option>
|
|||||||
protected override async Task Core()
|
protected override async Task Core()
|
||||||
{
|
{
|
||||||
using var http = new HttpClient();
|
using var http = new HttpClient();
|
||||||
string attachment = default;
|
string attachment = default;
|
||||||
long contentLength = default;
|
long contentLength = default;
|
||||||
var table = new Table().AddColumn(Str.DataIdentification).AddColumn(Str.DataContent).AddRow("Url", Opt.Url);
|
var table = new Table().AddColumn(Ln.DataIdentification).AddColumn(Ln.DataContent).AddRow("Url", Opt.Url);
|
||||||
await AnsiConsole.Status()
|
await AnsiConsole.Status()
|
||||||
.AutoRefresh(true)
|
.AutoRefresh(true)
|
||||||
.Spinner(Spinner.Known.Default)
|
.Spinner(Spinner.Known.Default)
|
||||||
.StartAsync($"{Str.RequestMetaData}: {Opt.Url}", async _ => {
|
.StartAsync($"{Ln.RequestMetaData}: {Opt.Url}", async _ => {
|
||||||
using var headRsp = await http.SendAsync(new HttpRequestMessage(HttpMethod.Head, Opt.Url));
|
using var headRsp = await http.SendAsync(new HttpRequestMessage(HttpMethod.Head, Opt.Url));
|
||||||
using var content = headRsp.Content;
|
using var content = headRsp.Content;
|
||||||
contentLength = content.Headers.ContentLength ?? 0;
|
contentLength = content.Headers.ContentLength ?? 0;
|
||||||
@ -45,15 +45,15 @@ internal sealed partial class Main : ToolBase<Option>
|
|||||||
, new TaskDescriptionColumn() //
|
, new TaskDescriptionColumn() //
|
||||||
, new RemainingTimeColumn()) //
|
, new RemainingTimeColumn()) //
|
||||||
.StartAsync(async ctx => {
|
.StartAsync(async ctx => {
|
||||||
var tParent = ctx.AddTask($"{Str.TotalProgress} {Str.RemainingTime}:").IsIndeterminate();
|
var tParent = ctx.AddTask($"{Ln.TotalProgress} {Ln.RemainingTime}:").IsIndeterminate();
|
||||||
|
|
||||||
//未知文件长度,单线程下载;
|
// 未知文件长度,单线程下载;
|
||||||
if (contentLength == 0) {
|
if (contentLength == 0) {
|
||||||
await using var nets = await http.GetStreamAsync(Opt.Url);
|
await using var nets = await http.GetStreamAsync(Opt.Url);
|
||||||
await using var fs
|
await using var fs
|
||||||
= new FileStream(mainFilePath, FileMode.CreateNew, FileAccess.Write
|
= new FileStream(mainFilePath, FileMode.CreateNew, FileAccess.Write
|
||||||
, FileShare.None);
|
, FileShare.None);
|
||||||
tParent.MaxValue = Opt.BufferSize + 1; //由于文件长度未知, 进度条终点永远至为当前长度+1
|
tParent.MaxValue = Opt.BufferSize + 1; // 由于文件长度未知, 进度条终点永远至为当前长度+1
|
||||||
StreamCopy(nets, fs, x => {
|
StreamCopy(nets, fs, x => {
|
||||||
tParent.MaxValue += x;
|
tParent.MaxValue += x;
|
||||||
tParent.Increment(x);
|
tParent.Increment(x);
|
||||||
@ -63,7 +63,7 @@ internal sealed partial class Main : ToolBase<Option>
|
|||||||
tParent.StopTask();
|
tParent.StopTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
//已知文件长度,多线程下载:
|
// 已知文件长度,多线程下载:
|
||||||
else {
|
else {
|
||||||
tParent.IsIndeterminate(false);
|
tParent.IsIndeterminate(false);
|
||||||
tParent.MaxValue = contentLength;
|
tParent.MaxValue = contentLength;
|
||||||
@ -73,7 +73,7 @@ internal sealed partial class Main : ToolBase<Option>
|
|||||||
, new ParallelOptions { MaxDegreeOfParallelism = Opt.MaxParallel } //
|
, new ParallelOptions { MaxDegreeOfParallelism = Opt.MaxParallel } //
|
||||||
, i => {
|
, i => {
|
||||||
var tChild = ctx.AddTask(
|
var tChild = ctx.AddTask(
|
||||||
$"{Str.Thread}{i} {Str.RemainingTime}:", maxValue: chunkSize);
|
$"{Ln.Thread}{i} {Ln.RemainingTime}:", maxValue: chunkSize);
|
||||||
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;
|
||||||
@ -97,7 +97,7 @@ internal sealed partial class Main : ToolBase<Option>
|
|||||||
});
|
});
|
||||||
|
|
||||||
AnsiConsole.MarkupLine(
|
AnsiConsole.MarkupLine(
|
||||||
$"{Str.DownloadCompleted}, {Str.ElapsedTime}: {DateTime.Now - timer}, {Str.FileSaveLocation}: {mainFilePath}");
|
$"{Ln.DownloadCompleted}, {Ln.ElapsedTime}: {DateTime.Now - timer}, {Ln.FileSaveLocation}: {mainFilePath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -114,7 +114,7 @@ internal sealed partial class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once InvertIf
|
// ReSharper disable once InvertIf
|
||||||
if (Directory.Exists(path)) { //path 是一个存在的目录。
|
if (Directory.Exists(path)) { // path 是一个存在的目录。
|
||||||
path = Path.Combine(path, file); // 构建文件路径
|
path = Path.Combine(path, file); // 构建文件路径
|
||||||
GetUseablePath(ref path); // 追加序号。
|
GetUseablePath(ref path); // 追加序号。
|
||||||
return path;
|
return path;
|
||||||
|
@ -6,31 +6,31 @@ namespace Dot.Get;
|
|||||||
internal sealed class Option : OptionBase
|
internal sealed class Option : OptionBase
|
||||||
{
|
{
|
||||||
[CommandOption("-b|--buffer-size")]
|
[CommandOption("-b|--buffer-size")]
|
||||||
[Description(nameof(Str.BufferSize))]
|
[Description(nameof(Ln.BufferSize))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(8096)]
|
[DefaultValue(8096)]
|
||||||
public int BufferSize { get; set; }
|
public int BufferSize { get; set; }
|
||||||
|
|
||||||
[CommandOption("-c|--chunk-number")]
|
[CommandOption("-c|--chunk-number")]
|
||||||
[Description(nameof(Str.ChunkNumbers))]
|
[Description(nameof(Ln.ChunkNumbers))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.MaxParallel))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.OutputPath))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(".")]
|
[DefaultValue(".")]
|
||||||
public string Output { get; set; }
|
public string Output { get; set; }
|
||||||
|
|
||||||
[CommandArgument(0, "<url>")]
|
[CommandArgument(0, "<url>")]
|
||||||
[Description(nameof(Str.Url))]
|
[Description(nameof(Ln.Url))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
public string Url { get; set; }
|
public string Url { get; set; }
|
||||||
}
|
}
|
@ -7,12 +7,12 @@ using NSExt.Extensions;
|
|||||||
|
|
||||||
namespace Dot.Git;
|
namespace Dot.Git;
|
||||||
|
|
||||||
[Description(nameof(Str.GitTool))]
|
[Description(nameof(Ln.GitTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed 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; // 仓库信息容器
|
||||||
private ConcurrentDictionary<string, TaskStatusColumn.Statues> _repoStatus;
|
private ConcurrentDictionary<string, TaskStatusColumn.Statues> _repoStatus;
|
||||||
|
|
||||||
protected override Task Core()
|
protected override Task Core()
|
||||||
@ -20,7 +20,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
return !Directory.Exists(Opt.Path)
|
return !Directory.Exists(Opt.Path)
|
||||||
? throw new ArgumentException( //
|
? throw new ArgumentException( //
|
||||||
nameof(Opt.Path) //
|
nameof(Opt.Path) //
|
||||||
, string.Format(CultureInfo.InvariantCulture, Str.PathNotFound, Opt.Path))
|
, string.Format(CultureInfo.InvariantCulture, Ln.PathNotFound, Opt.Path))
|
||||||
: CoreInternal();
|
: CoreInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
, new TaskDescriptionColumn { Alignment = Justify.Left }) //
|
, new TaskDescriptionColumn { Alignment = Justify.Left }) //
|
||||||
.StartAsync(async ctx => {
|
.StartAsync(async ctx => {
|
||||||
var taskFinder = ctx
|
var taskFinder = ctx
|
||||||
.AddTask(string.Format(CultureInfo.InvariantCulture, Str.FindGitReps
|
.AddTask(string.Format(CultureInfo.InvariantCulture, Ln.FindGitReps
|
||||||
, Opt.Path))
|
, Opt.Path))
|
||||||
.IsIndeterminate();
|
.IsIndeterminate();
|
||||||
var paths = Directory.GetDirectories(Opt.Path, ".git" //
|
var paths = Directory.GetDirectories(Opt.Path, ".git" //
|
||||||
@ -66,12 +66,12 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
await Parallel.ForEachAsync(tasks, DirHandle);
|
await Parallel.ForEachAsync(tasks, DirHandle);
|
||||||
});
|
});
|
||||||
|
|
||||||
var table = new Table().AddColumn(new TableColumn(Str.Repository) { Width = 50 })
|
var table = new Table().AddColumn(new TableColumn(Ln.Repository) { Width = 50 })
|
||||||
.AddColumn(new TableColumn(Str.Command))
|
.AddColumn(new TableColumn(Ln.Command))
|
||||||
.AddColumn(new TableColumn(Str.Response) { Width = 50 })
|
.AddColumn(new TableColumn(Ln.Response) { Width = 50 })
|
||||||
.Caption(
|
.Caption(
|
||||||
$"{Str.ZeroCode}: [green]{_repoStatus.Count(x => x.Value == TaskStatusColumn.Statues
|
$"{Ln.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();
|
||||||
@ -82,7 +82,9 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
AnsiConsole.Write(table);
|
AnsiConsole.Write(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning disable SA1313
|
||||||
private async ValueTask DirHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _)
|
private async ValueTask DirHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _)
|
||||||
|
#pragma warning restore SA1313
|
||||||
{
|
{
|
||||||
payload.Value.StartTask();
|
payload.Value.StartTask();
|
||||||
payload.Value.State.Status(TaskStatusColumn.Statues.Executing);
|
payload.Value.State.Status(TaskStatusColumn.Statues.Executing);
|
||||||
|
@ -6,26 +6,26 @@ namespace Dot.Git;
|
|||||||
internal sealed class Option : OptionBase
|
internal sealed class Option : OptionBase
|
||||||
{
|
{
|
||||||
[CommandOption("-a|--args")]
|
[CommandOption("-a|--args")]
|
||||||
[Description(nameof(Str.GitArgs))]
|
[Description(nameof(Ln.GitArgs))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue("status")]
|
[DefaultValue("status")]
|
||||||
public string Args { get; set; }
|
public string Args { get; set; }
|
||||||
|
|
||||||
[CommandOption("-e|--git-output-encoding")]
|
[CommandOption("-e|--git-output-encoding")]
|
||||||
[Description(nameof(Str.GitOutputEncoding))]
|
[Description(nameof(Ln.GitOutputEncoding))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue("utf-8")]
|
[DefaultValue("utf-8")]
|
||||||
public string GitOutputEncoding { get; set; }
|
public string GitOutputEncoding { get; set; }
|
||||||
|
|
||||||
[CommandOption("-d|--max-recursion-depth")]
|
[CommandOption("-d|--max-recursion-depth")]
|
||||||
[Description(nameof(Str.MaxRecursionDepth))]
|
[Description(nameof(Ln.MaxRecursionDepth))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.FolderPath))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(".")]
|
[DefaultValue(".")]
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
}
|
}
|
@ -10,18 +10,34 @@ internal sealed class TaskStatusColumn : ProgressColumn
|
|||||||
{
|
{
|
||||||
public enum Statues : byte
|
public enum Statues : byte
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ready
|
||||||
|
/// </summary>
|
||||||
[Description($"[gray]{nameof(Ready)}[/]")]
|
[Description($"[gray]{nameof(Ready)}[/]")]
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global
|
|
||||||
Ready
|
Ready
|
||||||
|
|
||||||
, [Description($"[yellow]{nameof(Executing)}[/]")]
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Executing
|
||||||
|
/// </summary>
|
||||||
|
[Description($"[yellow]{nameof(Executing)}[/]")]
|
||||||
Executing
|
Executing
|
||||||
|
|
||||||
, [Description($"[green]{nameof(Succeed)}[/]")]
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Succeed
|
||||||
|
/// </summary>
|
||||||
|
[Description($"[green]{nameof(Succeed)}[/]")]
|
||||||
Succeed
|
Succeed
|
||||||
|
|
||||||
, [Description($"[red]{nameof(Failed)}[/]")]
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Failed
|
||||||
|
/// </summary>
|
||||||
|
[Description($"[red]{nameof(Failed)}[/]")]
|
||||||
Failed
|
Failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ using TextCopy;
|
|||||||
|
|
||||||
namespace Dot.Guid;
|
namespace Dot.Guid;
|
||||||
|
|
||||||
[Description(nameof(Str.GuidTool))]
|
[Description(nameof(Ln.GuidTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
protected override Task Core()
|
protected override Task Core()
|
||||||
@ -17,7 +17,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
guid = guid.ToUpper(CultureInfo.InvariantCulture);
|
guid = guid.ToUpper(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine(Str.Copied, guid);
|
Console.WriteLine(Ln.Copied, guid);
|
||||||
#if NET7_0_WINDOWS
|
#if NET7_0_WINDOWS
|
||||||
ClipboardService.SetText(guid);
|
ClipboardService.SetText(guid);
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,8 +6,8 @@ namespace Dot.Guid;
|
|||||||
internal sealed class Option : OptionBase
|
internal sealed class Option : OptionBase
|
||||||
{
|
{
|
||||||
[CommandOption("-u|--upper")]
|
[CommandOption("-u|--upper")]
|
||||||
[Description(nameof(Str.UseUppercase))]
|
[Description(nameof(Ln.UseUppercase))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool Upper { get; set; }
|
public bool Upper { get; set; }
|
||||||
}
|
}
|
@ -5,8 +5,8 @@ using System.Net.Sockets;
|
|||||||
|
|
||||||
namespace Dot.IP;
|
namespace Dot.IP;
|
||||||
|
|
||||||
[Description(nameof(Str.Ip))]
|
[Description(nameof(Ln.Ip))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
protected override async Task Core()
|
protected override async Task Core()
|
||||||
@ -26,7 +26,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
|
|
||||||
using var http = new HttpClient();
|
using var http = new HttpClient();
|
||||||
Console.Write(Str.PublicIP);
|
Console.Write(Ln.PublicIP);
|
||||||
var str = await http.GetStringAsync("http://httpbin.org/ip");
|
var str = await http.GetStringAsync("http://httpbin.org/ip");
|
||||||
Console.WriteLine(str);
|
Console.WriteLine(str);
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ using TextCopy;
|
|||||||
|
|
||||||
namespace Dot.Json;
|
namespace Dot.Json;
|
||||||
|
|
||||||
[Description(nameof(Str.Json))]
|
[Description(nameof(Ln.Json))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
private object _inputObj;
|
private object _inputObj;
|
||||||
@ -24,7 +24,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (inputText.NullOrWhiteSpace()) {
|
if (inputText.NullOrWhiteSpace()) {
|
||||||
throw new ArgumentException(Str.InputTextIsEmpty);
|
throw new ArgumentException(Ln.InputTextIsEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -40,7 +40,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException(Str.InvalidJsonString);
|
throw new ArgumentException(Ln.InvalidJsonString);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CoreInternal();
|
return CoreInternal();
|
||||||
|
@ -6,25 +6,25 @@ namespace Dot.Json;
|
|||||||
internal sealed class Option : OptionBase
|
internal sealed class Option : OptionBase
|
||||||
{
|
{
|
||||||
[CommandOption("-c|--compress")]
|
[CommandOption("-c|--compress")]
|
||||||
[Description(nameof(Str.CompressJson))]
|
[Description(nameof(Ln.CompressJson))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.JsonToString))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.FormatJson))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.TextTobeProcessed))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
public string InputText { get; set; }
|
public string InputText { get; set; }
|
||||||
}
|
}
|
@ -1,11 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<root>
|
<root>
|
||||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
|
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
|
||||||
id="root"
|
id="root"
|
||||||
xmlns="">
|
xmlns="">
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
|
||||||
</xsd:element>
|
</xsd:element>
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
<resheader name="resmimetype">
|
<resheader name="resmimetype">
|
||||||
@ -63,7 +61,6 @@
|
|||||||
<data name="TextTobeProcessed" xml:space="preserve">
|
<data name="TextTobeProcessed" xml:space="preserve">
|
||||||
<value>要处理的文本(默认取取剪贴板值)</value>
|
<value>要处理的文本(默认取取剪贴板值)</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="Copied" xml:space="preserve">
|
<data name="Copied" xml:space="preserve">
|
||||||
<value>{0}(已复制到剪贴板)</value>
|
<value>{0}(已复制到剪贴板)</value>
|
||||||
</data>
|
</data>
|
||||||
@ -130,15 +127,12 @@
|
|||||||
<data name="RandomPasswordGenerator" xml:space="preserve">
|
<data name="RandomPasswordGenerator" xml:space="preserve">
|
||||||
<value>随机密码生成器</value>
|
<value>随机密码生成器</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="PwdLength" xml:space="preserve">
|
<data name="PwdLength" xml:space="preserve">
|
||||||
<value>密码长度</value>
|
<value>密码长度</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="PwdGenerateTypes" xml:space="preserve">
|
<data name="PwdGenerateTypes" xml:space="preserve">
|
||||||
<value>BitSet 1:[0-9],2:[a-z],4:[A-Z],8:[ascii.0x21-0x2F]</value>
|
<value>BitSet 1:[0-9],2:[a-z],4:[A-Z],8:[ascii.0x21-0x2F]</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="RemoveTrailingWhiteSpaces" xml:space="preserve">
|
<data name="RemoveTrailingWhiteSpaces" xml:space="preserve">
|
||||||
<value>移除文件尾部换行和空格</value>
|
<value>移除文件尾部换行和空格</value>
|
||||||
</data>
|
</data>
|
||||||
@ -205,11 +199,9 @@
|
|||||||
<data name="Read" xml:space="preserve">
|
<data name="Read" xml:space="preserve">
|
||||||
<value>读取</value>
|
<value>读取</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="Write" xml:space="preserve">
|
<data name="Write" xml:space="preserve">
|
||||||
<value>写入</value>
|
<value>写入</value>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data name="Break" xml:space="preserve">
|
<data name="Break" xml:space="preserve">
|
||||||
<value>跳过</value>
|
<value>跳过</value>
|
||||||
</data>
|
</data>
|
@ -27,14 +27,14 @@ 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 sealed class Str {
|
internal sealed class Ln {
|
||||||
|
|
||||||
private static global::System.Resources.ResourceManager resourceMan;
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
internal Str() {
|
internal Ln() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -44,7 +44,7 @@ namespace Dot.Lang {
|
|||||||
public static global::System.Resources.ResourceManager ResourceManager {
|
public static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Dot.Lang.Str", typeof(Str).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Dot.Languages.Ln", typeof(Ln).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
@ -67,7 +67,7 @@ namespace Dot.Lang {
|
|||||||
|
|
||||||
<#
|
<#
|
||||||
var xml = new XmlDocument();
|
var xml = new XmlDocument();
|
||||||
xml.Load("Str.resx");
|
xml.Load("Ln.resx");
|
||||||
foreach (XmlNode data in xml.SelectNodes("//root/data")!)
|
foreach (XmlNode data in xml.SelectNodes("//root/data")!)
|
||||||
{
|
{
|
||||||
#>
|
#>
|
@ -34,7 +34,7 @@ internal sealed class KeyboardHook : IDisposable
|
|||||||
private static nint SetHook(Win32.HookProc lpfn)
|
private static nint SetHook(Win32.HookProc lpfn)
|
||||||
{
|
{
|
||||||
using var process = Process.GetCurrentProcess();
|
using var process = Process.GetCurrentProcess();
|
||||||
using var module = process.MainModule;
|
using var module = process.MainModule;
|
||||||
return Win32.SetWindowsHookExA(Win32.WH_KEYBOARD_LL, lpfn, module!.BaseAddress, 0);
|
return Win32.SetWindowsHookExA(Win32.WH_KEYBOARD_LL, lpfn, module!.BaseAddress, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ internal sealed class MouseHook : IDisposable
|
|||||||
private static nint SetHook(Win32.HookProc lpfn)
|
private static nint SetHook(Win32.HookProc lpfn)
|
||||||
{
|
{
|
||||||
using var process = Process.GetCurrentProcess();
|
using var process = Process.GetCurrentProcess();
|
||||||
using var module = process.MainModule;
|
using var module = process.MainModule;
|
||||||
return Win32.SetWindowsHookExA(Win32.WH_MOUSE_LL, lpfn, module!.BaseAddress, 0);
|
return Win32.SetWindowsHookExA(Win32.WH_MOUSE_LL, lpfn, module!.BaseAddress, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,8 +67,11 @@ internal sealed class MouseHook : IDisposable
|
|||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
private readonly struct Msllhookstruct
|
private readonly struct Msllhookstruct
|
||||||
{
|
{
|
||||||
[FieldOffset(0)] public readonly int X;
|
[FieldOffset(0)]
|
||||||
[FieldOffset(4)] public readonly int Y;
|
public readonly int X;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
public readonly int Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -87,41 +87,79 @@ internal static partial class Win32
|
|||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public readonly struct KbdllhooksStruct
|
public readonly struct KbdllhooksStruct
|
||||||
{
|
{
|
||||||
[FieldOffset(0)] public readonly uint vkCode;
|
[FieldOffset(0)]
|
||||||
[FieldOffset(16)] private readonly nint dwExtraInfo;
|
public readonly uint vkCode;
|
||||||
[FieldOffset(8)] private readonly uint flags;
|
|
||||||
[FieldOffset(4)] private readonly uint scanCode;
|
[FieldOffset(16)]
|
||||||
[FieldOffset(12)] private readonly uint time;
|
private readonly nint dwExtraInfo;
|
||||||
|
|
||||||
|
[FieldOffset(8)]
|
||||||
|
private readonly uint flags;
|
||||||
|
|
||||||
|
[FieldOffset(4)]
|
||||||
|
private readonly uint scanCode;
|
||||||
|
|
||||||
|
[FieldOffset(12)]
|
||||||
|
private readonly uint time;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public struct InputStruct
|
public struct InputStruct
|
||||||
{
|
{
|
||||||
[FieldOffset(8)] public KeybdInputStruct ki;
|
[FieldOffset(8)]
|
||||||
[FieldOffset(0)] public uint type;
|
public KeybdInputStruct ki;
|
||||||
|
|
||||||
|
[FieldOffset(0)]
|
||||||
|
public uint type;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public struct KeybdInputStruct
|
public struct KeybdInputStruct
|
||||||
{
|
{
|
||||||
[FieldOffset(4)] public uint dwFlags;
|
[FieldOffset(4)]
|
||||||
[FieldOffset(0)] public ushort wVk;
|
public uint dwFlags;
|
||||||
[FieldOffset(20)] private readonly long _; // 补位以匹配 UNION的MOUSEINPUT参数 (28bytes)
|
|
||||||
[FieldOffset(12)] private readonly nint dwExtraInfo;
|
[FieldOffset(0)]
|
||||||
[FieldOffset(8)] private readonly uint time;
|
public ushort wVk;
|
||||||
[FieldOffset(2)] private readonly ushort wScan;
|
|
||||||
|
[FieldOffset(20)]
|
||||||
|
private readonly long _; // 补位以匹配 UNION的MOUSEINPUT参数 (28bytes)
|
||||||
|
|
||||||
|
[FieldOffset(12)]
|
||||||
|
private readonly nint dwExtraInfo;
|
||||||
|
|
||||||
|
[FieldOffset(8)]
|
||||||
|
private readonly uint time;
|
||||||
|
|
||||||
|
[FieldOffset(2)]
|
||||||
|
private readonly ushort wScan;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
public ref struct Systemtime
|
public ref struct Systemtime
|
||||||
{
|
{
|
||||||
[FieldOffset(6)] public ushort wDay;
|
[FieldOffset(6)]
|
||||||
[FieldOffset(4)] public ushort wDayOfWeek;
|
public ushort wDay;
|
||||||
[FieldOffset(8)] public ushort wHour;
|
|
||||||
[FieldOffset(14)] public ushort wMilliseconds;
|
[FieldOffset(4)]
|
||||||
[FieldOffset(10)] public ushort wMinute;
|
public ushort wDayOfWeek;
|
||||||
[FieldOffset(2)] public ushort wMonth;
|
|
||||||
[FieldOffset(12)] public ushort wSecond;
|
[FieldOffset(8)]
|
||||||
[FieldOffset(0)] public ushort wYear;
|
public ushort wHour;
|
||||||
|
|
||||||
|
[FieldOffset(14)]
|
||||||
|
public ushort wMilliseconds;
|
||||||
|
|
||||||
|
[FieldOffset(10)]
|
||||||
|
public ushort wMinute;
|
||||||
|
|
||||||
|
[FieldOffset(2)]
|
||||||
|
public ushort wMonth;
|
||||||
|
|
||||||
|
[FieldOffset(12)]
|
||||||
|
public ushort wSecond;
|
||||||
|
|
||||||
|
[FieldOffset(0)]
|
||||||
|
public ushort wYear;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,8 +8,8 @@ namespace Dot;
|
|||||||
internal abstract class OptionBase : CommandSettings, IOption
|
internal abstract class OptionBase : CommandSettings, IOption
|
||||||
{
|
{
|
||||||
[CommandOption("-k|--keep--session")]
|
[CommandOption("-k|--keep--session")]
|
||||||
[Description(nameof(Str.KeepSession))]
|
[Description(nameof(Ln.KeepSession))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(false)]
|
[DefaultValue(false)]
|
||||||
public bool KeepSession { get; set; }
|
public bool KeepSession { get; set; }
|
||||||
}
|
}
|
@ -7,8 +7,8 @@ using TextCopy;
|
|||||||
|
|
||||||
namespace Dot.Pwd;
|
namespace Dot.Pwd;
|
||||||
|
|
||||||
[Description(nameof(Str.RandomPasswordGenerator))]
|
[Description(nameof(Ln.RandomPasswordGenerator))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
private readonly char[][] _charTable = {
|
private readonly char[][] _charTable = {
|
||||||
@ -55,7 +55,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
|
|
||||||
var result = new string(pDest, 0, Opt.Length);
|
var result = new string(pDest, 0, Opt.Length);
|
||||||
Console.WriteLine(Str.Copied, result);
|
Console.WriteLine(Ln.Copied, result);
|
||||||
#if NET7_0_WINDOWS
|
#if NET7_0_WINDOWS
|
||||||
ClipboardService.SetText(result);
|
ClipboardService.SetText(result);
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,12 +15,12 @@ internal sealed class Option : OptionBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CommandArgument(1, "<password length>")]
|
[CommandArgument(1, "<password length>")]
|
||||||
[Description(nameof(Str.PwdLength))]
|
[Description(nameof(Ln.PwdLength))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
public int Length { get; set; }
|
public int Length { get; set; }
|
||||||
|
|
||||||
[CommandArgument(0, "<generate type>")]
|
[CommandArgument(0, "<generate type>")]
|
||||||
[Description(nameof(Str.PwdGenerateTypes))]
|
[Description(nameof(Ln.PwdGenerateTypes))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
public GenerateTypes Type { get; set; }
|
public GenerateTypes Type { get; set; }
|
||||||
}
|
}
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Dot.Rbom;
|
namespace Dot.Rbom;
|
||||||
|
|
||||||
[Description(nameof(Str.TrimUtf8Bom))]
|
[Description(nameof(Ln.TrimUtf8Bom))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : FilesTool<Option>
|
internal sealed class Main : FilesTool<Option>
|
||||||
{
|
{
|
||||||
private readonly byte[] _utf8Bom = { 0xef, 0xbb, 0xbf };
|
private readonly byte[] _utf8Bom = { 0xef, 0xbb, 0xbf };
|
||||||
|
@ -10,13 +10,13 @@ using TextCopy;
|
|||||||
|
|
||||||
namespace Dot.Text;
|
namespace Dot.Text;
|
||||||
|
|
||||||
[Description(nameof(Str.TextTool))]
|
[Description(nameof(Ln.TextTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
#if NET7_0_WINDOWS
|
#if NET7_0_WINDOWS
|
||||||
protected override async Task Core()
|
protected override async Task Core()
|
||||||
#else
|
#else
|
||||||
protected override Task Core()
|
protected override Task Core()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -26,7 +26,7 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (Opt.Text.NullOrEmpty()) {
|
if (Opt.Text.NullOrEmpty()) {
|
||||||
throw new ArgumentException(Str.InputTextIsEmpty);
|
throw new ArgumentException(Ln.InputTextIsEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
ParseAndShow(Opt.Text);
|
ParseAndShow(Opt.Text);
|
||||||
|
@ -5,7 +5,7 @@ namespace Dot.Text;
|
|||||||
internal sealed class Option : OptionBase
|
internal sealed class Option : OptionBase
|
||||||
{
|
{
|
||||||
[CommandArgument(0, "[input text]")]
|
[CommandArgument(0, "[input text]")]
|
||||||
[Description(nameof(Str.TextTobeProcessed))]
|
[Description(nameof(Ln.TextTobeProcessed))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
}
|
}
|
@ -5,8 +5,8 @@ using Dot.Native;
|
|||||||
|
|
||||||
namespace Dot.Time;
|
namespace Dot.Time;
|
||||||
|
|
||||||
[Description(nameof(Str.TimeTool))]
|
[Description(nameof(Ln.TimeTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
{
|
{
|
||||||
private const int _MAX_DEGREE_OF_PARALLELISM = 10;
|
private const int _MAX_DEGREE_OF_PARALLELISM = 10;
|
||||||
@ -56,12 +56,12 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
.Average(x => x.Value.State.Result().TotalMilliseconds);
|
.Average(x => x.Value.State.Result().TotalMilliseconds);
|
||||||
});
|
});
|
||||||
|
|
||||||
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, Str.NtpReceiveDone, $"[green]{_successCnt}[/]"
|
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, Ln.NtpReceiveDone, $"[green]{_successCnt}[/]"
|
||||||
, _ntpServers.Length, $"[yellow]{_offsetAvg:f2}[/]");
|
, _ntpServers.Length, $"[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]{Ln.LocalTimeSyncDone}[/]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,9 +72,9 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
var table = new Table().HideHeaders()
|
var table = new Table().HideHeaders()
|
||||||
.AddColumn(new TableColumn(string.Empty))
|
.AddColumn(new TableColumn(string.Empty))
|
||||||
.AddColumn(new TableColumn(string.Empty))
|
.AddColumn(new TableColumn(string.Empty))
|
||||||
.Caption(Str.PressAnyKey)
|
.Caption(Ln.PressAnyKey)
|
||||||
.AddRow(Str.NtpClock, DateTime.Now.AddMilliseconds(-_offsetAvg).ToString("O"))
|
.AddRow(Ln.NtpClock, DateTime.Now.AddMilliseconds(-_offsetAvg).ToString("O"))
|
||||||
.AddRow(Str.LocalClock, DateTime.Now.ToString("O"));
|
.AddRow(Ln.LocalClock, DateTime.Now.ToString("O"));
|
||||||
|
|
||||||
var cts = new CancellationTokenSource();
|
var cts = new CancellationTokenSource();
|
||||||
var task = AnsiConsole.Live(table)
|
var task = AnsiConsole.Live(table)
|
||||||
@ -145,7 +145,9 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning disable SA1313
|
||||||
private ValueTask ServerHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _)
|
private ValueTask ServerHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _)
|
||||||
|
#pragma warning restore SA1313
|
||||||
{
|
{
|
||||||
payload.Value.StartTask();
|
payload.Value.StartTask();
|
||||||
payload.Value.State.Status(TaskStatusColumn.Statues.Connecting);
|
payload.Value.State.Status(TaskStatusColumn.Statues.Connecting);
|
||||||
|
@ -6,14 +6,14 @@ namespace Dot.Time;
|
|||||||
internal sealed class Option : OptionBase
|
internal sealed class Option : OptionBase
|
||||||
{
|
{
|
||||||
[CommandOption("-s|--sync")]
|
[CommandOption("-s|--sync")]
|
||||||
[Description(nameof(Str.SyncToLocalTime))]
|
[Description(nameof(Ln.SyncToLocalTime))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[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(Ln.TimeoutMillSecs))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
[DefaultValue(2000)]
|
[DefaultValue(2000)]
|
||||||
public int Timeout { get; set; }
|
public int Timeout { get; set; }
|
||||||
}
|
}
|
@ -10,17 +10,34 @@ internal sealed class TaskStatusColumn : ProgressColumn
|
|||||||
{
|
{
|
||||||
public enum Statues : byte
|
public enum Statues : byte
|
||||||
{
|
{
|
||||||
// ReSharper disable once UnusedMember.Global
|
/// <summary>
|
||||||
|
/// Ready
|
||||||
|
/// </summary>
|
||||||
[Description($"[gray]{nameof(Ready)}[/]")]
|
[Description($"[gray]{nameof(Ready)}[/]")]
|
||||||
Ready
|
Ready
|
||||||
|
|
||||||
, [Description($"[yellow]{nameof(Connecting)}[/]")]
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connecting
|
||||||
|
/// </summary>
|
||||||
|
[Description($"[yellow]{nameof(Connecting)}[/]")]
|
||||||
Connecting
|
Connecting
|
||||||
|
|
||||||
, [Description($"[green]{nameof(Succeed)}[/]")]
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Succeed
|
||||||
|
/// </summary>
|
||||||
|
[Description($"[green]{nameof(Succeed)}[/]")]
|
||||||
Succeed
|
Succeed
|
||||||
|
|
||||||
, [Description($"[red]{nameof(Failed)}[/]")]
|
,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Failed
|
||||||
|
/// </summary>
|
||||||
|
[Description($"[red]{nameof(Failed)}[/]")]
|
||||||
Failed
|
Failed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Dot.ToLf;
|
namespace Dot.ToLf;
|
||||||
|
|
||||||
[Description(nameof(Str.ConvertEndOfLineToLF))]
|
[Description(nameof(Ln.ConvertEndOfLineToLF))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : FilesTool<Option>
|
internal sealed class Main : FilesTool<Option>
|
||||||
{
|
{
|
||||||
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
|
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
|
||||||
@ -31,12 +31,12 @@ internal sealed class Main : FilesTool<Option>
|
|||||||
fsw.WriteByte(0x0a);
|
fsw.WriteByte(0x0a);
|
||||||
hasWrote = true;
|
hasWrote = true;
|
||||||
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: // 非文本文件
|
||||||
isBin = true;
|
isBin = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -18,7 +18,7 @@ internal abstract class ToolBase<TOption> : Command<TOption>
|
|||||||
{
|
{
|
||||||
await Core();
|
await Core();
|
||||||
if (Opt.KeepSession) {
|
if (Opt.KeepSession) {
|
||||||
AnsiConsole.MarkupLine(Str.PressAnyKey);
|
AnsiConsole.MarkupLine(Ln.PressAnyKey);
|
||||||
_ = AnsiConsole.Console.Input.ReadKey(true);
|
_ = AnsiConsole.Console.Input.ReadKey(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ using NSExt.Extensions;
|
|||||||
|
|
||||||
namespace Dot.Tran;
|
namespace Dot.Tran;
|
||||||
|
|
||||||
[Description(nameof(Str.TranslateTool))]
|
[Description(nameof(Ln.TranslateTool))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
|
|
||||||
// ReSharper disable once ClassNeverInstantiated.Global
|
// ReSharper disable once ClassNeverInstantiated.Global
|
||||||
internal sealed class Main : ToolBase<Option>
|
internal sealed class Main : ToolBase<Option>
|
||||||
@ -14,12 +14,12 @@ internal sealed class Main : ToolBase<Option>
|
|||||||
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
||||||
protected override Task Core()
|
protected override Task Core()
|
||||||
{
|
{
|
||||||
AnsiConsole.MarkupLine(Str.StartTranslate);
|
AnsiConsole.MarkupLine(Ln.StartTranslate);
|
||||||
AnsiConsole.MarkupLine(Str.HideTranslate);
|
AnsiConsole.MarkupLine(Ln.HideTranslate);
|
||||||
var th = new Thread(() => {
|
var th = new Thread(() => {
|
||||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||||
AppDomain.CurrentDomain.UnhandledException += UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += UnhandledException;
|
||||||
Application.ThreadException += UIThreadException;
|
Application.ThreadException += UIThreadException;
|
||||||
using var frm = new WinMain();
|
using var frm = new WinMain();
|
||||||
try {
|
try {
|
||||||
Application.Run();
|
Application.Run();
|
||||||
|
@ -15,14 +15,14 @@ namespace Dot.Tran;
|
|||||||
internal sealed partial class WinMain : Form
|
internal sealed partial class WinMain : Form
|
||||||
{
|
{
|
||||||
private const int _RETRY_WAIT_MIL_SEC = 1000;
|
private const int _RETRY_WAIT_MIL_SEC = 1000;
|
||||||
private const string _TRANSLATE_API_URL = $"{_TRANSLATE_HOME_URL}/v2transapi";
|
private const string _TRANSLATE_API_URL = $"{_TRANSLATE_HOME_URL}/v2transapi";
|
||||||
private const string _TRANSLATE_HOME_URL = "https://fanyi.baidu.com";
|
private const string _TRANSLATE_HOME_URL = "https://fanyi.baidu.com";
|
||||||
private readonly HttpClient _httpClient = new(new HttpClientHandler { UseProxy = false });
|
private readonly HttpClient _httpClient = new(new HttpClientHandler { UseProxy = false });
|
||||||
private readonly KeyboardHook _keyboardHook = new();
|
private readonly KeyboardHook _keyboardHook = new();
|
||||||
private readonly Label _labelDest = new();
|
private readonly Label _labelDest = new();
|
||||||
private readonly MouseHook _mouseHook = new();
|
private readonly MouseHook _mouseHook = new();
|
||||||
private readonly Size _mouseMargin = new(10, 10);
|
private readonly Size _mouseMargin = new(10, 10);
|
||||||
private readonly string _stateFile = Path.Combine(Path.GetTempPath(), "dot-tran-state.tmp");
|
private readonly string _stateFile = Path.Combine(Path.GetTempPath(), "dot-tran-state.tmp");
|
||||||
private bool _capsLockPressed;
|
private bool _capsLockPressed;
|
||||||
private volatile string _cookie;
|
private volatile string _cookie;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
@ -104,12 +104,12 @@ internal sealed partial class WinMain : Form
|
|||||||
|
|
||||||
private void InitForm()
|
private void InitForm()
|
||||||
{
|
{
|
||||||
AutoSize = true;
|
AutoSize = true;
|
||||||
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
||||||
MaximumSize = Screen.FromHandle(Handle).Bounds.Size / 2;
|
MaximumSize = Screen.FromHandle(Handle).Bounds.Size / 2;
|
||||||
FormBorderStyle = FormBorderStyle.None;
|
FormBorderStyle = FormBorderStyle.None;
|
||||||
TopMost = true;
|
TopMost = true;
|
||||||
Visible = false;
|
Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void InitHook()
|
private unsafe void InitHook()
|
||||||
@ -124,18 +124,18 @@ internal sealed partial class WinMain : Form
|
|||||||
case VkCode.VK_CAPITAL: {
|
case VkCode.VK_CAPITAL: {
|
||||||
var keyInputs = new Win32.InputStruct[4];
|
var keyInputs = new Win32.InputStruct[4];
|
||||||
|
|
||||||
keyInputs[0].type = Win32.INPUT_KEYBOARD;
|
keyInputs[0].type = Win32.INPUT_KEYBOARD;
|
||||||
keyInputs[0].ki.wVk = VkCode.VK_CONTROL;
|
keyInputs[0].ki.wVk = VkCode.VK_CONTROL;
|
||||||
|
|
||||||
keyInputs[1].type = Win32.INPUT_KEYBOARD;
|
keyInputs[1].type = Win32.INPUT_KEYBOARD;
|
||||||
keyInputs[1].ki.wVk = VkCode.VK_C;
|
keyInputs[1].ki.wVk = VkCode.VK_C;
|
||||||
|
|
||||||
keyInputs[2].type = Win32.INPUT_KEYBOARD;
|
keyInputs[2].type = Win32.INPUT_KEYBOARD;
|
||||||
keyInputs[2].ki.wVk = VkCode.VK_C;
|
keyInputs[2].ki.wVk = VkCode.VK_C;
|
||||||
keyInputs[2].ki.dwFlags = Win32.KEYEVENTF_KEYUP;
|
keyInputs[2].ki.dwFlags = Win32.KEYEVENTF_KEYUP;
|
||||||
|
|
||||||
keyInputs[3].type = Win32.INPUT_KEYBOARD;
|
keyInputs[3].type = Win32.INPUT_KEYBOARD;
|
||||||
keyInputs[3].ki.wVk = VkCode.VK_CONTROL;
|
keyInputs[3].ki.wVk = VkCode.VK_CONTROL;
|
||||||
keyInputs[3].ki.dwFlags = Win32.KEYEVENTF_KEYUP;
|
keyInputs[3].ki.dwFlags = Win32.KEYEVENTF_KEYUP;
|
||||||
|
|
||||||
Win32.SendInput((uint)keyInputs.Length, keyInputs, sizeof(Win32.InputStruct));
|
Win32.SendInput((uint)keyInputs.Length, keyInputs, sizeof(Win32.InputStruct));
|
||||||
@ -158,15 +158,15 @@ internal sealed partial class WinMain : Form
|
|||||||
{
|
{
|
||||||
_httpClient.DefaultRequestHeaders.Add( //
|
_httpClient.DefaultRequestHeaders.Add( //
|
||||||
"User-Agent"
|
"User-Agent"
|
||||||
, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36");
|
, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitLabelDest()
|
private void InitLabelDest()
|
||||||
{
|
{
|
||||||
_labelDest.Font = new Font(_labelDest.Font.FontFamily, 16);
|
_labelDest.Font = new Font(_labelDest.Font.FontFamily, 16);
|
||||||
_labelDest.BorderStyle = BorderStyle.None;
|
_labelDest.BorderStyle = BorderStyle.None;
|
||||||
_labelDest.Dock = DockStyle.Fill;
|
_labelDest.Dock = DockStyle.Fill;
|
||||||
_labelDest.AutoSize = true;
|
_labelDest.AutoSize = true;
|
||||||
Controls.Add(_labelDest);
|
Controls.Add(_labelDest);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ internal sealed partial class WinMain : Form
|
|||||||
{
|
{
|
||||||
if (File.Exists(_stateFile)) {
|
if (File.Exists(_stateFile)) {
|
||||||
var lines = File.ReadLines(_stateFile).ToArray();
|
var lines = File.ReadLines(_stateFile).ToArray();
|
||||||
_token = lines[0];
|
_token = lines[0];
|
||||||
_cookie = lines[1];
|
_cookie = lines[1];
|
||||||
_httpClient.DefaultRequestHeaders.Add(nameof(Cookie), _cookie);
|
_httpClient.DefaultRequestHeaders.Add(nameof(Cookie), _cookie);
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ internal sealed partial class WinMain : Form
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_labelDest.Text = Str.Translating;
|
_labelDest.Text = Ln.Translating;
|
||||||
Task.Run(() => {
|
Task.Run(() => {
|
||||||
var translateText = TranslateText(clipText);
|
var translateText = TranslateText(clipText);
|
||||||
ClipboardService.SetText(translateText);
|
ClipboardService.SetText(translateText);
|
||||||
@ -209,17 +209,17 @@ internal sealed partial class WinMain : Form
|
|||||||
var sign = BaiduSignCracker.Sign(sourceText);
|
var sign = BaiduSignCracker.Sign(sourceText);
|
||||||
var content = new FormUrlEncodedContent(new List<KeyValuePair<string, string>> {
|
var content = new FormUrlEncodedContent(new List<KeyValuePair<string, string>> {
|
||||||
new("from", "auto")
|
new("from", "auto")
|
||||||
, new( //
|
, new( //
|
||||||
"to"
|
"to"
|
||||||
, CultureInfo.CurrentCulture.TwoLetterISOLanguageName)
|
, CultureInfo.CurrentCulture.TwoLetterISOLanguageName)
|
||||||
, new("query", sourceText)
|
, new("query", sourceText)
|
||||||
, new("simple_means_flag", "3")
|
, new("simple_means_flag", "3")
|
||||||
, new("sign", sign)
|
, new("sign", sign)
|
||||||
, new("token", _token)
|
, new("token", _token)
|
||||||
, new("domain", "common")
|
, new("domain", "common")
|
||||||
});
|
});
|
||||||
|
|
||||||
var rsp = _httpClient.PostAsync(_TRANSLATE_API_URL, content).Result;
|
var rsp = _httpClient.PostAsync(_TRANSLATE_API_URL, content).Result;
|
||||||
var rspObj = rsp.Content.ReadAsStringAsync().Result.Object<BaiduTranslateResultDto.Root>();
|
var rspObj = rsp.Content.ReadAsStringAsync().Result.Object<BaiduTranslateResultDto.Root>();
|
||||||
if (rspObj.error == 0) {
|
if (rspObj.error == 0) {
|
||||||
return string.Join(Environment.NewLine, rspObj.trans_result.data.Select(x => x.dst));
|
return string.Join(Environment.NewLine, rspObj.trans_result.data.Select(x => x.dst));
|
||||||
@ -228,7 +228,7 @@ internal sealed partial class WinMain : Form
|
|||||||
Console.Error.WriteLine(rspObj.Json().UnicodeDe());
|
Console.Error.WriteLine(rspObj.Json().UnicodeDe());
|
||||||
Console.Error.WriteLine(rsp.Headers.Json());
|
Console.Error.WriteLine(rsp.Headers.Json());
|
||||||
|
|
||||||
//cookie or token invalid
|
// cookie or token invalid
|
||||||
Task.Delay(_RETRY_WAIT_MIL_SEC).Wait();
|
Task.Delay(_RETRY_WAIT_MIL_SEC).Wait();
|
||||||
UpdateStateFile();
|
UpdateStateFile();
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ using NSExt.Extensions;
|
|||||||
|
|
||||||
namespace Dot.Trim;
|
namespace Dot.Trim;
|
||||||
|
|
||||||
[Description(nameof(Str.RemoveTrailingWhiteSpaces))]
|
[Description(nameof(Ln.RemoveTrailingWhiteSpaces))]
|
||||||
[Localization(typeof(Str))]
|
[Localization(typeof(Ln))]
|
||||||
internal sealed class Main : FilesTool<Option>
|
internal sealed class Main : FilesTool<Option>
|
||||||
{
|
{
|
||||||
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
|
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
|
||||||
|
@ -2,14 +2,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<AssemblyTitle>功能全面的实用工具 - 程序员的瑞士军刀</AssemblyTitle>
|
<AssemblyTitle>功能全面的实用工具 - 程序员的瑞士军刀</AssemblyTitle>
|
||||||
<Copyright>Copyright (c) 2022 nsnail</Copyright>
|
|
||||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<Product>dot</Product>
|
|
||||||
<RepositoryType>git</RepositoryType>
|
|
||||||
<RepositoryUrl>https://github.com/nsnail/dot.git</RepositoryUrl>
|
|
||||||
<RootNamespace>Dot</RootNamespace>
|
|
||||||
<TargetFrameworks>net7.0-windows;net7.0</TargetFrameworks>
|
<TargetFrameworks>net7.0-windows;net7.0</TargetFrameworks>
|
||||||
<UseWindowsForms Condition="'$(TargetFramework)' == 'net7.0-windows'">true</UseWindowsForms>
|
<UseWindowsForms Condition="'$(TargetFramework)' == 'net7.0-windows'">true</UseWindowsForms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -17,21 +11,17 @@
|
|||||||
<DefineConstants>$(DefineConstants);NET7_0_WINDOWS</DefineConstants>
|
<DefineConstants>$(DefineConstants);NET7_0_WINDOWS</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="NSExt" Version="1.0.11-alpha.0.1"/>
|
<PackageReference Include="NSExt" Version="1.0.11-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 Condition="'$(TargetFramework)' == 'net7.0-windows'" Include="TextCopy" Version="6.2.1"/>
|
<PackageReference Condition="'$(TargetFramework)' == 'net7.0-windows'" Include="TextCopy" Version="6.2.1" />
|
||||||
<PackageReference Include="MinVer" Version="4.3.0-beta.1">
|
|
||||||
<PrivateAssets>all</PrivateAssets>
|
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Update="Lang\Str.resx">
|
<EmbeddedResource Update="Languages\Ln.resx">
|
||||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>Str.Designer.cs</LastGenOutput>
|
<LastGenOutput>Ln.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="../CodeQuality.props"/>
|
<Import Project="../CodeQuality.props" />
|
||||||
<Import Project="../GenerateResx.targets"/>
|
<Import Project="../GenerateResx.targets" />
|
||||||
</Project>
|
</Project>
|
@ -1,2 +1,2 @@
|
|||||||
# https://github.com/RicoSuter/DNT#switch-to-projects
|
@rem https://github.com/RicoSuter/DNT#switch-to-projects
|
||||||
dnt switch-to-packages
|
dnt switch-to-packages
|
@ -1,2 +1,2 @@
|
|||||||
# https://github.com/RicoSuter/DNT#switch-to-projects
|
@rem https://github.com/RicoSuter/DNT#switch-to-projects
|
||||||
dnt switch-to-projects
|
dnt switch-to-projects
|
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"solution": "dot.sln",
|
|
||||||
"solutionFolder": null,
|
|
||||||
"mappings": {
|
|
||||||
"NSExt": "../../../../ForkedGitReps/ns-ext/src/NSExt.csproj",
|
|
||||||
"Spectre.Console.Cli": "../../../../ForkedGitReps/spectre.console/src/Spectre.Console.Cli/Spectre.Console.Cli.csproj"
|
|
||||||
},
|
|
||||||
"restore": [
|
|
||||||
{
|
|
||||||
"name": "dot",
|
|
||||||
"packages": [
|
|
||||||
{
|
|
||||||
"packageName": "NSExt",
|
|
||||||
"version": "1.0.11-alpha.0.1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"packageName": "Spectre.Console.Cli.NS",
|
|
||||||
"version": "0.45.1-preview.0.48"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"removeProjects": true
|
|
||||||
}
|
|
8
switcher.nsext.json
Normal file
8
switcher.nsext.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"solution": "NetAdmin.sln",
|
||||||
|
"solutionFolder": null,
|
||||||
|
"mappings": {
|
||||||
|
"NSExt": "../../../../ForkedGitReps/ns-ext/src/NSExt.csproj"
|
||||||
|
},
|
||||||
|
"removeProjects": true
|
||||||
|
}
|
@ -3,8 +3,14 @@ using System.Security.Cryptography;
|
|||||||
|
|
||||||
namespace Dot.Tests;
|
namespace Dot.Tests;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// TestGet
|
||||||
|
/// </summary>
|
||||||
public class TestGet
|
public class TestGet
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// DownloadFile
|
||||||
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void DownloadFile()
|
public void DownloadFile()
|
||||||
{
|
{
|
||||||
@ -27,9 +33,17 @@ public class TestGet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Setup
|
||||||
|
/// </summary>
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup() { }
|
public void Setup() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GetFileSha1
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="file"></param>
|
||||||
|
/// <returns></returns>
|
||||||
private static string GetFileSha1(string file)
|
private static string GetFileSha1(string file)
|
||||||
{
|
{
|
||||||
using var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
using var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
<RootNamespace>Dot.Tests</RootNamespace>
|
<RootNamespace>Dot.Tests</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221003-04"/>
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0-preview-20221003-04" />
|
||||||
<PackageReference Include="NUnit" Version="3.13.3"/>
|
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1"/>
|
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
|
||||||
<PackageReference Include="NUnit.Analyzers" Version="3.5.0">
|
<PackageReference Include="NUnit.Analyzers" Version="3.5.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
@ -17,5 +17,4 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
x
Reference in New Issue
Block a user