Пример #1
0
 private bool ProcessComment(CharReader charReader)
 {
     if (!charReader.PeekLine().StartsWith("%"))
     {
         return(false);
     }
     FlushTokenBuffer();
     OnToken?.Invoke(TokenType.Comment, charReader.ReadLine().Substring(1));
     return(true);
 }
Пример #2
0
        private bool ProcessXPacket(CharReader charReader)
        {
            if (!charReader.PeekLine().Equals("<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>"))
            {
                return(false);
            }
            FlushTokenBuffer();
            charReader.ReadLine();
            var textBuilder = new StringBuilder();

            while (true)
            {
                var line = charReader.ReadLine();
                if (line.Equals("<?xpacket end=\"w\"?>"))
                {
                    OnToken?.Invoke(TokenType.XPacket, textBuilder.ToString());
                    return(true);
                }
                else if (!string.IsNullOrEmpty(line))
                {
                    textBuilder.AppendLine(line);
                }
            }
        }