Ejemplo n.º 1
0
 private PlexFAT.Directory getDirectory(string path)
 {
     //No need for this check. Server already does this.
     //string pathvnum = path.Split(new[] {':'})[0];
     //if (DriveNumber.ToString() != pathvnum)
     //    throw new IO.IOException($"This is drive {DriveNumber}, the path specifies {pathvnum}.");
     string[]          components = path.Split(new[] { '/' });
     PlexFAT.Directory ret        = vol.Root;
     if (components.Length >= 2)
     {
         for (int i = 1; i < components.Length; i++)
         {
             ret = ret.GetSubdirectory(components[i]);
         }
     }
     return(ret);
 }
Ejemplo n.º 2
0
 private void getParent(string path, out PlexFAT.Directory parent, out string fname)
 {
     if (path.EndsWith("/"))
     {
         //Remove last slash if it's the last char in the string.
         path = path.Remove(path.LastIndexOf("/"), 1);
     }
     if (path.Contains("/"))
     {
         int slashpos = path.LastIndexOf("/");
         fname  = path.Substring(slashpos + 1);
         parent = getDirectory(path.Substring(0, slashpos));
     }
     else
     {
         fname  = "";
         parent = vol.Root;
     }
 }
Ejemplo n.º 3
0
        private string[] searchType(string path, EntryType type)
        {
            PlexFAT.Directory dir = getDirectory(path);
            var arr = dir.Contents.Where(n => dir.TypeOf(n) == type).ToArray();
            var lst = new List <string>();

            if (path.EndsWith("/"))
            {
                path = path.Remove(path.LastIndexOf("/"), 1);
            }
            if (type == EntryType.DIRECTORY)
            {
                lst.Add(DriveNumber + path + "/.");
            }
            foreach (var entry in arr)
            {
                lst.Add(DriveNumber + path + "/" + entry);
            }

            return(lst.ToArray());
        }