예제 #1
0
        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);
        }
예제 #2
0
 public static int ReadMatches(this AbstractIODevice device, string match, out string line)
 {
     return(ReadMatches(device, match, DefaultTimeout, out line));
 }