LumiSoft.Net.Core.ScanInvalid_CR_or_LF C# (CSharp) Method

ScanInvalid_CR_or_LF() public static method

Scans invalid CR or LF combination in stream. Returns true if contains invalid CR or LF combination.
public static ScanInvalid_CR_or_LF ( Stream strm ) : bool
strm Stream Stream which to check.
return bool
        public static bool ScanInvalid_CR_or_LF(Stream strm)
        {
            StreamLineReader lineReader = new StreamLineReader(strm);
            byte[] line = lineReader.ReadLine();
            while(line != null){
                foreach(byte b in line){
                    // Contains CR or LF. It cannot conatian such sumbols, because CR must be paired with LF
                    // and we currently reading lines with CRLF combination.
                    if(b == 10 || b == 13){
                        return true;
                    }
                }

                line = lineReader.ReadLine();
            }

            return false;
        }