public static int ReadMatches(this AbstractIODevice device, string match, int timeout, out string line) { line = null; DateTime start = DateTime.Now; while ((DateTime.Now - start).TotalMilliseconds < timeout) { string readed; int code = device.ReadLine(out readed); if (code != DotNETCode.SUCCESS) { return(code); } if (!readed.Contains(match)) { continue; } line = readed; return(DotNETCode.SUCCESS); } return(DotNETCode.TIMEOUT); }
public static int ReadMatches(this AbstractIODevice device, string match, out string line) { return(ReadMatches(device, match, DefaultTimeout, out line)); }