public void DragDrop(string srcName, string dstName, int srcOffsetX = 10, int srcOffsetY = 10, int dstOffsetX = 10, int dstOffsetY = 10) { LogErr(CppDll.EBLeftDown(mHwnd, srcName, srcOffsetX, srcOffsetY)); Thread.Sleep(CD); LogErr(CppDll.EBMoveTo(mHwnd, dstName, dstOffsetX, dstOffsetY)); Thread.Sleep(CD); LogErr(CppDll.EBLeftUp(mHwnd, dstName, dstOffsetX, dstOffsetY)); Thread.Sleep(CD); }
// helpers public void Children(string objName, string retName = null) { string name = retName != null ? retName : "_children"; LogErr(CppDll.EBGetAttr(objName, "children", name)); LogErr(CppDll.EBGetAttr(name, "_childrenObjects", name)); if (retName == null) { Trace(CppDll.EBStr(name)); } }
public int IsTrue(string objName) { int result = CppDll.EBIsTrue(objName); if (result < 0) { LogErr("Call EBIsTrue on " + objName + "failed."); return(-1); } return(result); }
public void Run(RemoteHooking.IContext context, String channelName, String workingDir, String initPath, String scriptPath) { try { CppDll.EBInit(); adapter.Run(workingDir, initPath, scriptPath); } catch (Exception ex) { injector.ReportException(ex); } return; }
public void Press(string input) { string[] tokens = ParseInput(input); for (int i = 0; i < tokens.Length; ++i) { CppDll.EBKeyDown(mHwnd, mKeys[tokens[i]]); Thread.Sleep(InnerCD); } Thread.Sleep(CD); for (int i = tokens.Length - 1; i >= 0; --i) { CppDll.EBKeyUp(mHwnd, mKeys[tokens[i]]); Thread.Sleep(InnerCD); } Thread.Sleep(CD); }
private void PushArgs(object[] args) { LogErr(CppDll.EBClearArgBuff()); if (args == null) { return; } for (int i = 0; i < args.Length; ++i) { object o = args[i]; Type t = o.GetType(); if (t == typeof(string)) { string s = (string)o; if (s.Contains(OBJ_PREFIX)) { LogErr(CppDll.EBPushObject(s.Substring(OBJ_PREFIX.Length))); } else { LogErr(CppDll.EBPushString(s)); } } else if (t == typeof(bool)) { LogErr(CppDll.EBPushBool((bool)o)); } else if (t == typeof(double)) { LogErr(CppDll.EBPushDouble((double)o)); } else { LogErr("Unknow arg type: " + o.ToString()); } } }
public void Wheel(string objName, int dz, int offsetX = 10, int offsetY = 10) { LogErr(CppDll.EBWheel(mHwnd, objName, dz, offsetX, offsetY)); Thread.Sleep(CD); }
// mouse public void MoveTo(string objName, int offsetX = 10, int offsetY = 10) { LogErr(CppDll.EBMoveTo(mHwnd, objName, offsetX, offsetY)); Thread.Sleep(CD); }
public void GetParent(string objName, string retName) { LogErr(CppDll.EBGetAttr(objName, "parent", retName)); }
public void FindChild(string objName, string childName, string retName) { LogErr(CppDll.EBClearArgBuff()); LogErr(CppDll.EBPushString(childName)); LogErr(CppDll.EBCallMemberMethod(objName, "_FindChildByName", retName)); }
public string ToStr(string objName) { return(CppDll.EBStr(objName)); }
public void CallMemberMethod(string varName, string methodName, string argStr = null, string retName = null) { PushArgs(ParseArgStr(argStr)); LogErr(CppDll.EBCallMemberMethod(varName, methodName, retName)); }
public void GetModuleObject(string moduleName, string objectName, string varName) { LogErr(CppDll.EBGetDictItem(moduleName + "dict", objectName, varName)); }
public void Dir(string objName) { Trace(CppDll.EBDir(objName)); }
public double GetDouble(string varName, string attrName) { return(CppDll.EBGetFloat(varName, attrName)); }
public long GetInt(string varName, string attrName) { return(CppDll.EBGetInt(varName, attrName)); }
public void GetAttr(string varName1, string attrName, string varName2) { LogErr(CppDll.EBGetAttr(varName1, attrName, varName2)); }
public void GetTupleItem(string dictName, int index, string varName) { LogErr(CppDll.EBGetTupleItem(dictName, index, varName)); }
public void GetDictItem(string dictName, string itemName, string varName) { LogErr(CppDll.EBGetDictItem(dictName, itemName, varName)); }
public void DoubleClick(string objName, int offsetX = 10, int offsetY = 10) { LogErr(CppDll.EBDoubleClick(mHwnd, objName, offsetX, offsetY)); Thread.Sleep(CD); }
public string GetString(string varName, string attrName) { return(CppDll.EBGetString(varName, attrName)); }
public void Import(string moduleName) { LogErr(CppDll.EBImportModule(moduleName)); LogErr(CppDll.EBGetModuleDict(moduleName, moduleName + "dict")); }
public int GetBool(string varName, string attrName) { return(CppDll.EBGetBool(varName, attrName)); }
// python public void Str(string objName) { Trace(CppDll.EBStr(objName)); }