Exemple #1
0
        /// <summary>Choose the byte sequence to mark line endings</summary>
        private byte[] ChooseLineEnding(ILogDataSource src, Encoding encoding)
        {
            var auto_detect = string.IsNullOrEmpty(Settings.Format.LineEnding);

            if (!auto_detect)
            {
                return(Tools.GetLineEnding(Settings.Format.LineEnding));
            }

            // Auto detect the line ending
            using (var stream = src.OpenStream())
                return(Tools.GuessLineEnding(stream, encoding, Settings.LogData.MaxLineLength, out var _));
        }
Exemple #2
0
        /// <summary>Choose an encoding to apply to 'src'</summary>
        private Encoding ChooseEncoding(ILogDataSource src)
        {
            var auto_detect = string.IsNullOrEmpty(Settings.Format.Encoding);

            if (!auto_detect)
            {
                return(Tools.GetEncoding(Settings.Format.Encoding));
            }

            // Auto detect the encoding
            using (var stream = src.OpenStream())
                return(Tools.GuessEncoding(stream, out var _));
        }