// delete directory public static bool DeleteFolder(string path) { if (FolderExists(path)) { try { CLI.WriteLine("Attempting to delete \"" + path + "\"", Graphics.Color.Yellow); Directory.Delete(path, true); if (!FolderExists(path)) { return(true); } else { return(false); } } catch (Exception ex) { CLI.Write("[INTERNAL] ", Graphics.Color.Red); CLI.WriteLine(ex.Message, Graphics.Color.White); return(false); } } else { return(false); } }
public static bool CopyFile(string src, string dest) { try { byte[] sourceData = ReadBytes(src); WriteAllBytes(dest, sourceData); return(true); } catch (Exception ex) { CLI.WriteLine("Error occured when trying to copy file", Graphics.Color.Red); CLI.Write("[INTERNAL] ", Graphics.Color.Red); CLI.WriteLine(ex.Message, Graphics.Color.White); return(false); } }
// get file info public static Cosmos.System.FileSystem.Listing.DirectoryEntry GetFileInfo(string file) { if (FileExists(file)) { try { Cosmos.System.FileSystem.Listing.DirectoryEntry attr = Driver.GetFile(file); return(attr); } catch (Exception ex) { CLI.WriteLine("Error occured when trying to retrieve file info", Graphics.Color.Red); CLI.Write("[INTERNAL] ", Graphics.Color.Red); CLI.WriteLine(ex.Message, Graphics.Color.White); return(null); } } else { CLI.WriteLine("Could not locate file \"" + file + "\"", Graphics.Color.Red); return(null); } }