/// <summary> /// 创建一个用户操作记录. /// </summary> /// <param name="customType">用户操作的类型.</param> /// <param name="memeber">操作的成员.</param> /// <param name="value">操作的值.</param> /// <param name="wait">操作的等待时间.</param> /// <param name="mark">确定搜索目标的条件.</param> public CustomRecordAction(string customType, string memeber, string value, int wait, ElementMark mark) : base(RecordActionType.Custom) { if (string.IsNullOrEmpty(customType) || string.IsNullOrEmpty(memeber) || null == mark) { throw new ArgumentNullException("customType, memeber, mark", "相关参数不能为空"); } this.customType = customType; this.member = memeber; this.value = string.IsNullOrEmpty(value) ? "null" : value; this.wait = wait < 0 ? 0 : wait; this.mark = mark; }
/// <summary> /// 创建一个用户操作记录. /// </summary> /// <param name="expression">表达式.</param> /// <returns>用户操作记录.</returns> public static CustomRecordAction Create(string expression) { if (string.IsNullOrEmpty(expression)) { throw new ArgumentNullException("expression", "表达式不能为空"); } string[] parts = expression.Split(new string[] { "`,`" }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 2) { throw new ArgumentException("表达式应至少包含 2 项内容", "expression"); } try { return(new CustomRecordAction(parts[1], parts[2], parts[3], Convert.ToInt32(parts[4]), ElementMark.Create(parts[5]))); } catch { throw new ArgumentException("wait, mark", "表达式中的格式可能不正确"); } }
/// <summary> /// 创建一个用户操作记录. /// </summary> /// <param name="customType">用户操作的类型.</param> /// <param name="memeber">操作的成员.</param> /// <param name="value">操作的值.</param> /// <param name="wait">操作的等待时间.</param> /// <param name="mark">确定搜索目标的条件.</param> public CustomRecordAction ( string customType, string memeber, string value, int wait, ElementMark mark ) : base ( RecordActionType.Custom ) { if ( string.IsNullOrEmpty ( customType ) || string.IsNullOrEmpty ( memeber ) || null == mark ) throw new ArgumentNullException ( "customType, memeber, mark", "相关参数不能为空" ); this.customType = customType; this.member = memeber; this.value = string.IsNullOrEmpty ( value ) ? "null" : value; this.wait = wait < 0 ? 0 : wait; this.mark = mark; }