/// <summary>
        ///     For parsing IRCv3 message tags
        /// </summary>
        private void ParseTagsPrefix()
        {
            if (!RawMessage.StartsWith("@"))
            {
                return;
            }

            IsIRCv3Message = true;

            string fullTagsPrefix = RawMessage.Substring(0, RawMessage.IndexOf(' '));

            string[] primitiveTagsCollection = RawMessage.Split(';');

            foreach (string[] splitPrimitiveTag in primitiveTagsCollection.Select(primitiveTag => primitiveTag.Split('=')))
            {
                Tags.Add(splitPrimitiveTag[0], splitPrimitiveTag[1] ?? string.Empty);
            }
        }
Esempio n. 2
0
        private string GetBody( )
        {
            if (String.IsNullOrEmpty(RawMessage))
            {
                return(String.Empty);
            }
            else
            {
                string body = RawMessage.Remove(0, (RawMessage.IndexOf("\r\n\r\n", StringComparison.OrdinalIgnoreCase)));

                try
                {
                    return(String.Compare(ContentTransferEncoding, "base64", StringComparison.OrdinalIgnoreCase) == 0 ? Base64EncodingHelper.Decode(body) : body);
                }
                catch (FormatException)
                {
                    return(body);
                }
            }
        }