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.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);
}
}
}