Monday, December 29, 2014

UI Thread?

your loop will never finish so that you can change code as follows:



public frmmain()
{
InitializeComponent();
BlackMagic swr = new BlackMagic();
swr.OpenProcessAndThread(SProcess.GetProcessFromProcessName("Game.exe"));
uint timeraddress = 0x00286C60;


int[] click = new int[15] { 21750, 21916, 22083, 22166, 22250, 22416, 22583, 22749, 22833, 22916, 23000, 23083, 23249, 23416, 23500 };

int offset = 0;
int holdtime = 40;
int clickcounter = 0;
while (clickcounter <= 10)
{

int maptimer = swr.ReadInt(timeraddress);
maptimerlabel.Text = "Map Time: " + maptimer;
if (maptimer >= click[clickcounter] + offset)
{
InputSimulator.SimulateKeyDown(VirtualKeyCode.VK_N);
Thread.Sleep(holdtime);
clickcounter = clickcounter + 1;
InputSimulator.SimulateKeyUp(VirtualKeyCode.VK_N);
}
}

Thread thread = new Thread(new ThreadStart(ChangeMapTimerLabel));
thread.Start();
}
private void ChangeMapTimerLabel()
{
maptimerlabel.Invoke((MethodInvoker)(() => maptimerlabel.Text = "Finished !"));
}

----------------------------------------------


Hope above help !


Doanh


No comments:

Post a Comment