-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from vzyrianov/dev
Merge Dev into Master
- Loading branch information
Showing
34 changed files
with
816 additions
and
661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2013 | ||
VisualStudioVersion = 12.0.31101.0 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28307.168 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bukva", "Bukva\Bukva.csproj", "{C539DDE6-B1AA-49C5-87A0-4C68A1DFDB8B}" | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bukva", "Bukva\Bukva.csproj", "{C39F5059-D81E-4068-8E4E-87A5DC7F05F1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C539DDE6-B1AA-49C5-87A0-4C68A1DFDB8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C539DDE6-B1AA-49C5-87A0-4C68A1DFDB8B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C539DDE6-B1AA-49C5-87A0-4C68A1DFDB8B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C539DDE6-B1AA-49C5-87A0-4C68A1DFDB8B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{C39F5059-D81E-4068-8E4E-87A5DC7F05F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C39F5059-D81E-4068-8E4E-87A5DC7F05F1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C39F5059-D81E-4068-8E4E-87A5DC7F05F1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C39F5059-D81E-4068-8E4E-87A5DC7F05F1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {F4A6B472-489B-4112-8CF7-8D9A5E95325E} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="Bukva.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Bukva" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace Bukva | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace Bukva | ||
{ | ||
class FixedLengthQueue<Type> | ||
{ | ||
private readonly int length; | ||
private int position; | ||
|
||
Type[] buffer; | ||
|
||
public FixedLengthQueue(int length) | ||
{ | ||
this.length = length; | ||
buffer = new Type[length]; | ||
position = 0; | ||
} | ||
|
||
public Type At(int index) | ||
{ | ||
return buffer[(index + position) % length]; | ||
} | ||
|
||
public void Insert(Type s) | ||
{ | ||
buffer[position] = s; | ||
position += 1; | ||
|
||
if(position >= length) | ||
{ | ||
position = 0; | ||
} | ||
} | ||
|
||
public void Clear() | ||
{ | ||
buffer = new Type[length]; | ||
position = 0; | ||
} | ||
|
||
public void Clear(Type clearVar) | ||
{ | ||
position = 0; | ||
|
||
for(int i = 0; i < length; ++i) | ||
{ | ||
buffer[i] = clearVar; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
using System.Threading; | ||
using System.Windows.Forms; | ||
|
||
namespace Bukva | ||
{ | ||
class KeyPressListener | ||
{ | ||
public bool Listen { get; set; } | ||
public event EventHandler<KeyPressedEventArgs> OnKeyPressed; | ||
|
||
[DllImport("User32.dll")] | ||
private static extern short GetAsyncKeyState(int vKey); | ||
private Thread keyPressListenerThread; | ||
|
||
public KeyPressListener() | ||
{ | ||
keyPressListenerThread = new Thread(new ThreadStart(() => | ||
{ | ||
while (true) | ||
{ | ||
if(Listen) | ||
{ | ||
ReadKeyPresses(); | ||
Thread.Sleep(10); | ||
} | ||
else | ||
{ | ||
Thread.Sleep(200); | ||
} | ||
} | ||
})); | ||
|
||
keyPressListenerThread.IsBackground = true; | ||
keyPressListenerThread.Start(); | ||
} | ||
|
||
void ReadKeyPresses() | ||
{ | ||
foreach (int i in Enum.GetValues(typeof(Keys))) | ||
{ | ||
if (GetAsyncKeyState(i) == -32767) | ||
{ | ||
string key; | ||
|
||
if(Control.ModifierKeys.HasFlag(Keys.Shift)) | ||
{ | ||
key = Enum.GetName(typeof(Keys), i).ToUpper(); | ||
} | ||
else | ||
{ | ||
key = Enum.GetName(typeof(Keys), i).ToLower(); | ||
} | ||
|
||
if (key.ToUpper() == "OEMPERIOD") | ||
{ | ||
key = "."; | ||
} | ||
|
||
OnKeyPressed(this, new KeyPressedEventArgs(key)); | ||
} | ||
} | ||
} | ||
|
||
public void DeleteLastKeyPressed() | ||
{ | ||
SendKeys.SendWait("{BACKSPACE}"); | ||
} | ||
|
||
public void EmitBackspace() | ||
{ | ||
SendKeys.SendWait("{BACKSPACE}"); | ||
} | ||
} | ||
|
||
public class KeyPressedEventArgs : EventArgs | ||
{ | ||
public string KeyPressed { get; private set; } | ||
|
||
public KeyPressedEventArgs(string key) | ||
{ | ||
KeyPressed = key; | ||
} | ||
} | ||
} |
Oops, something went wrong.