From d88928905dd8e30f303720dc78b02916259d6ced Mon Sep 17 00:00:00 2001 From: jays2kings Date: Tue, 6 May 2014 15:04:42 -0400 Subject: [PATCH] Exchanged thread.sleep for datetime check to speed up operations --- DS4Control/Mapping.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/DS4Control/Mapping.cs b/DS4Control/Mapping.cs index 2ef55d4..6a6e183 100644 --- a/DS4Control/Mapping.cs +++ b/DS4Control/Mapping.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; using DS4Library; -using System.Threading; namespace DS4Control { public class Mapping @@ -161,13 +160,21 @@ namespace DS4Control } if (pressagain && gkp.current.scanCodeCount != 0) { - InputMethods.performSCKeyPress(kvp.Key); - Thread.Sleep(25); + now = DateTime.Now; + if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain) + { + oldnow = now; + InputMethods.performSCKeyPress(kvp.Key); + } } else if (pressagain) { - InputMethods.performKeyPress(kvp.Key); - Thread.Sleep(25); + now = DateTime.Now; + if (now >= oldnow + TimeSpan.FromMilliseconds(25) && pressagain) + { + oldnow = now; + InputMethods.performKeyPress(kvp.Key); + } } }