凤凰新媒体 版权所有 不得转载 lawyer@ifeng.com
京ICP证030609号 本站通用网址:凤凰网
客服电话:(010)84458487 客服邮箱blog@ifeng.com
文件捆绑器详细设计说明书
为了使程序员能够很快的理解此软件的功能,能够很快的编写出该软件,我们通过详细设计说明书去让程序员进一步理解此软件。
说明:
a. 将开发的软件系统的名称:文件捆绑器
b. 本项目的任务提出者:
c. 开发者:吴继林
d. 用户:普通PC用户
e. 操作系统:Windows 2000及以上系统
列出本文件中用到专门术语的定义和外文首字母组词的原词组。
列出有关的参考资料,如:
a. 本项目的经核准的计划任务书或合同、上级机关的批文;
b. 属于本项目的其他已发表的文件;
c. 本文件中各处引用到的文件资料,包括所要用到的软件开发标准。列出这些文件的标题、文件编号、发表日期和出版单位,说明能够取得这些文件的来源。
用一系列图表列出本程序系统内的每个程序(包括每个模块和子程序)的名称、标识符和它们之间 的层次结构关系。
1 输入模块中的函数关系图
GetFinalFileFlag 负责确定最后合成文件图标
OpenFileDialog 负责打开对话框。
SelectBindFile 负责选择需要捆绑的文件。
JudgeFileEffect 负责查看选择的文件是否有效。
DealWithException 负责处理异常。
GetExecuteWay 负责记录最终文件执行方式。
选择模块被放在命名空间InputModule类Input中
1 绑定文件输入
/////////////////////////////////////////////////////
/////namespace:InputModule
/////createdate:2007.7.23
/////author:wujilin
/////update:2007.7.24
/////function:实现待捆绑文件的有效输入
////////////////////////////////////////////////////
namespace InputModule
{
/// <summary>
/// classname:Input
/// function:完成待捆绑文件的有效输入
/// content:包含SelectFileDialog1(),JudgeFileEffect(),GetExecuteWay()
/// FinalFlag() 4个方法
/// </summary>
class Input
{
static OpenFileDialog openFileDialog1;
static string FilePath = " ";
static string temporaryrecord = "liangjian";//用来记录上一次选择的文件路径
static int flag = 1; //防止出现选择到向导的文件
/// <summary>
/// 名称:SelectFileDialog1()
/// 功能:选择待绑定的对话框
/// 输入参数:无
/// 返回类型:string
/// </summary>
/// <returns></returns>
public static string SelectFileDialog1() //选择捆绑文件对话框
{
openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\\"; //定义此对话框的初始化目录
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
FilePath = openFileDialog1.FileName;
if (!JudgeFileEffect()) //判断所选择的文件文件是否有效
{
FilePath = " ";
return FilePath;
}
}
temporaryrecord = FilePath;
return FilePath;
}
/// <summary>
/// 名称:JudgeFileEffect()
/// 功能:判断绑定的文件是否有效
/// 输入参数:无
/// 返回类型;bool
/// </summary>
/// <returns></returns>
public static bool JudgeFileEffect()//判断文件有效性
{
FileInfo fileContent = new FileInfo(FilePath);//注意路径名
string fileExtension = fileContent.Extension;
if (flag == 1)
{
if (fileExtension != ".txt" && fileExtension != ".exe" )
{
InputModule.Execption.fileStyleWrong(); //文件格式不对进行异常处理
return false;
}
else if (fileContent.Length > 1000000)
{
InputModule.Execption.fileTooBig();//文件大小不对
return false;
}
if (temporaryrecord == FilePath) //两次选择的文件名相同
{
InputModule.Execption.fileSame();
return false;
}
else
{
// MessageBox.Show("选择文件有效");
return true;
}
}
else
{
if (fileExtension != ".jpg")
{
InputModule.Execption.fileStyleWrong(); //文件格式不对进行异常处理
return false;
}
else if (fileContent.Length > 1000000)
{
InputModule.Execption.fileTooBig();//文件大小不对
return false;
请登录以后再发表评论。