Ejemplo n.º 1
0
        private Directory DoGetDirectory(string aPath, FileSystem aFS)
        {
            if (aFS == null)
            {
                throw new ArgumentNullException("aFS");
            }
            string[] xPathParts = VFSManager.SplitPath(aPath);

            if (xPathParts.Length == 1)
            {
                return(GetVolume(aFS, aPath));
            }

            Listing.Directory xBaseDirectory = null;

            // start at index 1, because 0 is the volume
            for (int i = 1; i < xPathParts.Length; i++)
            {
                var xPathPart  = xPathParts[i];
                var xPartFound = false;
                var xListing   = aFS.GetDirectoryListing(xBaseDirectory);

                for (int j = 0; j < xListing.Count; j++)
                {
                    var xListingItem = xListing[j];
                    if (String.Equals(xListingItem.Name, xPathPart, StringComparison.OrdinalIgnoreCase))
                    {
                        if (xListingItem is Listing.Directory)
                        {
                            xBaseDirectory = (Listing.Directory)xListingItem;
                            xPartFound     = true;
                        }
                        else
                        {
                            throw new Exception("Path part '" + xPathPart + "' found, but not a directory!");
                        }
                    }
                }

                if (!xPartFound)
                {
                    throw new Exception("Path part '" + xPathPart + "' not found!");
                }
            }
            return(xBaseDirectory);
        }
Ejemplo n.º 2
0
 public override List <Listing.Base> GetDirectoryListing(Listing.Directory aParentDirectory)
 {
     throw new NotImplementedException();
 }