FindMember() private method

private FindMember ( byte s, byte slast, int offset ) : TreeEntry
s byte
slast byte
offset int
return TreeEntry
Ejemplo n.º 1
0
        private TreeEntry FindMember(byte[] s, byte slast, int offset)
        {
            int slash;

            for (slash = offset; slash < s.Length && s[slash] != '/'; slash++)
            {
                // search for path component terminator
                // [henon] body is intentionally empty!
            }

            EnsureLoaded();
            byte xlast = slash < s.Length ? (byte)'/' : slast;
            int  p     = BinarySearch(_contents, s, xlast, offset, slash);

            if (p >= 0)
            {
                TreeEntry r = _contents[p];
                if (slash < s.Length - 1)
                {
                    Tree oTree = (r as Tree);
                    return(oTree != null?oTree.FindMember(s, slast, slash + 1) : null);
                }

                return(r);
            }

            return(null);
        }