public static PulsarDirectory GetDirectoryByFullName(String fn) { PulsarDirectory d = FileSystem.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); }
private void RemoveDirectory(PulsarDirectory PulsarDirectory) { PulsarDirectory[] subdirs = PulsarDirectory.GetDirs(); for (int i = 0; i < subdirs.Length; i++) { PulsarDirectory.RemoveDirectory(subdirs[i]); } File[] subfiles = PulsarDirectory.GetFiles(); for (int i = 0; i < subdirs.Length; i++) { PulsarDirectory.RemoveFile(subfiles[i].Name); } FileSystem.ClearBlocks(PulsarDirectory.StartBlock); DeleteBlock(PulsarDirectory.StartBlock); }
public static File GetFileByFullName(String fn) { PulsarDirectory d = new PulsarDirectory(FileSystem.mFS.Partition, 1, FileSystem.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])); }