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]
|
||||
dotnet_analyzer_diagnostic.severity = warning
|
||||
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.CA5351.severity = none
|
||||
dotnet_diagnostic.IDE0005.severity = none
|
||||
dotnet_diagnostic.IDE0008.severity = none
|
||||
dotnet_diagnostic.IDE0010.severity = none
|
||||
dotnet_diagnostic.IDE0017.severity = none
|
||||
dotnet_diagnostic.IDE0048.severity = none
|
||||
dotnet_diagnostic.IDE0055.severity = none
|
||||
dotnet_diagnostic.IDE0058.severity = none
|
||||
dotnet_diagnostic.IDE0160.severity = none
|
||||
dotnet_diagnostic.SYSLIB1045.severity = none
|
||||
|
||||
|
||||
# ReSharper properties
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -29,7 +29,7 @@ x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
# [Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
@ -399,6 +399,6 @@ FodyWeavers.xsd
|
||||
.idea/
|
||||
|
||||
# User Define
|
||||
build/
|
||||
dist/
|
||||
nuget.config
|
||||
*.[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();
|
||||
const string findStr = """
|
||||
"keyToString": {
|
||||
""";
|
||||
const string replaceStr = """
|
||||
"keyToString": {
|
||||
"rider.code.cleanup.on.save": "true",
|
||||
""";
|
||||
var content = File.ReadAllText(path);
|
||||
if(content.Contains("rider.code.cleanup.on.save")){
|
||||
Console.WriteLine("alreay added");
|
||||
return;
|
||||
XmlDocument xdoc = new XmlDocument();
|
||||
using(var fs = File.Open(path, FileMode.Open)){
|
||||
xdoc.Load(fs);
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
var propertiesComponent = xdoc.SelectSingleNode("""//component[@name="PropertiesComponent"]""");
|
||||
var jsonStr = propertiesComponent.InnerText;
|
||||
var jsonObj = JObject.Parse(jsonStr);
|
||||
var keyToStringObj = jsonObj["keyToString"] as JObject;
|
||||
if (keyToStringObj.ContainsKey("rider.code.cleanup.on.save")) return;
|
||||
|
||||
keyToStringObj.Add(new JProperty("rider.code.cleanup.on.save", "true"));
|
||||
var newNode = xdoc.CreateCDataSection(jsonObj.ToString());
|
||||
propertiesComponent.InnerText=string.Empty;
|
||||
propertiesComponent.AppendChild(newNode);
|
||||
var settings = new XmlWriterSettings { Indent = true };
|
||||
using(var writer = XmlWriter.Create(fs, settings)){
|
||||
xdoc.WriteTo(writer);
|
||||
}
|
||||
|
||||
}
|
||||
content = content.Replace(findStr, replaceStr);
|
||||
Console.WriteLine(content);
|
||||
File.WriteAllText(path, content);
|
@ -13,5 +13,9 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<!-- <PackageReference Include="NSCodeAnalysis" Version="1.0.1-alpha.0.2">-->
|
||||
<!-- <PrivateAssets>all</PrivateAssets>-->
|
||||
<!-- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
|
||||
<!-- </PackageReference>-->
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,10 +1,26 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<BaseOutputPath>../dist</BaseOutputPath>
|
||||
<Authors>nsnail</Authors>
|
||||
<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>
|
||||
<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>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MinVer" Version="4.3.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,9 +1,9 @@
|
||||
<Project>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<ItemGroup Condition="!Exists('$(ProjectDir)\Lang\Str.Designer.cs')">
|
||||
<Compile Include="$(ProjectDir)\Lang\Str.Designer.cs"/>
|
||||
<ItemGroup Condition="!Exists('$(ProjectDir)\Languages\Ln.Designer.cs')">
|
||||
<Compile Include="$(ProjectDir)\Languages\Ln.Designer.cs" />
|
||||
</ItemGroup>
|
||||
<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>
|
||||
</Project>
|
@ -6,14 +6,13 @@
|
||||
<Rule Id="SA0001" Action="Warning" /> <!-- XML comment analysis disabled -->
|
||||
<Rule Id="SA0002" Action="Warning" /> <!-- Invalid settings file -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.SpacingRules">
|
||||
<Rule Id="SA1000" Action="Warning" /> <!-- Keywords should be spaced correctly -->
|
||||
<Rule Id="SA1001" Action="None" /> <!-- Commas should be spaced correctly -->
|
||||
<Rule Id="SA1002" Action="Warning" /> <!-- Semicolons should be spaced correctly -->
|
||||
<Rule Id="SA1003" Action="Warning" /> <!-- Symbols should be spaced correctly -->
|
||||
<Rule Id="SA1004" Action="Warning" /> <!-- Documentation lines should begin with single space -->
|
||||
<Rule Id="SA1005" Action="None"/> <!-- Single line comments should begin with single space -->
|
||||
<Rule Id="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="SA1007" Action="Warning" /> <!-- Operator keyword should be followed by space -->
|
||||
<Rule Id="SA1008" Action="None" /> <!-- Opening parenthesis should be spaced correctly -->
|
||||
@ -38,7 +37,6 @@
|
||||
<Rule Id="SA1027" Action="Warning" /> <!-- Use tabs correctly -->
|
||||
<Rule Id="SA1028" Action="Warning" /> <!-- Code should not contain trailing whitespace -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.ReadabilityRules">
|
||||
<Rule Id="SA1100" Action="Warning" /> <!-- Do not prefix calls with base unless local implementation exists -->
|
||||
<Rule Id="SA1101" Action="None" /> <!-- Prefix local calls with this -->
|
||||
@ -73,14 +71,13 @@
|
||||
<Rule Id="SA1131" Action="Warning" /> <!-- Use readable conditions -->
|
||||
<Rule Id="SA1132" Action="Warning" /> <!-- Do not combine fields -->
|
||||
<Rule Id="SA1133" Action="Warning" /> <!-- Do not combine attributes -->
|
||||
<Rule Id="SA1134" Action="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="SA1136" Action="Warning" /> <!-- Enum values should be on separate lines -->
|
||||
<Rule Id="SA1137" Action="Warning" /> <!-- Elements should have the same indentation -->
|
||||
<Rule Id="SA1139" Action="Warning" /> <!-- Use literal suffix notation instead of casting -->
|
||||
<Rule Id="SX1101" Action="Warning" /> <!-- Do not prefix local calls with 'this.' -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.OrderingRules">
|
||||
<Rule Id="SA1200" Action="None" /> <!-- Using directives should be placed correctly -->
|
||||
<Rule Id="SA1201" Action="Warning" /> <!-- Elements should appear in the correct order -->
|
||||
@ -100,7 +97,6 @@
|
||||
<Rule Id="SA1216" Action="Warning" /> <!-- Using static directives should be placed at the correct location -->
|
||||
<Rule Id="SA1217" Action="Warning" /> <!-- Using static directives should be ordered alphabetically -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.NamingRules">
|
||||
<Rule Id="SA1300" Action="Warning" /> <!-- Element should begin with upper-case letter -->
|
||||
<Rule Id="SA1301" Action="Warning" /> <!-- Element should begin with lower-case letter -->
|
||||
@ -115,17 +111,16 @@
|
||||
<Rule Id="SA1310" Action="None" /> <!-- Field names should not contain underscore -->
|
||||
<Rule Id="SA1311" Action="Warning" /> <!-- Static readonly fields should begin with upper-case letter -->
|
||||
<Rule Id="SA1312" Action="Warning" /> <!-- Variable names should begin with lower-case letter -->
|
||||
<Rule Id="SA1313" Action="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="SX1309" Action="Warning" /> <!-- Field names should begin with underscore -->
|
||||
<Rule Id="SX1309S" Action="Warning" /> <!-- Static field names should begin with underscore -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.MaintainabilityRules">
|
||||
<Rule Id="SA1119" Action="Warning" /> <!-- Statement should not use unnecessary parenthesis -->
|
||||
<Rule Id="SA1400" Action="Warning" /> <!-- Access modifier should be declared -->
|
||||
<Rule Id="SA1401" Action="Warning" /> <!-- Fields should be private -->
|
||||
<Rule Id="SA1402" Action="Warning"/> <!-- File may only contain a single type -->
|
||||
<Rule Id="SA1402" Action="None" /> <!-- File may only contain a single type -->
|
||||
<Rule Id="SA1403" Action="Warning" /> <!-- File may only contain a single namespace -->
|
||||
<Rule Id="SA1404" Action="Warning" /> <!-- Code analysis suppression should have justification -->
|
||||
<Rule Id="SA1405" Action="Warning" /> <!-- Debug.Assert should provide message text -->
|
||||
@ -138,12 +133,11 @@
|
||||
<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 -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.LayoutRules">
|
||||
<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="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="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 -->
|
||||
@ -162,7 +156,6 @@
|
||||
<Rule Id="SA1519" Action="Warning" /> <!-- Braces should not be omitted from multi-line child statement -->
|
||||
<Rule Id="SA1520" Action="Warning" /> <!-- Use braces consistently -->
|
||||
</Rules>
|
||||
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers.DocumentationRules">
|
||||
<Rule Id="SA1600" Action="None" /> <!-- Elements should be documented -->
|
||||
<Rule Id="SA1601" Action="None" /> <!-- Partial elements should be documented -->
|
||||
@ -173,7 +166,7 @@
|
||||
<Rule Id="SA1606" Action="Warning" /> <!-- Element documentation should have summary text -->
|
||||
<Rule Id="SA1607" Action="Warning" /> <!-- Partial element documentation should have summary text -->
|
||||
<Rule Id="SA1608" Action="Warning" /> <!-- Element documentation should not have default summary -->
|
||||
<Rule Id="SA1609" Action="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="SA1611" Action="None" /> <!-- Element parameters should be documented -->
|
||||
<Rule Id="SA1612" Action="Warning" /> <!-- Element parameter documentation should match element parameters -->
|
||||
@ -187,13 +180,13 @@
|
||||
<Rule Id="SA1620" Action="Warning" /> <!-- Generic type parameter documentation should match type parameters -->
|
||||
<Rule Id="SA1621" Action="Warning" /> <!-- Generic type parameter documentation should declare parameter name -->
|
||||
<Rule Id="SA1622" Action="Warning" /> <!-- Generic type parameter documentation should have text -->
|
||||
<Rule Id="SA1623" Action="Warning"/> <!-- Property summary documentation should match accessors -->
|
||||
<Rule Id="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="SA1625" Action="Warning" /> <!-- Element documentation should not be copied and pasted -->
|
||||
<Rule Id="SA1626" Action="Warning" /> <!-- Single-line comments should not use documentation style slashes -->
|
||||
<Rule Id="SA1627" Action="Warning" /> <!-- Documentation text should not be empty -->
|
||||
<Rule Id="SA1628" Action="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="SA1631" Action="Warning" /> <!-- Documentation should meet character percentage -->
|
||||
<Rule Id="SA1632" Action="Warning" /> <!-- Documentation text should meet minimum character length -->
|
||||
@ -216,6 +209,5 @@
|
||||
<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="SA1651" Action="Warning" /> <!-- Do not use placeholder elements -->
|
||||
|
||||
</Rules>
|
||||
</RuleSet>
|
@ -6,7 +6,7 @@ var slnFile = Directory.GetFiles(@".", "*.sln").First();
|
||||
$"""
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
{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)}"))}
|
||||
{'\t'}EndProjectSection
|
||||
""");
|
4
dot.sln
4
dot.sln
@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{AD79881E-7
|
||||
.gitattributes = .gitattributes
|
||||
.gitignore = .gitignore
|
||||
.tgitconfig = .tgitconfig
|
||||
AddMetaFilesToSln.csx = AddMetaFilesToSln.csx
|
||||
build.cake = build.cake
|
||||
code-format.cmd = code-format.cmd
|
||||
CodeCleanupOnSave.csx = CodeCleanupOnSave.csx
|
||||
@ -31,7 +30,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "meta", "meta", "{AD79881E-7
|
||||
StyleCopAnalyzers.ruleset = StyleCopAnalyzers.ruleset
|
||||
switch-nuget.cmd = switch-nuget.cmd
|
||||
switch-project.cmd = switch-project.cmd
|
||||
switcher.json = switcher.json
|
||||
switcher.nsext.json = switcher.nsext.json
|
||||
SyncMetaFiles.csx = SyncMetaFiles.csx
|
||||
EndProjectSection
|
||||
EndProject
|
||||
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">
|
||||
<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: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>
|
||||
|
@ -4,8 +4,8 @@ using System.Runtime.Versioning;
|
||||
|
||||
namespace Dot.Color;
|
||||
|
||||
[Description(nameof(Str.ScreenPixelTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.ScreenPixelTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
||||
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
|
@ -60,7 +60,7 @@ internal sealed class WinInfo : Form
|
||||
// 绘制底部文字信息
|
||||
_graphics.FillRectangle(Brushes.Black, 0, _WINDOW_SIZE - 30, _WINDOW_SIZE, 30);
|
||||
_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) //
|
||||
, Brushes.White, 0, _WINDOW_SIZE - 20);
|
||||
|
||||
|
@ -5,31 +5,31 @@ namespace Dot;
|
||||
internal class DirOption : OptionBase
|
||||
{
|
||||
[CommandOption("-e|--exclude")]
|
||||
[Description(nameof(Str.ExcludePathRegexes))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.ExcludePathRegexes))]
|
||||
[Localization(typeof(Ln))]
|
||||
public IEnumerable<string> ExcludeRegexes { get; set; }
|
||||
|
||||
[CommandOption("-f|--filter")]
|
||||
[Description(nameof(Str.FileSearchPattern))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.FileSearchPattern))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue("*")]
|
||||
public string Filter { get; set; }
|
||||
|
||||
[CommandOption("-d|--max-depth")]
|
||||
[Description(nameof(Str.MaxRecursionDepth))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.MaxRecursionDepth))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(int.MaxValue)]
|
||||
public int MaxRecursionDepth { get; set; }
|
||||
|
||||
[CommandArgument(0, "[path]")]
|
||||
[Description(nameof(Str.FolderPath))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.FolderPath))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(".")]
|
||||
public string Path { get; set; }
|
||||
|
||||
[CommandOption("-w|--write")]
|
||||
[Description(nameof(Str.WriteMode))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.WriteMode))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(false)]
|
||||
public bool WriteMode { get; set; }
|
||||
}
|
@ -52,7 +52,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
||||
{
|
||||
return !Directory.Exists(Opt.Path)
|
||||
? 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();
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
||||
}
|
||||
|
||||
_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()
|
||||
{
|
||||
if (!Opt.WriteMode) {
|
||||
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, "[gray]{0}[/]", Str.ExerciseMode);
|
||||
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, "[gray]{0}[/]", Ln.ExerciseMode);
|
||||
}
|
||||
|
||||
IEnumerable<string> fileList;
|
||||
@ -93,7 +93,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
||||
, new SpinnerColumn() //
|
||||
, new TaskDescriptionColumn { Alignment = Justify.Left }) //
|
||||
.StartAsync(async ctx => {
|
||||
var taskSearchfile = ctx.AddTask(Str.SearchingFile).IsIndeterminate();
|
||||
var taskSearchfile = ctx.AddTask(Ln.SearchingFile).IsIndeterminate();
|
||||
_childTask = ctx.AddTask("-/-", false);
|
||||
fileList = EnumerateFiles(Opt.Path, Opt.Filter, out _excludeCnt);
|
||||
_totalCnt = fileList.Count();
|
||||
@ -111,7 +111,7 @@ internal abstract class FilesTool<TOption> : ToolBase<TOption>
|
||||
_ = 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
|
||||
|
@ -6,8 +6,8 @@ using NSExt.Extensions;
|
||||
|
||||
namespace Dot.Get;
|
||||
|
||||
[Description(nameof(Str.DownloadTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.DownloadTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed partial class Main : ToolBase<Option>
|
||||
{
|
||||
private const string _PART = "part";
|
||||
@ -17,11 +17,11 @@ internal sealed partial class Main : ToolBase<Option>
|
||||
using var http = new HttpClient();
|
||||
string attachment = 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()
|
||||
.AutoRefresh(true)
|
||||
.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 content = headRsp.Content;
|
||||
contentLength = content.Headers.ContentLength ?? 0;
|
||||
@ -45,7 +45,7 @@ internal sealed partial class Main : ToolBase<Option>
|
||||
, new TaskDescriptionColumn() //
|
||||
, new RemainingTimeColumn()) //
|
||||
.StartAsync(async ctx => {
|
||||
var tParent = ctx.AddTask($"{Str.TotalProgress} {Str.RemainingTime}:").IsIndeterminate();
|
||||
var tParent = ctx.AddTask($"{Ln.TotalProgress} {Ln.RemainingTime}:").IsIndeterminate();
|
||||
|
||||
// 未知文件长度,单线程下载;
|
||||
if (contentLength == 0) {
|
||||
@ -73,7 +73,7 @@ internal sealed partial class Main : ToolBase<Option>
|
||||
, new ParallelOptions { MaxDegreeOfParallelism = Opt.MaxParallel } //
|
||||
, i => {
|
||||
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);
|
||||
var startPos = i * chunkSize;
|
||||
var endPos = startPos + chunkSize - 1;
|
||||
@ -97,7 +97,7 @@ internal sealed partial class Main : ToolBase<Option>
|
||||
});
|
||||
|
||||
AnsiConsole.MarkupLine(
|
||||
$"{Str.DownloadCompleted}, {Str.ElapsedTime}: {DateTime.Now - timer}, {Str.FileSaveLocation}: {mainFilePath}");
|
||||
$"{Ln.DownloadCompleted}, {Ln.ElapsedTime}: {DateTime.Now - timer}, {Ln.FileSaveLocation}: {mainFilePath}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -6,31 +6,31 @@ namespace Dot.Get;
|
||||
internal sealed class Option : OptionBase
|
||||
{
|
||||
[CommandOption("-b|--buffer-size")]
|
||||
[Description(nameof(Str.BufferSize))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.BufferSize))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(8096)]
|
||||
public int BufferSize { get; set; }
|
||||
|
||||
[CommandOption("-c|--chunk-number")]
|
||||
[Description(nameof(Str.ChunkNumbers))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.ChunkNumbers))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(5)]
|
||||
public int ChunkNumbers { get; set; }
|
||||
|
||||
[CommandOption("-m|--max-parallel")]
|
||||
[Description(nameof(Str.MaxParallel))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.MaxParallel))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(5)]
|
||||
public int MaxParallel { get; set; }
|
||||
|
||||
[CommandOption("-o|--output")]
|
||||
[Description(nameof(Str.OutputPath))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.OutputPath))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(".")]
|
||||
public string Output { get; set; }
|
||||
|
||||
[CommandArgument(0, "<url>")]
|
||||
[Description(nameof(Str.Url))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.Url))]
|
||||
[Localization(typeof(Ln))]
|
||||
public string Url { get; set; }
|
||||
}
|
@ -7,8 +7,8 @@ using NSExt.Extensions;
|
||||
|
||||
namespace Dot.Git;
|
||||
|
||||
[Description(nameof(Str.GitTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.GitTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
private Encoding _gitOutputEnc; // git command rsp 编码
|
||||
@ -20,7 +20,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
return !Directory.Exists(Opt.Path)
|
||||
? throw new ArgumentException( //
|
||||
nameof(Opt.Path) //
|
||||
, string.Format(CultureInfo.InvariantCulture, Str.PathNotFound, Opt.Path))
|
||||
, string.Format(CultureInfo.InvariantCulture, Ln.PathNotFound, Opt.Path))
|
||||
: CoreInternal();
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
, new TaskDescriptionColumn { Alignment = Justify.Left }) //
|
||||
.StartAsync(async ctx => {
|
||||
var taskFinder = ctx
|
||||
.AddTask(string.Format(CultureInfo.InvariantCulture, Str.FindGitReps
|
||||
.AddTask(string.Format(CultureInfo.InvariantCulture, Ln.FindGitReps
|
||||
, Opt.Path))
|
||||
.IsIndeterminate();
|
||||
var paths = Directory.GetDirectories(Opt.Path, ".git" //
|
||||
@ -66,11 +66,11 @@ internal sealed class Main : ToolBase<Option>
|
||||
await Parallel.ForEachAsync(tasks, DirHandle);
|
||||
});
|
||||
|
||||
var table = new Table().AddColumn(new TableColumn(Str.Repository) { Width = 50 })
|
||||
.AddColumn(new TableColumn(Str.Command))
|
||||
.AddColumn(new TableColumn(Str.Response) { Width = 50 })
|
||||
var table = new Table().AddColumn(new TableColumn(Ln.Repository) { Width = 50 })
|
||||
.AddColumn(new TableColumn(Ln.Command))
|
||||
.AddColumn(new TableColumn(Ln.Response) { Width = 50 })
|
||||
.Caption(
|
||||
$"{Str.ZeroCode}: [green]{_repoStatus.Count(x => x.Value == TaskStatusColumn.Statues
|
||||
$"{Ln.ZeroCode}: [green]{_repoStatus.Count(x => x.Value == TaskStatusColumn.Statues
|
||||
.Succeed)}[/]/{_repoStatus.Count}");
|
||||
|
||||
foreach (var repo in _repoRsp) {
|
||||
@ -82,7 +82,9 @@ internal sealed class Main : ToolBase<Option>
|
||||
AnsiConsole.Write(table);
|
||||
}
|
||||
|
||||
#pragma warning disable SA1313
|
||||
private async ValueTask DirHandle(KeyValuePair<string, ProgressTask> payload, CancellationToken _)
|
||||
#pragma warning restore SA1313
|
||||
{
|
||||
payload.Value.StartTask();
|
||||
payload.Value.State.Status(TaskStatusColumn.Statues.Executing);
|
||||
|
@ -6,26 +6,26 @@ namespace Dot.Git;
|
||||
internal sealed class Option : OptionBase
|
||||
{
|
||||
[CommandOption("-a|--args")]
|
||||
[Description(nameof(Str.GitArgs))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.GitArgs))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue("status")]
|
||||
public string Args { get; set; }
|
||||
|
||||
[CommandOption("-e|--git-output-encoding")]
|
||||
[Description(nameof(Str.GitOutputEncoding))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.GitOutputEncoding))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue("utf-8")]
|
||||
public string GitOutputEncoding { get; set; }
|
||||
|
||||
[CommandOption("-d|--max-recursion-depth")]
|
||||
[Description(nameof(Str.MaxRecursionDepth))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.MaxRecursionDepth))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(int.MaxValue)]
|
||||
public int MaxRecursionDepth { get; set; }
|
||||
|
||||
[CommandArgument(0, "[path]")]
|
||||
[Description(nameof(Str.FolderPath))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.FolderPath))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(".")]
|
||||
public string Path { get; set; }
|
||||
}
|
@ -10,18 +10,34 @@ internal sealed class TaskStatusColumn : ProgressColumn
|
||||
{
|
||||
public enum Statues : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Ready
|
||||
/// </summary>
|
||||
[Description($"[gray]{nameof(Ready)}[/]")]
|
||||
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
Ready
|
||||
|
||||
, [Description($"[yellow]{nameof(Executing)}[/]")]
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// Executing
|
||||
/// </summary>
|
||||
[Description($"[yellow]{nameof(Executing)}[/]")]
|
||||
Executing
|
||||
|
||||
, [Description($"[green]{nameof(Succeed)}[/]")]
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// Succeed
|
||||
/// </summary>
|
||||
[Description($"[green]{nameof(Succeed)}[/]")]
|
||||
Succeed
|
||||
|
||||
, [Description($"[red]{nameof(Failed)}[/]")]
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// Failed
|
||||
/// </summary>
|
||||
[Description($"[red]{nameof(Failed)}[/]")]
|
||||
Failed
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,8 @@ using TextCopy;
|
||||
|
||||
namespace Dot.Guid;
|
||||
|
||||
[Description(nameof(Str.GuidTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.GuidTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
protected override Task Core()
|
||||
@ -17,7 +17,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
guid = guid.ToUpper(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
Console.WriteLine(Str.Copied, guid);
|
||||
Console.WriteLine(Ln.Copied, guid);
|
||||
#if NET7_0_WINDOWS
|
||||
ClipboardService.SetText(guid);
|
||||
#endif
|
||||
|
@ -6,8 +6,8 @@ namespace Dot.Guid;
|
||||
internal sealed class Option : OptionBase
|
||||
{
|
||||
[CommandOption("-u|--upper")]
|
||||
[Description(nameof(Str.UseUppercase))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.UseUppercase))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(false)]
|
||||
public bool Upper { get; set; }
|
||||
}
|
@ -5,8 +5,8 @@ using System.Net.Sockets;
|
||||
|
||||
namespace Dot.IP;
|
||||
|
||||
[Description(nameof(Str.Ip))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.Ip))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
protected override async Task Core()
|
||||
@ -26,7 +26,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
}
|
||||
|
||||
using var http = new HttpClient();
|
||||
Console.Write(Str.PublicIP);
|
||||
Console.Write(Ln.PublicIP);
|
||||
var str = await http.GetStringAsync("http://httpbin.org/ip");
|
||||
Console.WriteLine(str);
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ using TextCopy;
|
||||
|
||||
namespace Dot.Json;
|
||||
|
||||
[Description(nameof(Str.Json))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.Json))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
private object _inputObj;
|
||||
@ -24,7 +24,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
}
|
||||
#endif
|
||||
if (inputText.NullOrWhiteSpace()) {
|
||||
throw new ArgumentException(Str.InputTextIsEmpty);
|
||||
throw new ArgumentException(Ln.InputTextIsEmpty);
|
||||
}
|
||||
|
||||
try {
|
||||
@ -40,7 +40,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
// ignored
|
||||
}
|
||||
|
||||
throw new ArgumentException(Str.InvalidJsonString);
|
||||
throw new ArgumentException(Ln.InvalidJsonString);
|
||||
}
|
||||
|
||||
return CoreInternal();
|
||||
|
@ -6,25 +6,25 @@ namespace Dot.Json;
|
||||
internal sealed class Option : OptionBase
|
||||
{
|
||||
[CommandOption("-c|--compress")]
|
||||
[Description(nameof(Str.CompressJson))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.CompressJson))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(false)]
|
||||
public bool Compress { get; set; }
|
||||
|
||||
[CommandOption("-s|--convert-to-string")]
|
||||
[Description(nameof(Str.JsonToString))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.JsonToString))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(false)]
|
||||
public bool ConvertToString { get; set; }
|
||||
|
||||
[CommandOption("-f|--format")]
|
||||
[Description(nameof(Str.FormatJson))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.FormatJson))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(true)]
|
||||
public bool Format { get; set; }
|
||||
|
||||
[CommandArgument(0, "[input text]")]
|
||||
[Description(nameof(Str.TextTobeProcessed))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TextTobeProcessed))]
|
||||
[Localization(typeof(Ln))]
|
||||
public string InputText { get; set; }
|
||||
}
|
@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<root>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
|
||||
id="root"
|
||||
xmlns="">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
@ -63,7 +61,6 @@
|
||||
<data name="TextTobeProcessed" xml:space="preserve">
|
||||
<value>要处理的文本(默认取取剪贴板值)</value>
|
||||
</data>
|
||||
|
||||
<data name="Copied" xml:space="preserve">
|
||||
<value>{0}(已复制到剪贴板)</value>
|
||||
</data>
|
||||
@ -130,15 +127,12 @@
|
||||
<data name="RandomPasswordGenerator" xml:space="preserve">
|
||||
<value>随机密码生成器</value>
|
||||
</data>
|
||||
|
||||
<data name="PwdLength" xml:space="preserve">
|
||||
<value>密码长度</value>
|
||||
</data>
|
||||
|
||||
<data name="PwdGenerateTypes" xml:space="preserve">
|
||||
<value>BitSet 1:[0-9],2:[a-z],4:[A-Z],8:[ascii.0x21-0x2F]</value>
|
||||
</data>
|
||||
|
||||
<data name="RemoveTrailingWhiteSpaces" xml:space="preserve">
|
||||
<value>移除文件尾部换行和空格</value>
|
||||
</data>
|
||||
@ -205,11 +199,9 @@
|
||||
<data name="Read" xml:space="preserve">
|
||||
<value>读取</value>
|
||||
</data>
|
||||
|
||||
<data name="Write" xml:space="preserve">
|
||||
<value>写入</value>
|
||||
</data>
|
||||
|
||||
<data name="Break" xml:space="preserve">
|
||||
<value>跳过</value>
|
||||
</data>
|
@ -27,14 +27,14 @@ namespace Dot.Lang {
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal sealed class Str {
|
||||
internal sealed class Ln {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Str() {
|
||||
internal Ln() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -44,7 +44,7 @@ namespace Dot.Lang {
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
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;
|
||||
}
|
||||
return resourceMan;
|
||||
@ -67,7 +67,7 @@ namespace Dot.Lang {
|
||||
|
||||
<#
|
||||
var xml = new XmlDocument();
|
||||
xml.Load("Str.resx");
|
||||
xml.Load("Ln.resx");
|
||||
foreach (XmlNode data in xml.SelectNodes("//root/data")!)
|
||||
{
|
||||
#>
|
@ -67,8 +67,11 @@ internal sealed class MouseHook : IDisposable
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
private readonly struct Msllhookstruct
|
||||
{
|
||||
[FieldOffset(0)] public readonly int X;
|
||||
[FieldOffset(4)] public readonly int Y;
|
||||
[FieldOffset(0)]
|
||||
public readonly int X;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public readonly int Y;
|
||||
}
|
||||
}
|
||||
#endif
|
@ -87,41 +87,79 @@ internal static partial class Win32
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public readonly struct KbdllhooksStruct
|
||||
{
|
||||
[FieldOffset(0)] public readonly uint vkCode;
|
||||
[FieldOffset(16)] private readonly nint dwExtraInfo;
|
||||
[FieldOffset(8)] private readonly uint flags;
|
||||
[FieldOffset(4)] private readonly uint scanCode;
|
||||
[FieldOffset(12)] private readonly uint time;
|
||||
[FieldOffset(0)]
|
||||
public readonly uint vkCode;
|
||||
|
||||
[FieldOffset(16)]
|
||||
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)]
|
||||
public struct InputStruct
|
||||
{
|
||||
[FieldOffset(8)] public KeybdInputStruct ki;
|
||||
[FieldOffset(0)] public uint type;
|
||||
[FieldOffset(8)]
|
||||
public KeybdInputStruct ki;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public uint type;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct KeybdInputStruct
|
||||
{
|
||||
[FieldOffset(4)] public uint dwFlags;
|
||||
[FieldOffset(0)] public ushort wVk;
|
||||
[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;
|
||||
[FieldOffset(4)]
|
||||
public uint dwFlags;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public ushort wVk;
|
||||
|
||||
[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)]
|
||||
public ref struct Systemtime
|
||||
{
|
||||
[FieldOffset(6)] public ushort wDay;
|
||||
[FieldOffset(4)] public ushort wDayOfWeek;
|
||||
[FieldOffset(8)] 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;
|
||||
[FieldOffset(6)]
|
||||
public ushort wDay;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public ushort wDayOfWeek;
|
||||
|
||||
[FieldOffset(8)]
|
||||
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
|
||||
{
|
||||
[CommandOption("-k|--keep--session")]
|
||||
[Description(nameof(Str.KeepSession))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.KeepSession))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(false)]
|
||||
public bool KeepSession { get; set; }
|
||||
}
|
@ -7,8 +7,8 @@ using TextCopy;
|
||||
|
||||
namespace Dot.Pwd;
|
||||
|
||||
[Description(nameof(Str.RandomPasswordGenerator))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.RandomPasswordGenerator))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
private readonly char[][] _charTable = {
|
||||
@ -55,7 +55,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
}
|
||||
|
||||
var result = new string(pDest, 0, Opt.Length);
|
||||
Console.WriteLine(Str.Copied, result);
|
||||
Console.WriteLine(Ln.Copied, result);
|
||||
#if NET7_0_WINDOWS
|
||||
ClipboardService.SetText(result);
|
||||
#endif
|
||||
|
@ -15,12 +15,12 @@ internal sealed class Option : OptionBase
|
||||
}
|
||||
|
||||
[CommandArgument(1, "<password length>")]
|
||||
[Description(nameof(Str.PwdLength))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.PwdLength))]
|
||||
[Localization(typeof(Ln))]
|
||||
public int Length { get; set; }
|
||||
|
||||
[CommandArgument(0, "<generate type>")]
|
||||
[Description(nameof(Str.PwdGenerateTypes))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.PwdGenerateTypes))]
|
||||
[Localization(typeof(Ln))]
|
||||
public GenerateTypes Type { get; set; }
|
||||
}
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Dot.Rbom;
|
||||
|
||||
[Description(nameof(Str.TrimUtf8Bom))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TrimUtf8Bom))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : FilesTool<Option>
|
||||
{
|
||||
private readonly byte[] _utf8Bom = { 0xef, 0xbb, 0xbf };
|
||||
|
@ -10,8 +10,8 @@ using TextCopy;
|
||||
|
||||
namespace Dot.Text;
|
||||
|
||||
[Description(nameof(Str.TextTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TextTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
#if NET7_0_WINDOWS
|
||||
@ -26,7 +26,7 @@ internal sealed class Main : ToolBase<Option>
|
||||
}
|
||||
#endif
|
||||
if (Opt.Text.NullOrEmpty()) {
|
||||
throw new ArgumentException(Str.InputTextIsEmpty);
|
||||
throw new ArgumentException(Ln.InputTextIsEmpty);
|
||||
}
|
||||
|
||||
ParseAndShow(Opt.Text);
|
||||
|
@ -5,7 +5,7 @@ namespace Dot.Text;
|
||||
internal sealed class Option : OptionBase
|
||||
{
|
||||
[CommandArgument(0, "[input text]")]
|
||||
[Description(nameof(Str.TextTobeProcessed))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TextTobeProcessed))]
|
||||
[Localization(typeof(Ln))]
|
||||
public string Text { get; set; }
|
||||
}
|
@ -5,8 +5,8 @@ using Dot.Native;
|
||||
|
||||
namespace Dot.Time;
|
||||
|
||||
[Description(nameof(Str.TimeTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TimeTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, Str.NtpReceiveDone, $"[green]{_successCnt}[/]"
|
||||
AnsiConsole.MarkupLine(CultureInfo.InvariantCulture, Ln.NtpReceiveDone, $"[green]{_successCnt}[/]"
|
||||
, _ntpServers.Length, $"[yellow]{_offsetAvg:f2}[/]");
|
||||
|
||||
if (Opt.Sync) {
|
||||
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()
|
||||
.AddColumn(new TableColumn(string.Empty))
|
||||
.AddColumn(new TableColumn(string.Empty))
|
||||
.Caption(Str.PressAnyKey)
|
||||
.AddRow(Str.NtpClock, DateTime.Now.AddMilliseconds(-_offsetAvg).ToString("O"))
|
||||
.AddRow(Str.LocalClock, DateTime.Now.ToString("O"));
|
||||
.Caption(Ln.PressAnyKey)
|
||||
.AddRow(Ln.NtpClock, DateTime.Now.AddMilliseconds(-_offsetAvg).ToString("O"))
|
||||
.AddRow(Ln.LocalClock, DateTime.Now.ToString("O"));
|
||||
|
||||
var cts = new CancellationTokenSource();
|
||||
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 _)
|
||||
#pragma warning restore SA1313
|
||||
{
|
||||
payload.Value.StartTask();
|
||||
payload.Value.State.Status(TaskStatusColumn.Statues.Connecting);
|
||||
|
@ -6,14 +6,14 @@ namespace Dot.Time;
|
||||
internal sealed class Option : OptionBase
|
||||
{
|
||||
[CommandOption("-s|--sync")]
|
||||
[Description(nameof(Str.SyncToLocalTime))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.SyncToLocalTime))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(false)]
|
||||
public bool Sync { get; set; }
|
||||
|
||||
[CommandOption("-t|--timeout")]
|
||||
[Description(nameof(Str.TimeoutMillSecs))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TimeoutMillSecs))]
|
||||
[Localization(typeof(Ln))]
|
||||
[DefaultValue(2000)]
|
||||
public int Timeout { get; set; }
|
||||
}
|
@ -10,17 +10,34 @@ internal sealed class TaskStatusColumn : ProgressColumn
|
||||
{
|
||||
public enum Statues : byte
|
||||
{
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
/// <summary>
|
||||
/// Ready
|
||||
/// </summary>
|
||||
[Description($"[gray]{nameof(Ready)}[/]")]
|
||||
Ready
|
||||
|
||||
, [Description($"[yellow]{nameof(Connecting)}[/]")]
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// Connecting
|
||||
/// </summary>
|
||||
[Description($"[yellow]{nameof(Connecting)}[/]")]
|
||||
Connecting
|
||||
|
||||
, [Description($"[green]{nameof(Succeed)}[/]")]
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// Succeed
|
||||
/// </summary>
|
||||
[Description($"[green]{nameof(Succeed)}[/]")]
|
||||
Succeed
|
||||
|
||||
, [Description($"[red]{nameof(Failed)}[/]")]
|
||||
,
|
||||
|
||||
/// <summary>
|
||||
/// Failed
|
||||
/// </summary>
|
||||
[Description($"[red]{nameof(Failed)}[/]")]
|
||||
Failed
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace Dot.ToLf;
|
||||
|
||||
[Description(nameof(Str.ConvertEndOfLineToLF))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.ConvertEndOfLineToLF))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : FilesTool<Option>
|
||||
{
|
||||
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
|
||||
|
@ -18,7 +18,7 @@ internal abstract class ToolBase<TOption> : Command<TOption>
|
||||
{
|
||||
await Core();
|
||||
if (Opt.KeepSession) {
|
||||
AnsiConsole.MarkupLine(Str.PressAnyKey);
|
||||
AnsiConsole.MarkupLine(Ln.PressAnyKey);
|
||||
_ = AnsiConsole.Console.Input.ReadKey(true);
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ using NSExt.Extensions;
|
||||
|
||||
namespace Dot.Tran;
|
||||
|
||||
[Description(nameof(Str.TranslateTool))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.TranslateTool))]
|
||||
[Localization(typeof(Ln))]
|
||||
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
internal sealed class Main : ToolBase<Option>
|
||||
@ -14,8 +14,8 @@ internal sealed class Main : ToolBase<Option>
|
||||
[SupportedOSPlatform(nameof(OSPlatform.Windows))]
|
||||
protected override Task Core()
|
||||
{
|
||||
AnsiConsole.MarkupLine(Str.StartTranslate);
|
||||
AnsiConsole.MarkupLine(Str.HideTranslate);
|
||||
AnsiConsole.MarkupLine(Ln.StartTranslate);
|
||||
AnsiConsole.MarkupLine(Ln.HideTranslate);
|
||||
var th = new Thread(() => {
|
||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||
AppDomain.CurrentDomain.UnhandledException += UnhandledException;
|
||||
|
@ -190,7 +190,7 @@ internal sealed partial class WinMain : Form
|
||||
return;
|
||||
}
|
||||
|
||||
_labelDest.Text = Str.Translating;
|
||||
_labelDest.Text = Ln.Translating;
|
||||
Task.Run(() => {
|
||||
var translateText = TranslateText(clipText);
|
||||
ClipboardService.SetText(translateText);
|
||||
|
@ -4,8 +4,8 @@ using NSExt.Extensions;
|
||||
|
||||
namespace Dot.Trim;
|
||||
|
||||
[Description(nameof(Str.RemoveTrailingWhiteSpaces))]
|
||||
[Localization(typeof(Str))]
|
||||
[Description(nameof(Ln.RemoveTrailingWhiteSpaces))]
|
||||
[Localization(typeof(Ln))]
|
||||
internal sealed class Main : FilesTool<Option>
|
||||
{
|
||||
protected override async ValueTask FileHandle(string file, CancellationToken cancelToken)
|
||||
|
@ -2,14 +2,8 @@
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyTitle>功能全面的实用工具 - 程序员的瑞士军刀</AssemblyTitle>
|
||||
<Copyright>Copyright (c) 2022 nsnail</Copyright>
|
||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<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>
|
||||
<UseWindowsForms Condition="'$(TargetFramework)' == 'net7.0-windows'">true</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
@ -21,15 +15,11 @@
|
||||
<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 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>
|
||||
<EmbeddedResource Update="Lang\Str.resx">
|
||||
<EmbeddedResource Update="Languages\Ln.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Str.Designer.cs</LastGenOutput>
|
||||
<LastGenOutput>Ln.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="../CodeQuality.props" />
|
||||
|
@ -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
|
@ -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
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// TestGet
|
||||
/// </summary>
|
||||
public class TestGet
|
||||
{
|
||||
/// <summary>
|
||||
/// DownloadFile
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void DownloadFile()
|
||||
{
|
||||
@ -27,9 +33,17 @@ public class TestGet
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void Setup() { }
|
||||
|
||||
/// <summary>
|
||||
/// GetFileSha1
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetFileSha1(string file)
|
||||
{
|
||||
using var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
|
@ -17,5 +17,4 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Loading…
x
Reference in New Issue
Block a user