mirror of
https://github.com/nsnail/dot.git
synced 2025-06-17 21:13:21 +08:00
<feat> + 屏幕坐标颜色选取工具
This commit is contained in:
parent
6393132c90
commit
57dc2c7519
13
src/Color/Main.cs
Normal file
13
src/Color/Main.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Dot.Color;
|
||||
|
||||
public sealed class Main : Tool<Option>
|
||||
|
||||
{
|
||||
public Main(Option opt) : base(opt) { }
|
||||
|
||||
public override Task Run()
|
||||
{
|
||||
Application.Run(new WinMain());
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
75
src/Color/MouseHook.cs
Normal file
75
src/Color/MouseHook.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dot.Color;
|
||||
|
||||
public class MouseHook : IDisposable
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
private struct Msllhookstruct
|
||||
{
|
||||
// [FieldOffset(20)] private readonly nint dwExtraInfo;
|
||||
// [FieldOffset(12)] private readonly uint flags;
|
||||
// [FieldOffset(8)] private readonly uint mouseData;
|
||||
// [FieldOffset(16)] private readonly uint time;
|
||||
[FieldOffset(0)] public readonly int X;
|
||||
[FieldOffset(4)] public readonly int Y;
|
||||
}
|
||||
|
||||
|
||||
public event MouseEventHandler MouseEvent = delegate { };
|
||||
private const int _WH_MOUSE_LL = 14;
|
||||
private const int _WM_LBUTTONDOWN = 0x0201;
|
||||
private const int _WM_MOUSEMOVE = 0x0200;
|
||||
private bool _disposed;
|
||||
private readonly nint _hookId;
|
||||
|
||||
public MouseHook()
|
||||
{
|
||||
_hookId = SetHook(HookCallback);
|
||||
}
|
||||
|
||||
~MouseHook()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (_disposed) return;
|
||||
if (disposing) { }
|
||||
|
||||
if (_hookId != default) Win32.UnhookWindowsHookEx(_hookId);
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
|
||||
private nint HookCallback(int nCode, nint wParam, nint lParam)
|
||||
{
|
||||
if (nCode < 0 || (_WM_MOUSEMOVE != wParam && _WM_LBUTTONDOWN != wParam))
|
||||
return Win32.CallNextHookEx(_hookId, nCode, wParam, lParam);
|
||||
var hookStruct = (Msllhookstruct)Marshal.PtrToStructure(lParam, typeof(Msllhookstruct))!;
|
||||
MouseEvent(null, new MouseEventArgs( //
|
||||
wParam == _WM_MOUSEMOVE ? MouseButtons.None : MouseButtons.Left //
|
||||
, 0 //
|
||||
, hookStruct.X //
|
||||
, hookStruct.Y //
|
||||
, 0));
|
||||
return Win32.CallNextHookEx(_hookId, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
private static nint SetHook(Win32.LowLevelMouseProc proc)
|
||||
{
|
||||
using var curProcess = Process.GetCurrentProcess();
|
||||
using var curModule = curProcess.MainModule!;
|
||||
return Win32.SetWindowsHookEx(_WH_MOUSE_LL, proc, Win32.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
4
src/Color/Option.cs
Normal file
4
src/Color/Option.cs
Normal file
@ -0,0 +1,4 @@
|
||||
namespace Dot.Color;
|
||||
|
||||
[Verb("color", HelpText = nameof(Str.ScreenPixelTool), ResourceType = typeof(Str))]
|
||||
public class Option : IOption { }
|
40
src/Color/Win32.cs
Normal file
40
src/Color/Win32.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Dot.Color;
|
||||
|
||||
public static class Win32
|
||||
{
|
||||
public delegate nint LowLevelMouseProc(int nCode, nint wParam, nint lParam);
|
||||
|
||||
private const string _GDI32_DLL = "gdi32.dll";
|
||||
private const string _KERNEL32_DLL = "kernel32.dll";
|
||||
private const string _USER32_DLL = "user32.dll";
|
||||
|
||||
|
||||
[DllImport(_USER32_DLL)]
|
||||
public static extern nint CallNextHookEx(nint hhk, int nCode, nint wParam, nint lParam);
|
||||
|
||||
|
||||
[DllImport(_USER32_DLL)]
|
||||
public static extern nint GetDesktopWindow();
|
||||
|
||||
|
||||
[DllImport(_KERNEL32_DLL, CharSet = CharSet.Unicode)]
|
||||
public static extern nint GetModuleHandle(string lpModuleName);
|
||||
|
||||
[DllImport(_GDI32_DLL)]
|
||||
public static extern uint GetPixel(nint dc, int x, int y);
|
||||
|
||||
[DllImport(_USER32_DLL)]
|
||||
public static extern nint GetWindowDC(nint hWnd);
|
||||
|
||||
[DllImport(_USER32_DLL)]
|
||||
public static extern int ReleaseDC(nint hWnd, nint dc);
|
||||
|
||||
[DllImport(_USER32_DLL)]
|
||||
public static extern nint SetWindowsHookEx(int idHook, LowLevelMouseProc lpfn, nint hMod, uint dwThreadId);
|
||||
|
||||
[DllImport(_USER32_DLL)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool UnhookWindowsHookEx(nint hhk);
|
||||
}
|
70
src/Color/WinInfo.cs
Normal file
70
src/Color/WinInfo.cs
Normal file
@ -0,0 +1,70 @@
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Dot.Color;
|
||||
|
||||
public class WinInfo : Form
|
||||
{
|
||||
private const int _WINDOW_SIZE = 480;
|
||||
private const int _ZOOM_RATE = 16;
|
||||
private bool _disposed;
|
||||
private readonly Graphics _graphics;
|
||||
private readonly PictureBox _pbox;
|
||||
|
||||
public WinInfo()
|
||||
{
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
TopMost = true;
|
||||
MinimizeBox = false;
|
||||
MaximizeBox = false;
|
||||
Size = new Size(_WINDOW_SIZE, _WINDOW_SIZE);
|
||||
StartPosition = FormStartPosition.Manual;
|
||||
Location = new Point(0, 0);
|
||||
_pbox = new PictureBox();
|
||||
_pbox.Location = new Point(0, 0);
|
||||
_pbox.Size = Size;
|
||||
_pbox.Image = new Bitmap(_WINDOW_SIZE, _WINDOW_SIZE);
|
||||
_graphics = Graphics.FromImage(_pbox.Image);
|
||||
_graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
_graphics.CompositingQuality = CompositingQuality.HighQuality;
|
||||
_graphics.SmoothingMode = SmoothingMode.None;
|
||||
Controls.Add(_pbox);
|
||||
}
|
||||
|
||||
|
||||
~WinInfo()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (_disposed) return;
|
||||
if (disposing) {
|
||||
_graphics?.Dispose();
|
||||
_pbox?.Dispose();
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateImage(Bitmap img, int x, int y)
|
||||
{
|
||||
var copySize = new Size(_WINDOW_SIZE / _ZOOM_RATE, _WINDOW_SIZE / _ZOOM_RATE);
|
||||
_graphics.DrawImage(img, new Rectangle(0, 0, _WINDOW_SIZE, _WINDOW_SIZE) //
|
||||
, x - copySize.Width / 2 //
|
||||
, y - copySize.Height / 2 //
|
||||
, copySize.Width, copySize.Height, GraphicsUnit.Pixel);
|
||||
using var pen = new Pen(System.Drawing.Color.Aqua);
|
||||
_graphics.DrawRectangle(pen, _WINDOW_SIZE / 2 - _ZOOM_RATE / 2 //
|
||||
, _WINDOW_SIZE / 2 - _ZOOM_RATE / 2 //
|
||||
, _ZOOM_RATE, _ZOOM_RATE);
|
||||
var posColor = img.GetPixel(x, y);
|
||||
_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})"
|
||||
, new Font(FontFamily.GenericSerif, 10), Brushes.White, 0, _WINDOW_SIZE - 20);
|
||||
_pbox.Refresh();
|
||||
}
|
||||
}
|
68
src/Color/WinMain.cs
Normal file
68
src/Color/WinMain.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using TextCopy;
|
||||
|
||||
namespace Dot.Color;
|
||||
|
||||
public class WinMain : Form
|
||||
{
|
||||
private readonly Bitmap _bmp;
|
||||
private bool _disposed;
|
||||
private readonly WinInfo _winInfo = new();
|
||||
|
||||
public WinMain()
|
||||
{
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Size = Screen.PrimaryScreen!.Bounds.Size;
|
||||
StartPosition = FormStartPosition.Manual;
|
||||
Location = new Point(0, 0);
|
||||
Opacity = 0.01d;
|
||||
_bmp = new Bitmap(Size.Width, Size.Height);
|
||||
using var g = Graphics.FromImage(_bmp);
|
||||
g.CopyFromScreen(0, 0, 0, 0, Size);
|
||||
}
|
||||
|
||||
~WinMain()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (_disposed) return;
|
||||
if (disposing) {
|
||||
_bmp?.Dispose();
|
||||
_winInfo?.Dispose();
|
||||
}
|
||||
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape) Application.Exit();
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
_winInfo.Show();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
var color = _bmp.GetPixel(e.X, e.Y);
|
||||
ClipboardService.SetText(
|
||||
$"{e.X},{e.Y} #{color.R.ToString("X2")}{color.G.ToString("X2")}{color.B.ToString("X2")}({color.R},{color.G},{color.B})");
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
_winInfo.UpdateImage(_bmp, e.X, e.Y);
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
e.Graphics.DrawImage(_bmp, 0, 0);
|
||||
Opacity = 1;
|
||||
}
|
||||
}
|
45
src/Lang/Str.Designer.cs
generated
45
src/Lang/Str.Designer.cs
generated
@ -59,6 +59,15 @@ namespace Dot.Lang {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 单击鼠标左键复制颜色和坐标到剪贴板.
|
||||
/// </summary>
|
||||
public static string ClickCopyColor {
|
||||
get {
|
||||
return ResourceManager.GetString("ClickCopyColor", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 转换换行符为LF.
|
||||
/// </summary>
|
||||
@ -104,15 +113,6 @@ namespace Dot.Lang {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 文本编码工具.
|
||||
/// </summary>
|
||||
public static string HelpForText {
|
||||
get {
|
||||
return ResourceManager.GetString("HelpForText", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 输入文本为空.
|
||||
/// </summary>
|
||||
@ -248,6 +248,15 @@ namespace Dot.Lang {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 屏幕坐标颜色选取工具.
|
||||
/// </summary>
|
||||
public static string ScreenPixelTool {
|
||||
get {
|
||||
return ResourceManager.GetString("ScreenPixelTool", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 查找文件....
|
||||
/// </summary>
|
||||
@ -311,6 +320,15 @@ namespace Dot.Lang {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 文本编码工具.
|
||||
/// </summary>
|
||||
public static string TextTool {
|
||||
get {
|
||||
return ResourceManager.GetString("TextTool", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 连接NTP服务器超时时间 (毫秒).
|
||||
/// </summary>
|
||||
@ -320,6 +338,15 @@ namespace Dot.Lang {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 时间同步工具.
|
||||
/// </summary>
|
||||
public static string TimeTool {
|
||||
get {
|
||||
return ResourceManager.GetString("TimeTool", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 移除文件的uf8 bom.
|
||||
/// </summary>
|
||||
|
@ -1,116 +1,124 @@
|
||||
<?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">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
<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">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<data name="InputTextIsEmpty" xml:space="preserve">
|
||||
</resheader>
|
||||
<data name="InputTextIsEmpty" xml:space="preserve">
|
||||
<value>The input text is empty</value>
|
||||
</data>
|
||||
<data name="SearchingFile" xml:space="preserve">
|
||||
<data name="SearchingFile" xml:space="preserve">
|
||||
<value>Find files...</value>
|
||||
</data>
|
||||
<data name="PathNotFound" xml:space="preserve">
|
||||
<data name="PathNotFound" xml:space="preserve">
|
||||
<value>The specified path "{0}" does not exist</value>
|
||||
</data>
|
||||
<data name="SearchingFileOK" xml:space="preserve">
|
||||
<data name="SearchingFileOK" xml:space="preserve">
|
||||
<value>Find files...OK</value>
|
||||
</data>
|
||||
<data name="ShowMessageTemp" xml:space="preserve">
|
||||
<data name="ShowMessageTemp" xml:space="preserve">
|
||||
<value>Read: {0}/{1}, processed: {2}, skipped: {3}</value>
|
||||
</data>
|
||||
<data name="HelpForText" xml:space="preserve">
|
||||
<value>Text encoding tool</value>
|
||||
</data>
|
||||
<data name="Copied" xml:space="preserve">
|
||||
<data name="Copied" xml:space="preserve">
|
||||
<value>{0}(copied to clipboard)</value>
|
||||
</data>
|
||||
<data name="FileSearchPattern" xml:space="preserve">
|
||||
<data name="FileSearchPattern" xml:space="preserve">
|
||||
<value>File wildcards</value>
|
||||
</data>
|
||||
<data name="FolderPath" xml:space="preserve">
|
||||
<data name="FolderPath" xml:space="preserve">
|
||||
<value>Directory path to be processed</value>
|
||||
</data>
|
||||
<data name="ConvertEndOfLineToLF" xml:space="preserve">
|
||||
<data name="ConvertEndOfLineToLF" xml:space="preserve">
|
||||
<value>Convert newline characters to LF</value>
|
||||
</data>
|
||||
<data name="GuidTool" xml:space="preserve">
|
||||
<data name="GuidTool" xml:space="preserve">
|
||||
<value>GUID tool</value>
|
||||
</data>
|
||||
<data name="UseUppercase" xml:space="preserve">
|
||||
<data name="UseUppercase" xml:space="preserve">
|
||||
<value>Use uppercase output</value>
|
||||
</data>
|
||||
<data name="RandomPasswordGenerator" xml:space="preserve">
|
||||
<data name="RandomPasswordGenerator" xml:space="preserve">
|
||||
<value>Random password generator</value>
|
||||
</data>
|
||||
<data name="PwdLength" xml:space="preserve">
|
||||
<data name="PwdLength" xml:space="preserve">
|
||||
<value>Password length</value>
|
||||
</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>
|
||||
</data>
|
||||
<data name="RemoveTrailingWhiteSpaces" xml:space="preserve">
|
||||
<data name="RemoveTrailingWhiteSpaces" xml:space="preserve">
|
||||
<value>Remove line breaks and spaces at the end of the file</value>
|
||||
</data>
|
||||
<data name="TrimUtf8Bom" xml:space="preserve">
|
||||
<data name="TrimUtf8Bom" xml:space="preserve">
|
||||
<value>Remove the uf8 bom of the file</value>
|
||||
</data>
|
||||
<data name="TextTobeProcessed" xml:space="preserve">
|
||||
<data name="TextTobeProcessed" xml:space="preserve">
|
||||
<value>Text to be processed (clipboard value is taken by default)</value>
|
||||
</data>
|
||||
<data name="PressAnyKey" xml:space="preserve">
|
||||
<data name="PressAnyKey" xml:space="preserve">
|
||||
<value>Press any key to continue...</value>
|
||||
</data>
|
||||
<data name="ReadOnly" xml:space="preserve">
|
||||
<data name="ReadOnly" xml:space="preserve">
|
||||
<value>Read-only mode (only for testing, no actual modification)</value>
|
||||
</data>
|
||||
<data name="NoFileToBeProcessed" xml:space="preserve">
|
||||
<data name="NoFileToBeProcessed" xml:space="preserve">
|
||||
<value>No documents to be processed</value>
|
||||
</data>
|
||||
<data name="TimeoutMillSecs" xml:space="preserve">
|
||||
<data name="TimeoutMillSecs" xml:space="preserve">
|
||||
<value>Timeout for connecting to the NTP server (milliseconds)</value>
|
||||
</data>
|
||||
<data name="SyncToLocalTime" xml:space="preserve">
|
||||
<data name="SyncToLocalTime" xml:space="preserve">
|
||||
<value>Synchronize local time</value>
|
||||
</data>
|
||||
<data name="NtpReceiveDone" xml:space="preserve">
|
||||
<data name="NtpReceiveDone" xml:space="preserve">
|
||||
<value>Success {0}/{1}, the average value of the clock offset of the machine:{2}ms</value>
|
||||
</data>
|
||||
<data name="NtpServerCount" xml:space="preserve">
|
||||
<data name="NtpServerCount" xml:space="preserve">
|
||||
<value>{0}/{1} NTP servers</value>
|
||||
</data>
|
||||
<data name="NtpCalling" xml:space="preserve">
|
||||
<data name="NtpCalling" xml:space="preserve">
|
||||
<value>{0} In communication...</value>
|
||||
</data>
|
||||
<data name="LocalTimeOffset" xml:space="preserve">
|
||||
<data name="LocalTimeOffset" xml:space="preserve">
|
||||
<value>{0}, local clock offset: {1} ms</value>
|
||||
</data>
|
||||
<data name="LocalTimeSyncDone" xml:space="preserve">
|
||||
<data name="LocalTimeSyncDone" xml:space="preserve">
|
||||
<value>Local time has been synchronized</value>
|
||||
</data>
|
||||
<data name="Server" xml:space="preserve">
|
||||
<data name="Server" xml:space="preserve">
|
||||
<value>Server</value>
|
||||
</data>
|
||||
<data name="Status" xml:space="preserve">
|
||||
<data name="Status" xml:space="preserve">
|
||||
<value>Status</value>
|
||||
</data>
|
||||
<data name="LocalClockOffset" xml:space="preserve">
|
||||
<data name="LocalClockOffset" xml:space="preserve">
|
||||
<value>Local clock offset</value>
|
||||
</data>
|
||||
<data name="TimeTool" xml:space="preserve">
|
||||
<value>Time synchronization tool</value>
|
||||
</data>
|
||||
<data name="TextTool" xml:space="preserve">
|
||||
<value>Text encoding tool</value>
|
||||
</data>
|
||||
<data name="ScreenPixelTool" xml:space="preserve">
|
||||
<value>Screen coordinate color selection tool</value>
|
||||
</data>
|
||||
<data name="ClickCopyColor" xml:space="preserve">
|
||||
<value>Click the left mouse button to copy the colors and coordinates to the clipboard</value>
|
||||
</data>
|
||||
</root>
|
@ -39,7 +39,13 @@
|
||||
<data name="ShowMessageTemp" xml:space="preserve">
|
||||
<value>已读取:{0}/{1},处理:{2},跳过:{3}</value>
|
||||
</data>
|
||||
<data name="HelpForText" xml:space="preserve">
|
||||
<data name="TimeTool" xml:space="preserve">
|
||||
<value>时间同步工具</value>
|
||||
</data>
|
||||
<data name="ScreenPixelTool" xml:space="preserve">
|
||||
<value>屏幕坐标颜色选取工具</value>
|
||||
</data>
|
||||
<data name="TextTool" xml:space="preserve">
|
||||
<value>文本编码工具</value>
|
||||
</data>
|
||||
<data name="TextTobeProcessed" xml:space="preserve">
|
||||
@ -122,4 +128,7 @@
|
||||
<data name="LocalClockOffset" xml:space="preserve">
|
||||
<value>Local clock offset</value>
|
||||
</data>
|
||||
<data name="ClickCopyColor" xml:space="preserve">
|
||||
<value>单击鼠标左键复制颜色和坐标到剪贴板</value>
|
||||
</data>
|
||||
</root>
|
@ -31,7 +31,7 @@ public sealed class Main : Tool<Option>, IDisposable
|
||||
{
|
||||
_step2Bar.Tick();
|
||||
ShowMessage(1, 0, 0);
|
||||
var spacesCnt = 0;
|
||||
int spacesCnt;
|
||||
|
||||
await using var fsrw = OpenFileStream(file, FileMode.Open, FileAccess.ReadWrite);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Dot.Text;
|
||||
|
||||
[Verb("text", HelpText = nameof(Str.HelpForText), ResourceType = typeof(Str))]
|
||||
[Verb("text", HelpText = nameof(Str.TextTool), ResourceType = typeof(Str))]
|
||||
public class Option : IOption
|
||||
{
|
||||
[Value(0, HelpText = nameof(Str.TextTobeProcessed), ResourceType = typeof(Str))]
|
||||
|
@ -1,6 +1,6 @@
|
||||
namespace Dot.Time;
|
||||
|
||||
[Verb("time", HelpText = nameof(Str.HelpForText), ResourceType = typeof(Str))]
|
||||
[Verb("time", HelpText = nameof(Str.TimeTool), ResourceType = typeof(Str))]
|
||||
public class Option : IOption
|
||||
{
|
||||
[Option('s', "sync", HelpText = nameof(Str.SyncToLocalTime), Default = false, ResourceType = typeof(Str))]
|
||||
|
@ -14,6 +14,7 @@ public static class ToolsFactory
|
||||
, Text.Option o => new Text.Main(o)
|
||||
, Guid.Option o => new Guid.Main(o)
|
||||
, Time.Option o => new Time.Main(o)
|
||||
, Color.Option o => new Color.Main(o)
|
||||
, _ => throw new ArgumentOutOfRangeException(nameof(option))
|
||||
};
|
||||
}
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>Dot</RootNamespace>
|
||||
<AssemblyName>dot</AssemblyName>
|
||||
<Version>1.1.1</Version>
|
||||
<Version>1.1.2</Version>
|
||||
<Authors>nsnail</Authors>
|
||||
<Copyright>Copyright (c) 2022 nsnail</Copyright>
|
||||
<RepositoryUrl>https://github.com/nsnail/dot.git</RepositoryUrl>
|
||||
@ -29,6 +30,7 @@
|
||||
<PackageReference Include="TextCopy" Version="6.2.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Lang\Str.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
|
Loading…
x
Reference in New Issue
Block a user