Merge branch 'SciSharp:master' into features/refine-conv-filter
This commit is contained in:
commit
a172375bff
|
|
@ -38,7 +38,7 @@
|
||||||
<PackageVersion Include="Nanoid" Version="3.1.0" />
|
<PackageVersion Include="Nanoid" Version="3.1.0" />
|
||||||
<PackageVersion Include="Swashbuckle.AspNetCore" Version="8.1.2" />
|
<PackageVersion Include="Swashbuckle.AspNetCore" Version="8.1.2" />
|
||||||
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
|
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
|
||||||
<PackageVersion Include="Anthropic.SDK" Version="5.1.1" />
|
<PackageVersion Include="Anthropic.SDK" Version="5.5.0" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||||
<PackageVersion Include="NAudio" Version="2.2.1" />
|
<PackageVersion Include="NAudio" Version="2.2.1" />
|
||||||
<PackageVersion Include="NAudio.Core" Version="2.2.1" />
|
<PackageVersion Include="NAudio.Core" Version="2.2.1" />
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ public class CrontabWatcher : BackgroundService
|
||||||
{
|
{
|
||||||
var cron = services.GetRequiredService<ICrontabService>();
|
var cron = services.GetRequiredService<ICrontabService>();
|
||||||
var crons = await cron.GetCrontable();
|
var crons = await cron.GetCrontable();
|
||||||
|
var settings = services.GetRequiredService<CrontabSettings>();
|
||||||
var publisher = services.GetService<IEventPublisher>();
|
var publisher = services.GetService<IEventPublisher>();
|
||||||
|
|
||||||
foreach (var item in crons)
|
foreach (var item in crons)
|
||||||
|
|
@ -87,7 +88,7 @@ public class CrontabWatcher : BackgroundService
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"The current time matches the cron expression {item}");
|
_logger.LogInformation($"The current time matches the cron expression {item}");
|
||||||
|
|
||||||
if (publisher != null)
|
if (publisher != null && settings.EventSubscriber.Enabled)
|
||||||
{
|
{
|
||||||
await publisher.PublishAsync($"Crontab:{item.Title}", item.Cron);
|
await publisher.PublishAsync($"Crontab:{item.Title}", item.Cron);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ public class WinOSDriver : IComputerUse
|
||||||
case "right_click":
|
case "right_click":
|
||||||
WindowsMouseController.RightClick();
|
WindowsMouseController.RightClick();
|
||||||
break;
|
break;
|
||||||
|
case "cursor_position":
|
||||||
|
var (x, y) = WindowsMouseController.GetCurrentCursorPosition();
|
||||||
|
Console.WriteLine($"Current cursor position: ({x}, {y})");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ToolError($"Action {action} is not supported");
|
throw new ToolError($"Action {action} is not supported");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ public class WindowsMouseController
|
||||||
public int Left, Top, Right, Bottom;
|
public int Left, Top, Right, Bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct POINT
|
||||||
|
{
|
||||||
|
public int X;
|
||||||
|
public int Y;
|
||||||
|
}
|
||||||
|
|
||||||
// Define MONITORINFO structure
|
// Define MONITORINFO structure
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct MONITORINFO
|
public struct MONITORINFO
|
||||||
|
|
@ -34,6 +41,10 @@ public class WindowsMouseController
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
||||||
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
|
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool GetCursorPos(out POINT lpPoint);
|
||||||
|
|
||||||
|
|
||||||
// Class to hold monitor information
|
// Class to hold monitor information
|
||||||
public class MonitorInfo
|
public class MonitorInfo
|
||||||
{
|
{
|
||||||
|
|
@ -41,6 +52,13 @@ public class WindowsMouseController
|
||||||
public RECT MonitorArea;
|
public RECT MonitorArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to get current cursor position
|
||||||
|
public static (int x, int y) GetCurrentCursorPosition()
|
||||||
|
{
|
||||||
|
GetCursorPos(out POINT cursorPos);
|
||||||
|
return (cursorPos.X, cursorPos.Y);
|
||||||
|
}
|
||||||
|
|
||||||
// Method to get all connected monitors
|
// Method to get all connected monitors
|
||||||
public static List<MonitorInfo> GetMonitors()
|
public static List<MonitorInfo> GetMonitors()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue