public MouseActionItem(ActionItem action = null) : base(ActionType.Mouse) { Name = "鼠标动作"; Copy(action); }
public KeyboardActionItem(ActionItem action = null) : base(ActionType.Keyboard) { Name = "键盘动作"; Copy(action); }
private static ActionItem xelement2Action(XElement action, ActionType type) { var act = new ActionItem(type); XAttribute name = action.Attribute("Name"); if (name != null) { act.Name = name.Value; } XAttribute repeat = action.Attribute("RepeatTime"); if (repeat != null) { act.RepeatTime = str2Int(repeat.Value); } XAttribute interval = action.Attribute("Interval"); if (interval != null) { act.Interval = str2Int(interval.Value); } XAttribute wait = action.Attribute("Wait"); if (wait != null) { act.Wait = str2Int(wait.Value); } return act; }
private static XElement action2Element(ActionItem action) { var e = new XElement("Action"); foreach (var i in action.GetType().GetProperties()) { e.Add(new XAttribute(i.Name, i.GetValue(action, null) ?? "")); } return e; }
public void Copy(ActionItem action) { if (action == null) return; Name = action.Name; RepeatTime = action.RepeatTime; Interval = action.Interval; Wait = action.Wait; }