This commit is contained in:
2022-12-09 16:39:04 +08:00
parent f4b7c5d0ad
commit 0594ec1836
37 changed files with 276 additions and 183 deletions

View File

@ -2,6 +2,8 @@ using System.Net.Sockets;
namespace Dot.Time;
[Description(nameof(Str.TimeTool))]
[Localization(typeof(Str))]
public sealed class Main : ToolBase<Option>
{
private const int _MAX_DEGREE_OF_PARALLELISM = 10;
@ -31,9 +33,6 @@ public sealed class Main : ToolBase<Option>
private int _successCnt;
public Main(Option opt) : base(opt) { }
private TimeSpan GetNtpOffset(string server)
{
Span<byte> ntpData = stackalloc byte[48];

View File

@ -1,11 +1,17 @@
namespace Dot.Time;
[Verb("time", HelpText = nameof(Str.TimeTool), ResourceType = typeof(Str))]
public class Option : OptionBase
{
[Option('s', "sync", HelpText = nameof(Str.SyncToLocalTime), Default = false, ResourceType = typeof(Str))]
[CommandOption("-s|--sync")]
[Description(nameof(Str.SyncToLocalTime))]
[Localization(typeof(Str))]
[DefaultValue(false)]
public bool Sync { get; set; }
[Option('t', "timeout", HelpText = nameof(Str.TimeoutMillSecs), Default = 2000, ResourceType = typeof(Str))]
[CommandOption("-t|--timeout")]
[Description(nameof(Str.TimeoutMillSecs))]
[Localization(typeof(Str))]
[DefaultValue(2000)]
public int Timeout { get; set; }
}

View File

@ -1,4 +1,3 @@
using System.ComponentModel;
using NSExt.Extensions;
using Spectre.Console.Rendering;