Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="key">
        /// Key to test this line's key name against.
        /// </param>
        /// <returns>
        /// true if <code>code key.Name.Equals(Key, StringComparison.InvariantCultureIgnoreCase))</code>.
        /// </returns>
        public bool Matches(FooterKey key)
        {
            byte[] kRaw = key.Raw;
            int len = kRaw.Length;
            int bPtr = _keyStart;
            if (_keyEnd - bPtr != len) return false;

            for (int kPtr = 0; bPtr < len; )
            {
                byte b = _buffer[bPtr++];
                if ('A' <= b && b <= 'Z')
                {
                    b += 'a' - 'A';
                }

                if (b != kRaw[kPtr++]) return false;
            }

            return true;
        }
Пример #2
0
        ///	<summary>
        /// Get the values of all footer lines with the given key.
        /// </summary>
        /// <param name="keyName">
        /// footer key to find values of, case insensitive.
        /// </param>
        /// <returns>
        /// values of footers with key of <paramref name="keyName"/>,  ordered by their 
        /// order of appearance. Duplicates may be returned if the same
        /// footer appeared more than once. Empty list if no footers appear
        /// with the specified key, or there are no footers at all.
        /// </returns>
        ///	<seealso cref="GetFooterLines()" />
        public IList<string> GetFooterLines(FooterKey keyName)
        {
            IList<FooterLine> src = GetFooterLines();
            if (src.isEmpty())
            {
                return new List<string>();
            }

            var r = new List<String>(src.Count);
            foreach (FooterLine f in src)
            {
                if (f.Matches(keyName))
                {
                    r.Add(f.Value);
                }
            }
            return r;
        }