Example #1
0
        internal TreePath GetPathFromResourceId(string connectionName, string resId)
        {
            var rootNode = _rootNodes[connectionName];

            if (StringConstants.RootIdentifier.Equals(resId))
            {
                return(GetPath(rootNode));
            }

            string[] components = ResourceIdentifier.GetPath(resId).Split('/'); //NOXLATE
            if (!ResourceIdentifier.IsFolderResource(resId))
            {
                //Fix extension to last component
                components[components.Length - 1] = components[components.Length - 1] + "." + ResourceIdentifier.GetResourceTypeAsString(resId);
            }
            RepositoryItem current = rootNode;

            for (int i = 0; i < components.Length; i++)
            {
                if (current.Contains(components[i]))
                {
                    current = current[components[i]];
                }
                else
                {
                    return(null);
                }
            }
            return(GetPath(current));
        }