Version 1.2.0.3.1
Decompiled with IlSpy Fixes Source Code
This commit is contained in:
parent
fd93a0ee5e
commit
0462173018
38 changed files with 243391 additions and 0 deletions
41
Terraria/keyBoardInput.cs
Normal file
41
Terraria/keyBoardInput.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
namespace Terraria
|
||||
{
|
||||
public class keyBoardInput
|
||||
{
|
||||
public class inKey : IMessageFilter
|
||||
{
|
||||
public bool PreFilterMessage(ref Message m)
|
||||
{
|
||||
if (m.Msg == 258)
|
||||
{
|
||||
char c = (char)((int)m.WParam);
|
||||
Console.WriteLine(c);
|
||||
if (keyBoardInput.newKeyEvent != null)
|
||||
{
|
||||
keyBoardInput.newKeyEvent(c);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m.Msg == 256)
|
||||
{
|
||||
IntPtr intPtr = Marshal.AllocHGlobal(Marshal.SizeOf(m));
|
||||
Marshal.StructureToPtr(m, intPtr, true);
|
||||
keyBoardInput.TranslateMessage(intPtr);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static event Action<char> newKeyEvent;
|
||||
[DllImport("user32.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Auto)]
|
||||
public static extern bool TranslateMessage(IntPtr message);
|
||||
static keyBoardInput()
|
||||
{
|
||||
Application.AddMessageFilter(new keyBoardInput.inKey());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue