创建一个简单的击键计数器用于统计,单独的Keys,To XML

Create a simple Keystroke counter for statistics, seperate Key's, To XML

我想在 C# 中创建一个小进程来计算我的击键次数并将它们保存到 xml 文件中。每小时一次。我想用这个创建一些关于我打字次数的统计数据。我想象 xml 文件:

结构:

<keystrokes>
    <entry time = [date and time ]>
        <key id = [Key-id]>[Amount of keystrokes]</key>
        <key id = [Key-id]>[Amount of keystrokes]</key>
        .
        .

    </entry>
   .
   .
</keystrokes>

示例:

<keystrokes>
    <entry time = "25.08.2015_14:00_15:00">//counted keystrokes between 14:00 and 15:00
        <key id = "A">34</key>
        <key id = "B">45</key>
        .
        .
    </entry>
   .
   .
</keystrokes>

经常更新当前条目。例如:每 10 秒将计数的击键写入 xml 以防止数据丢失。一个完美的解决方案是集成鼠标点击计数器。

我希望您能解释如何访问击键以及如何使用它们和 C#。 非常感谢。

它基本上是一个具有分析功能的键盘记录器。

要构建键盘记录器本身,请参阅 this SO answer。要收集统计数据,我建议使用 SQLite 数据库:它非常轻巧、易于使用且性能卓越。