예제 #1
0
        public IEnumerable <TModel> GetStartingWith(string path, bool flat)
        {
            var condition = new Func <TModel, bool>(i => i.Path.StartsWith(path));

            if (flat)
            {
                path      = AzurePathHelper.GetValidPathForwardSlashes(path);
                condition = i => i.Path.StartsWith(path) && AzurePathHelper.GetBlobDirectory(i.Path) == path;
            }

            // need to use Values to work on top of moment-in-time snapshot
            return(_items.Values.Where(condition));
        }
        public static List <string> PathToParent(string path, string parentPath)
        {
            if (path == parentPath)
            {
                return(new List <string>());
            }

            if (!path.StartsWith(parentPath))
            {
                throw new InvalidOperationException("Path " + path + " is not starting with parent path " + parentPath);
            }

            var paths = new List <string> {
                path
            };
            var newPath = path;

            while ((newPath = AzurePathHelper.GetBlobDirectory(newPath)) != parentPath)
            {
                paths.Add(newPath);
            }

            return(paths);
        }