public static bool CopyFiles(MFSFile[] files, ushort dir) { if (disk == null || disk.Format == MFS.DiskFormat.Invalid) { return(false); } foreach (MFSFile file in files) { MFSRAMUtil.WriteFile(disk, MFSRAMUtil.ReadFile(disk, file), file.Name + (file.Ext != "" ? "." + file.Ext : ""), dir); } return(true); }
public static bool AddFileToDirectory(MFSDirectory dir, string filepath) { if (disk == null || disk.Format == MFS.DiskFormat.Invalid) { return(false); } FileStream file = new FileStream(filepath, FileMode.Open); byte[] filedata = new byte[file.Length]; file.Read(filedata, 0, (int)file.Length); file.Close(); return(MFSRAMUtil.WriteFile(disk, filedata, Path.GetFileName(filepath), dir.DirectoryID)); }