Exchanged thread.sleep for datetime check to speed up operations

This commit is contained in:
jays2kings 2014-05-06 15:04:42 -04:00
parent c52929f5fa
commit d88928905d

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using DS4Library; using DS4Library;
using System.Threading;
namespace DS4Control namespace DS4Control
{ {
public class Mapping public class Mapping
@ -161,13 +160,21 @@ namespace DS4Control
} }
if (pressagain && gkp.current.scanCodeCount != 0) if (pressagain && gkp.current.scanCodeCount != 0)
{ {
now = DateTime.Now;
if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain)
{
oldnow = now;
InputMethods.performSCKeyPress(kvp.Key); InputMethods.performSCKeyPress(kvp.Key);
Thread.Sleep(25); }
} }
else if (pressagain) else if (pressagain)
{ {
now = DateTime.Now;
if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain)
{
oldnow = now;
InputMethods.performKeyPress(kvp.Key); InputMethods.performKeyPress(kvp.Key);
Thread.Sleep(25); }
} }
} }