欢迎来到三一文库! | 帮助中心 三一文库31doc.com 一个上传文档投稿赚钱的网站
三一文库
全部分类
  • 幼儿/小学教育>
  • 中学教育>
  • 高等教育>
  • 研究生考试>
  • 外语学习>
  • 资格/认证考试>
  • 论文>
  • IT计算机>
  • 法律/法学>
  • 建筑/环境>
  • 通信/电子>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 三一文库 > 资源分类 > DOC文档下载
    分享到微信 分享到微博 分享到QQ空间

    操作系统课程设计报告文件管理系统.doc

    • 资源ID:88695       资源大小:2.21MB        全文页数:41页
    • 资源格式: DOC        下载积分:5
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录 微博登录
    二维码
    微信扫一扫登录
    下载资源需要5
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    操作系统课程设计报告文件管理系统.doc

    1、 计算机科学与技术学院课程设计报告 ( 20008 2009 学年度 第 一 学期 )课程名称操作系统课程设计项目名称文件管理系统姓名*学号*专业班级地点教师 一、设计任务及主要技术本设计的目的是通过设计和调试一个简单的文件系统,通过模拟文件操作命令的执行,来模拟文件管理,使学生对主要文件操作命令的实质和执行过程有比较深入的了解,掌握它们的基本实施方法。具体要求如下:设计一个支持n个用户的文件系统,每个用户可拥有多个文件;采用二级或二级以上的多级文件目录管理;对文件应设置存取控制保护方式,如“只能执行”、“允许读”、“允许写”等;系统的外部特征应接近于真实系统,可设置下述文件操作命令:建立文件

    2、打开文件、关闭文件、删除文件、读文件、写文件、复制文件、查询目录;通过键盘使用该文件系统,系统应显示操作命令的执行结果。二、设计方案:主要模仿和实现Windows中”我的电脑”的部分功能系统原理框图:一、 实验源码 :using System;using System.Collections.Generic;using System.Text;using System.IO;using System.Collections;namespace FileDirOperate / / 与文件有关的操作类 / public class FileOperate / / Deletes the fil

    3、e. / / 要删除的文件全路径 / public bool DeleteFile(string FileFullPath) if (File.Exists(FileFullPath) = true) File.SetAttributes(FileFullPath, FileAttributes.Normal); File.Delete(FileFullPath); return true; else return false; / / Gets the name of the file.包括文件的扩展名 / / 文件的全路径 / public string GetFileName(strin

    4、g FileFullPath) if (File.Exists(FileFullPath) = true) FileInfo F = new FileInfo(FileFullPath); return F.Name; else return null; / / Gets the name of the file. / / 文件的全路径 / 是否包含文件的扩展名 / public string GetFileName(string FileFullPath, bool IncludeExtension) if (File.Exists(FileFullPath) = true) FileInf

    5、o F = new FileInfo(FileFullPath); if (IncludeExtension = true) return F.Name; else return F.Name.Replace(F.Extension, ); else return null; / / 得到文件的大小 / / FileInfo / public String getFileSize(FileInfo info) if (info.Exists = true) long FL =info.Length; if (FL 1024 * 1024 * 1024) / KB MB GB TB return

    6、 System.Convert.ToString(Math.Round(FL + 0.00) / (1024 * 1024 * 1024), 2) + GB; else if (FL 1024 * 1024) return System.Convert.ToString(Math.Round(FL + 0.00) / (1024 * 1024), 2) + MB; else return System.Convert.ToString(Math.Round(FL + 0.00) / 1024, 2) + KB; else return null; / / 得到文件的后缀名 / / FileIn

    7、fo / public String getFileExtension(FileInfo info) if (info.Exists = true) String extension=info.Extension; return extension;/.Substring(1); / return extension.Substring(1, extension.Length - 1); else return null; / / Gets the file extension. / / The file full path. / public string GetFileExtension(

    8、string FileFullPath) if (File.Exists(FileFullPath) = true) FileInfo F = new FileInfo(FileFullPath); return F.Extension; else return null; / / Opens the file. / / The file full path. / public bool OpenFile(string FileFullPath) if (File.Exists(FileFullPath) = true) System.Diagnostics.Process.Start(Fil

    9、eFullPath); return true; else return false; / / Gets the size of the file. / / The file full path. / public string GetFileSize(string FileFullPath) if (File.Exists(FileFullPath) = true) FileInfo F = new FileInfo(FileFullPath); long FL = F.Length; if (FL 1024 * 1024 * 1024) / KB MB GB TB return Syste

    10、m.Convert.ToString(Math.Round(FL + 0.00) / (1024 * 1024 * 1024), 2) + GB; else if (FL 1024 * 1024) return System.Convert.ToString(Math.Round(FL + 0.00) / (1024 * 1024), 2) + MB; else return System.Convert.ToString(Math.Round(FL + 0.00) / 1024, 2) + KB; else return null; / / Files to stream byte. / /

    11、 The file full path. / public byte FileToStreamByte(string FileFullPath) byte fileData = null; if (File.Exists(FileFullPath) = true) FileStream FS = new FileStream(FileFullPath, System.IO.FileMode.Open); fileData = new byteFS.Length; FS.Read(fileData, 0, fileData.Length); FS.Close(); return fileData

    12、 else return null; / / Bytes the stream to file. / / The create file full path. / The stream byte. / public bool ByteStreamToFile(string CreateFileFullPath, byte StreamByte) try if (File.Exists(CreateFileFullPath) = true) DeleteFile(CreateFileFullPath); FileStream FS; FS = File.Create(CreateFileFul

    13、lPath); FS.Write(StreamByte, 0, StreamByte.Length); FS.Close(); return true; catch return false; / / 序列化XML文件 / / The file full path. / public bool SerializeXmlFile(string FileFullPath) try System.Data.DataSet DS = new System.Data.DataSet(); DS.ReadXml(FileFullPath); FileStream FS = new FileStream(F

    14、ileFullPath + .tmp, FileMode.OpenOrCreate); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter FT = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); FT.Serialize(FS, DS); FS.Close(); DeleteFile(FileFullPath); File.Move(FileFullPath + .tmp, FileFullPath); return true;

    15、 catch return false; / / 反序列化XML文件 / / The file full path. / public bool DeserializeXmlFile(string FileFullPath) try System.Data.DataSet DS = new System.Data.DataSet(); FileStream FS = new FileStream(FileFullPath, FileMode.Open); System.Runtime.Serialization.Formatters.Binary.BinaryFormatter FT = ne

    16、w System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); (System.Data.DataSet)FT.Deserialize(FS).WriteXml(FileFullPath + .tmp); FS.Close(); DeleteFile(FileFullPath); File.Move(FileFullPath + .tmp, FileFullPath); return true; catch return false; / / 得到文件的创建时间 / / / public String getFileCre

    17、ateTime(FileInfo info) return info.CreationTime.ToString(); / / 得到文件最后一次修改时间 / / / public String getFileLastModifyTime(FileInfo info) return info.LastWriteTime.ToString(); / / 与文件夹有关的操作类 / public class DirOperate public enum OperateOption / / 存在删除再创建 / ExistDelete, / / 存在直接返回 / ExistReturn / / 创建文件夹

    18、 / / The dir full path. / The dir operate option. / public bool CreateDir(string DirFullPath, OperateOption DirOperateOption) try if (Directory.Exists(DirFullPath) = false) Directory.CreateDirectory(DirFullPath); else if (DirOperateOption = OperateOption.ExistDelete) Directory.Delete(DirFullPath, tr

    19、ue); return true; catch return false; / / 删除文件夹 / / The dir full path. / 成功则为True 否则为False public bool DeleteDir(string DirFullPath) if (Directory.Exists(DirFullPath) = true) Directory.Delete(DirFullPath, true); return true; else return false; / / Gets the dir files. / / The dir full path. / public

    20、string GetDirFiles(string DirFullPath) string FileList = null; if (Directory.Exists(DirFullPath) = true) FileList = Directory.GetFiles(DirFullPath, *.*, SearchOption.TopDirectoryOnly); return FileList; / / Gets the dir files. / / The dir full path. / The SO. / public string GetDirFiles(string DirFul

    21、lPath, SearchOption SO) string FileList = null; if (Directory.Exists(DirFullPath) = true) FileList = Directory.GetFiles(DirFullPath, *.*, SO); return FileList; ArrayList filelist = new ArrayList(); public ArrayList getDirFiles(String DirFullpath, String pattern) if (Directory.Exists(DirFullpath) Dir

    22、ectoryInfo inf = new DirectoryInfo(DirFullpath); FileSystemInfo infos = inf.GetFileSystemInfos(); foreach (FileSystemInfo info in infos) if (info is FileInfo) if(info.Name.Contains(pattern) filelist.Add(info.FullName); else if (info.Name.Contains(pattern) filelist.Add(info.FullName); getDirFiles(inf

    23、o.FullName, pattern); return filelist; / / Gets the dir files. / / The dir full path. / The search pattern. / 所有文件 public string GetDirFiles(string DirFullPath, string SearchPattern) string FileList = null; if (Directory.Exists(DirFullPath) = true) FileList = Directory.GetFiles(DirFullPath, SearchPattern); return FileList; / / Gets the dir files. / / The dir full path. / The search pattern. / The SO. / ret


    注意事项

    本文(操作系统课程设计报告文件管理系统.doc)为本站会员(奥沙丽水)主动上传,三一文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一文库(点击联系客服),我们立即给予删除!




    宁ICP备18001539号-1

    三一文库
    收起
    展开