Unlimited loop support and not using line delay for function, call, wait

This commit is contained in:
Jaex 2015-02-17 16:32:33 +02:00
parent 5897af0163
commit 780c1d3ae8
3 changed files with 47 additions and 27 deletions

View file

@ -134,10 +134,13 @@ public bool Compile(string[] lines)
}
public void Start()
{
if (FunctionList != null)
{
stopRequest = false;
Run(0);
}
}
public void Stop()
{
@ -146,27 +149,27 @@ public void Stop()
public void Run(int startIndex)
{
if (FunctionList != null)
for (int i = startIndex; !stopRequest && i < FunctionList.Count; i++)
{
Function function;
for (int i = startIndex; i < FunctionList.Count && !stopRequest; i++)
{
function = FunctionList[i];
Function function = FunctionList[i];
if (function == null)
{
break;
}
for (int count = 0; count < function.Loop && !stopRequest; count++)
if (function.Loop <= 0)
{
function.Method();
if (LineDelay > 0)
while (!stopRequest)
{
Thread.Sleep(LineDelay);
}
function.Run();
}
}
else
{
for (int count = 0; !stopRequest && count < function.Loop; count++)
{
function.Run();
}
}
}

View file

@ -24,7 +24,6 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
@ -43,6 +42,11 @@ public Function()
Loop = 1;
}
public virtual void Run()
{
Method();
}
public virtual void Prepare()
{
}
@ -52,6 +56,19 @@ public virtual void Method()
}
}
public class Function_Method : Function
{
public override void Run()
{
base.Run();
if (FunctionManager.LineDelay > 0)
{
Thread.Sleep(FunctionManager.LineDelay);
}
}
}
public class Function_Call : Function
{
public override void Prepare()
@ -93,7 +110,7 @@ public override void Method()
}
}
public class Function_KeyDown : Function
public class Function_KeyDown : Function_Method
{
public override void Method()
{
@ -102,7 +119,7 @@ public override void Method()
}
}
public class Function_KeyUp : Function
public class Function_KeyUp : Function_Method
{
public override void Method()
{
@ -111,7 +128,7 @@ public override void Method()
}
}
public class Function_KeyPress : Function
public class Function_KeyPress : Function_Method
{
public override void Method()
{
@ -120,7 +137,7 @@ public override void Method()
}
}
public class Function_KeyPressText : Function
public class Function_KeyPressText : Function_Method
{
public override void Method()
{
@ -128,7 +145,7 @@ public override void Method()
}
}
public class Function_MouseDown : Function
public class Function_MouseDown : Function_Method
{
public override void Method()
{
@ -137,7 +154,7 @@ public override void Method()
}
}
public class Function_MouseUp : Function
public class Function_MouseUp : Function_Method
{
public override void Method()
{
@ -146,7 +163,7 @@ public override void Method()
}
}
public class Function_MouseClick : Function
public class Function_MouseClick : Function_Method
{
public override void Method()
{
@ -170,7 +187,7 @@ public override void Method()
}
}
public class Function_MouseMove : Function
public class Function_MouseMove : Function_Method
{
public override void Method()
{
@ -183,7 +200,7 @@ public override void Method()
}
}
public class Function_MouseWheel : Function
public class Function_MouseWheel : Function_Method
{
public override void Method()
{

View file

@ -83,7 +83,7 @@
<Compile Include="Automate\AutomateForm.Designer.cs">
<DependentUpon>AutomateForm.cs</DependentUpon>
</Compile>
<Compile Include="Automate\Function.cs" />
<Compile Include="Automate\Functions.cs" />
<Compile Include="Automate\FunctionManager.cs" />
<Compile Include="Automate\ScriptInfo.cs" />
<Compile Include="ClipboardFormat.cs" />