我目前正在使用 C#、arduino 和 Ikea Dioder 为我的电脑显示器创建流光溢彩。目前硬件部分运行完美;但是,我在检测屏幕部分的平均颜色时遇到了问题。
我正在使用的实现有两个问题:
无全屏游戏支持- 当游戏处于全屏模式时,这两种方法都只返回白色。
public class DirectxColorProvider : IColorProvider
{
private static Device d;
private static Collection<long> colorPoints;
public DirectxColorProvider()
{
PresentParameters present_params = new PresentParameters();
if (d == null)
{
d = new Device(new Direct3D(), 0, DeviceType.Hardware, IntPtr.Zero, CreateFlags.SoftwareVertexProcessing, present_params);
}
if (colorPoints == null)
{
colorPoints = GetColorPoints();
}
}
public byte[] GetColors()
{
var color = new byte[4];
using (var screen = this.CaptureScreen())
{
DataRectangle dr = screen.LockRectangle(LockFlags.None); …Run Code Online (Sandbox Code Playgroud)我有一个在亚马逊购买的无线 USB 遥控器,我想用它来触发程序中的操作。
在 Linux 中连接时,遥控器显示为单独的键盘和鼠标。因此,我正在寻找一种在 C# 中拦截来自远程的键盘事件并在我的应用程序中使用它们的方法。
我考虑过的一些选择...
选项 1 - 读取 /dev/input/by-id 中的文件
在这个文件夹中,有一个名为“usb-SG.Ltd_SG_Control_Mic-if03-mouse”的文件,当我跟踪它时,它确实会产生一些信息。
这并不理想,原因有二:
选项 2 - 使用 HIDSharp
https://www.zer7.com/software/hidsharp
这是一个看起来可以完成我正在寻找的东西的库,但文档非常稀疏。
我目前正在尝试通过 CSOM 提取 SharePoint 2010 网站集的文档历史记录。
我用来完成此操作的代码在这里:
using (var clientContext = new ClientContext("http://localhost/sites/mysite"))
{
File file = clientContext.Web.GetFileByServerRelativeUrl(url);
clientContext.Load(file, f => f.ListItemAllFields);
clientContext.ExecuteQuery();
}
Run Code Online (Sandbox Code Playgroud)
每当我运行此代码时,它都会抛出一个异常,说明:
用户代码未处理服务器异常
值不在预期范围内
请注意: