示例#1
0
    public ResourceItem GetChild(string aPath, Type aResourceType = Type.Any)
    {
        if (type != Type.Folder)
        {
            return(null);
        }
        string p     = aPath;
        int    index = aPath.IndexOf('/');

        if (index > 0)
        {
            p     = aPath.Substring(0, index);
            aPath = aPath.Substring(index + 1);
        }
        else
        {
            aPath = "";
        }

        ResourceItem item = null;

        if (!childs.TryGetValue(p, out item) || item == null)
        {
            return(null);
        }
        if (aPath.Length > 0)
        {
            return(item.GetChild(aPath, aResourceType));
        }
        if (aResourceType != Type.Unknown && item.type != aResourceType)
        {
            return(null);
        }
        return(item);
    }