Exemple #1
0
        /// <summary>
        /// Get the directory specified by the Fullname passed
        /// </summary>
        /// <param name="fn">The fullname of the directory</param>
        public static PulsarDirectory GetDirectoryByFullName(String fn)
        {
            PulsarDirectory d = PulsarFileSystem.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);
        }
Exemple #2
0
 /// <summary>
 /// Permits to remove a PulsarDirectory by passing it
 /// </summary>
 /// <param name="PulsarDirectory">The PulsarDirectory to remove</param>
 private void RemoveDirectory(PulsarDirectory PulsarDirectory)
 {
     PulsarDirectory[] subdirs = PulsarDirectory.GetDirs();
     for (int i = 0; i < subdirs.Length; i++)
     {
         PulsarDirectory.RemoveDirectory(subdirs[i]);
     }
     PulsarFile[] subfiles = PulsarDirectory.GetFiles();
     for (int i = 0; i < subdirs.Length; i++)
     {
         PulsarDirectory.RemoveFile(subfiles[i].Name);
     }
     PulsarFileSystem.ClearBlocks(PulsarDirectory.StartBlock);
     DeleteBlock(PulsarDirectory.StartBlock);
 }
Exemple #3
0
        /// <summary>
        /// Get the directory specified by the Fullname passed
        /// </summary>
        /// <param name="fn">The fullname of the directory</param>
        public static PulsarFile GetFileByFullName(String fn)
        {
            PulsarDirectory d = new PulsarDirectory(PulsarFileSystem.mFS.Partition, 1, PulsarFileSystem.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]));
        }