Ejemplo n.º 1
0
        /// <summary>
        /// Get the directory specified by the Fullname passed
        /// </summary>
        /// <param name="fn">The fullname of the directory</param>
        public static NoobDirectory GetDirectoryByFullName(String fn)
        {
            NoobDirectory d = NoobFileSystem.mFS.Root;

            if (fn == d.Name)
            {
                return(d);
            }
            if (fn == null || fn == "")
            {
                return(null);
            }
            String[] names = fn.Split('/');
            if (names[0] != "")
            {
                return(null);
            }
            for (int i = 0; i < names.Length; i++)
            {
                if (names[i] != null && names[i] != "")
                {
                    d = d.GetDirectoryByName(names[i]);
                    if (d == null)
                    {
                        break;
                    }
                }
            }
            return(d);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Permits to remove a NoobDirectory by passing it
 /// </summary>
 /// <param name="noobDirectory">The NoobDirectory to remove</param>
 private void RemoveDirectory(NoobDirectory noobDirectory)
 {
     NoobDirectory[] subdirs = noobDirectory.GetDirs();
     for (int i = 0; i < subdirs.Length; i++)
     {
         noobDirectory.RemoveDirectory(subdirs[i]);
     }
     NoobFile[] subfiles = noobDirectory.GetFiles();
     for (int i = 0; i < subdirs.Length; i++)
     {
         noobDirectory.RemoveFile(subfiles[i].Name);
     }
     NoobFileSystem.ClearBlocks(noobDirectory.StartBlock);
     DeleteBlock(noobDirectory.StartBlock);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Get the directory specified by the Fullname passed
        /// </summary>
        /// <param name="fn">The fullname of the directory</param>
        public static NoobFile GetFileByFullName(String fn)
        {
            NoobDirectory d = new NoobDirectory(NoobFileSystem.mFS.Partition, 1, NoobFileSystem.separator);

            if (fn == null || fn == "")
            {
                return(null);
            }
            String[] names = fn.Split('/');
            for (int i = 0; i < names.Length - 1; i++)
            {
                if (names[i] != "")
                {
                    d = d.GetDirectoryByName(names[i]);
                    if (d == null)
                    {
                        break;
                    }
                }
            }
            return(d.GetFileByName(names[names.Length - 1]));
        }