Add project files.

master
Sean McArdle 2017-03-16 11:09:29 -07:00
parent eef1400ba5
commit 1da9277257
16 changed files with 1022 additions and 0 deletions

22
KeyWatch++.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyWatch++", "KeyWatch++\KeyWatch++.csproj", "{6F96FBBF-CEC2-4C56-B94B-32056CCC49A3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6F96FBBF-CEC2-4C56-B94B-32056CCC49A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F96FBBF-CEC2-4C56-B94B-32056CCC49A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F96FBBF-CEC2-4C56-B94B-32056CCC49A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F96FBBF-CEC2-4C56-B94B-32056CCC49A3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

54
KeyWatch++/App.config Normal file
View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="KeyWatch__.Properties.KeyWatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="KeyWatch__.KeyWatch" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<userSettings>
<KeyWatch__.Properties.KeyWatch>
<setting name="Numlock" serializeAs="String">
<value>False</value>
</setting>
<setting name="Scrolllock" serializeAs="String">
<value>False</value>
</setting>
<setting name="Capslock" serializeAs="String">
<value>False</value>
</setting>
<setting name="NumlockText" serializeAs="String">
<value />
</setting>
<setting name="CapslockText" serializeAs="String">
<value />
</setting>
<setting name="ScrolllockText" serializeAs="String">
<value />
</setting>
</KeyWatch__.Properties.KeyWatch>
<KeyWatch__.KeyWatch>
<setting name="Numlock" serializeAs="bool">
<value>False</value>
</setting>
<setting name="Scrolllock" serializeAs="bool">
<value>False</value>
</setting>
<setting name="Capslock" serializeAs="bool">
<value>False</value>
</setting>
<setting name="NumlockText" serializeAs="String">
<value />
</setting>
<setting name="CapslockText" serializeAs="String">
<value />
</setting>
<setting name="ScrolllockText" serializeAs="String">
<value />
</setting>
</KeyWatch__.KeyWatch>
</userSettings>
</configuration>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura/>
</Weavers>

161
KeyWatch++/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,161 @@
namespace KeyWatch__
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.check_Numlock = new System.Windows.Forms.CheckBox();
this.check_Capslock = new System.Windows.Forms.CheckBox();
this.check_Scrolllock = new System.Windows.Forms.CheckBox();
this.comboBox_numlock = new System.Windows.Forms.ComboBox();
this.comboBox_capslock = new System.Windows.Forms.ComboBox();
this.comboBox_scrolllock = new System.Windows.Forms.ComboBox();
this.groupBox_check = new System.Windows.Forms.GroupBox();
this.groupBox_combo = new System.Windows.Forms.GroupBox();
this.groupBox_check.SuspendLayout();
this.groupBox_combo.SuspendLayout();
this.SuspendLayout();
//
// check_Numlock
//
this.check_Numlock.AutoSize = true;
this.check_Numlock.Location = new System.Drawing.Point(28, 30);
this.check_Numlock.Name = "check_Numlock";
this.check_Numlock.Size = new System.Drawing.Size(68, 17);
this.check_Numlock.TabIndex = 0;
this.check_Numlock.Text = "Numlock";
this.check_Numlock.UseVisualStyleBackColor = true;
this.check_Numlock.CheckedChanged += new System.EventHandler(this.check_Numlock_CheckedChanged);
//
// check_Capslock
//
this.check_Capslock.AutoSize = true;
this.check_Capslock.Location = new System.Drawing.Point(28, 60);
this.check_Capslock.Name = "check_Capslock";
this.check_Capslock.Size = new System.Drawing.Size(70, 17);
this.check_Capslock.TabIndex = 1;
this.check_Capslock.Text = "Capslock";
this.check_Capslock.UseVisualStyleBackColor = true;
this.check_Capslock.CheckedChanged += new System.EventHandler(this.check_Capslock_CheckedChanged);
//
// check_Scrolllock
//
this.check_Scrolllock.AutoSize = true;
this.check_Scrolllock.Location = new System.Drawing.Point(28, 90);
this.check_Scrolllock.Name = "check_Scrolllock";
this.check_Scrolllock.Size = new System.Drawing.Size(72, 17);
this.check_Scrolllock.TabIndex = 2;
this.check_Scrolllock.Text = "Scrolllock";
this.check_Scrolllock.UseVisualStyleBackColor = true;
this.check_Scrolllock.CheckedChanged += new System.EventHandler(this.check_Scrolllock_CheckedChanged);
//
// comboBox_numlock
//
this.comboBox_numlock.FormattingEnabled = true;
this.comboBox_numlock.Items.AddRange(new object[] {
"Enabled",
"Disabled"});
this.comboBox_numlock.Location = new System.Drawing.Point(26, 26);
this.comboBox_numlock.Name = "comboBox_numlock";
this.comboBox_numlock.Size = new System.Drawing.Size(121, 21);
this.comboBox_numlock.TabIndex = 4;
this.comboBox_numlock.SelectedIndexChanged += new System.EventHandler(this.comboBox_numlock_SelectedIndexChanged);
//
// comboBox_capslock
//
this.comboBox_capslock.FormattingEnabled = true;
this.comboBox_capslock.Items.AddRange(new object[] {
"Enabled",
"Disabled"});
this.comboBox_capslock.Location = new System.Drawing.Point(26, 56);
this.comboBox_capslock.Name = "comboBox_capslock";
this.comboBox_capslock.Size = new System.Drawing.Size(121, 21);
this.comboBox_capslock.TabIndex = 5;
this.comboBox_capslock.SelectedIndexChanged += new System.EventHandler(this.comboBox_capslock_SelectedIndexChanged);
//
// comboBox_scrolllock
//
this.comboBox_scrolllock.FormattingEnabled = true;
this.comboBox_scrolllock.Items.AddRange(new object[] {
"Enabled",
"Disabled"});
this.comboBox_scrolllock.Location = new System.Drawing.Point(26, 86);
this.comboBox_scrolllock.Name = "comboBox_scrolllock";
this.comboBox_scrolllock.Size = new System.Drawing.Size(121, 21);
this.comboBox_scrolllock.TabIndex = 6;
this.comboBox_scrolllock.SelectedIndexChanged += new System.EventHandler(this.comboBox_scrolllock_SelectedIndexChanged);
//
// groupBox_check
//
this.groupBox_check.Controls.Add(this.check_Capslock);
this.groupBox_check.Controls.Add(this.check_Numlock);
this.groupBox_check.Controls.Add(this.check_Scrolllock);
this.groupBox_check.Location = new System.Drawing.Point(13, 12);
this.groupBox_check.Name = "groupBox_check";
this.groupBox_check.Size = new System.Drawing.Size(134, 126);
this.groupBox_check.TabIndex = 7;
this.groupBox_check.TabStop = false;
this.groupBox_check.Text = "Keys Monitored";
//
// groupBox_combo
//
this.groupBox_combo.Controls.Add(this.comboBox_scrolllock);
this.groupBox_combo.Controls.Add(this.comboBox_capslock);
this.groupBox_combo.Controls.Add(this.comboBox_numlock);
this.groupBox_combo.Location = new System.Drawing.Point(167, 12);
this.groupBox_combo.Name = "groupBox_combo";
this.groupBox_combo.Size = new System.Drawing.Size(170, 126);
this.groupBox_combo.TabIndex = 8;
this.groupBox_combo.TabStop = false;
this.groupBox_combo.Text = "Desired State";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(350, 150);
this.Controls.Add(this.groupBox_check);
this.Controls.Add(this.groupBox_combo);
this.Name = "Form1";
this.Text = "Configuration";
this.groupBox_check.ResumeLayout(false);
this.groupBox_check.PerformLayout();
this.groupBox_combo.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public System.Windows.Forms.CheckBox check_Numlock;
public System.Windows.Forms.CheckBox check_Capslock;
public System.Windows.Forms.CheckBox check_Scrolllock;
public System.Windows.Forms.ComboBox comboBox_numlock;
public System.Windows.Forms.ComboBox comboBox_capslock;
public System.Windows.Forms.ComboBox comboBox_scrolllock;
private System.Windows.Forms.GroupBox groupBox_check;
private System.Windows.Forms.GroupBox groupBox_combo;
}
}

112
KeyWatch++/Form1.cs Normal file
View File

@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Timers;
using WindowsInput;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Xml.Serialization;
using System.IO;
namespace KeyWatch__
{
public partial class Form1 : Form
{
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]
public static extern short GetKeyState(int keyCode);
static bool CapsLock { get { return (((ushort)GetKeyState(0x14)) & 0xffff) != 0; } }
static bool NumLock { get { return (((ushort)GetKeyState(0x90)) & 0xffff) != 0; } }
static bool ScrollLock { get { return (((ushort)GetKeyState(0x91)) & 0xffff) != 0; } }
private string _numlockSelection;
private string _capslockSelection;
private string _scrolllockSelection;
private System.Timers.Timer _checkKeysTimer = new System.Timers.Timer();
public Form1() {
InitializeComponent();
_checkKeysTimer.Interval = 500;
_checkKeysTimer.AutoReset = true;
_checkKeysTimer.Elapsed += _checkKeysTimer_Elapsed;
_checkKeysTimer.Start();
}
private void _checkKeysTimer_Elapsed(object sender, ElapsedEventArgs e) {
InputSimulator _sim = new InputSimulator();
bool _manageNum = check_Numlock.Checked;
bool _manageCaps = check_Capslock.Checked;
bool _manageScroll = check_Scrolllock.Checked;
bool watching = _manageCaps || _manageNum || _manageScroll;
if (!watching) { return; }
if (_manageNum) {
if (_numlockSelection != null) {
if ((_numlockSelection == "Enabled" && !NumLock) ||
(_numlockSelection == "Disabled" && NumLock)){
_sim.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.NUMLOCK);
Trace.WriteLine(String.Format("{0} - enable Numlock", DateTime.Now));
}
}
}
if (_manageCaps) {
if ((_capslockSelection == "Enabled" && !CapsLock) ||
(_capslockSelection == "Disabled" && CapsLock)) {
_sim.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.CAPITAL);
Trace.WriteLine(String.Format("{0} - disable Capslock", DateTime.Now));
}
}
if (_manageScroll) {
if ((_scrolllockSelection == "Enabled" && !ScrollLock) ||
(_scrolllockSelection == "Disabled" && ScrollLock))
_sim.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.SCROLL);
Trace.WriteLine(String.Format("{0} - disable Scrolllock", DateTime.Now));
}
}
private void comboBox_numlock_SelectedIndexChanged(object sender, EventArgs e) {
_numlockSelection = (string)comboBox_numlock.SelectedItem;
Properties.KeyWatch.Default.NumlockText = _numlockSelection;
Properties.KeyWatch.Default.Save();
}
private void comboBox_capslock_SelectedIndexChanged(object sender, EventArgs e) {
_capslockSelection = (string)comboBox_capslock.SelectedItem;
Properties.KeyWatch.Default.CapslockText = _capslockSelection;
Properties.KeyWatch.Default.Save();
}
private void comboBox_scrolllock_SelectedIndexChanged(object sender, EventArgs e) {
_scrolllockSelection = (string)comboBox_scrolllock.SelectedItem;
Properties.KeyWatch.Default.ScrolllockText = _scrolllockSelection;
Properties.KeyWatch.Default.Save();
}
private void check_Numlock_CheckedChanged(object sender, EventArgs e) {
Properties.KeyWatch.Default.Numlock = check_Numlock.Checked;
Properties.KeyWatch.Default.Save();
}
private void check_Capslock_CheckedChanged(object sender, EventArgs e) {
Properties.KeyWatch.Default.Capslock = check_Capslock.Checked;
Properties.KeyWatch.Default.Save();
}
private void check_Scrolllock_CheckedChanged(object sender, EventArgs e) {
Properties.KeyWatch.Default.Scrolllock = check_Scrolllock.Checked;
Properties.KeyWatch.Default.Save();
}
}
}

120
KeyWatch++/Form1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6F96FBBF-CEC2-4C56-B94B-32056CCC49A3}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KeyWatch__</RootNamespace>
<AssemblyName>KeyWatch++</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsInput, Version=1.0.4.0, Culture=neutral, PublicKeyToken=9b287f7dc5073cad, processorArchitecture=MSIL">
<HintPath>..\packages\InputSimulator.1.0.4.0\lib\net20\WindowsInput.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Properties\KeyWatch.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>KeyWatch.settings</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\KeyWatch.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>KeyWatch.Designer.cs</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AppIcon.bmp" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\live.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="..\packages\InputSimulator.1.0.4.0\lib\net20\WindowsInput.dll">
<Link>WindowsInput.dll</Link>
</Resource>
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.28.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.28.3\build\Fody.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>del "$(ProjectDir)$(OutDir)WindowsInput.dll"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

65
KeyWatch++/Program.cs Normal file
View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KeyWatch__
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new KeyWatchContext());
}
}
public class KeyWatchContext : ApplicationContext
{
NotifyIcon notifyIcon = new NotifyIcon();
Form1 configWindow = new Form1();
public KeyWatchContext() {
MenuItem configMenuItem = new MenuItem("Configuration", new EventHandler(ShowConfig));
MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(Exit));
notifyIcon.Icon = KeyWatch__.Properties.Resources.AppIcon;
notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { configMenuItem, exitMenuItem });
notifyIcon.Visible = true;
LoadSettings();
}
void LoadSettings() {
configWindow.check_Numlock.Checked = Properties.KeyWatch.Default.Numlock;
configWindow.check_Capslock.Checked = Properties.KeyWatch.Default.Capslock;
configWindow.check_Scrolllock.Checked = Properties.KeyWatch.Default.Scrolllock;
configWindow.comboBox_numlock.SelectedItem = Properties.KeyWatch.Default.NumlockText;
configWindow.comboBox_capslock.SelectedItem = Properties.KeyWatch.Default.CapslockText;
configWindow.comboBox_scrolllock.SelectedItem = Properties.KeyWatch.Default.ScrolllockText;
}
void ShowConfig(object sender, EventArgs e) {
// If we are already showing the window meerly focus it.
if (configWindow.Visible)
configWindow.Focus();
else
configWindow.ShowDialog();
}
void Exit(object sender, EventArgs e) {
// We must manually tidy up and remove the icon before we exit.
// Otherwise it will be left behind until the user mouses over.
notifyIcon.Visible = false;
Application.Exit();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("KeyWatch++")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KeyWatch++")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6f96fbbf-cec2-4c56-b94b-32056ccc49a3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace KeyWatch__.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
public sealed partial class KeyWatch : global::System.Configuration.ApplicationSettingsBase {
private static KeyWatch defaultInstance = ((KeyWatch)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new KeyWatch())));
public static KeyWatch Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Numlock {
get {
return ((bool)(this["Numlock"]));
}
set {
this["Numlock"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Scrolllock {
get {
return ((bool)(this["Scrolllock"]));
}
set {
this["Scrolllock"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool Capslock {
get {
return ((bool)(this["Capslock"]));
}
set {
this["Capslock"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string NumlockText {
get {
return ((string)(this["NumlockText"]));
}
set {
this["NumlockText"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string CapslockText {
get {
return ((string)(this["CapslockText"]));
}
set {
this["CapslockText"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ScrolllockText {
get {
return ((string)(this["ScrolllockText"]));
}
set {
this["ScrolllockText"] = value;
}
}
}
}

View File

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="KeyWatch__.Properties" GeneratedClassName="KeyWatch">
<Profiles />
<Settings>
<Setting Name="Numlock" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Scrolllock" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="Capslock" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="NumlockText" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="CapslockText" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ScrolllockText" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace KeyWatch__.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KeyWatch__.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon AppIcon {
get {
object obj = ResourceManager.GetObject("AppIcon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="AppIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\live.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net461" developmentDependency="true" />
<package id="Fody" version="1.28.3" targetFramework="net461" developmentDependency="true" />
<package id="InputSimulator" version="1.0.4.0" targetFramework="net461" />
</packages>