日期和日程的对应:
建立文档进行存储。
初始化时,检测指定位置是否有文档,有则调用加载,无则建立。进行日程更改时,提示是否进行日程更改,然后写入文件。
相关函数(命名空间 System.IO ):
合成路径(有四个重载,都是字符串合成)
public static string Combine( string path1, string path2 )
string pathString = System.IO.Path.Combine(folderName, "SubFolder");
合成目录
public static DirectoryInfo CreateDirectory( string path )
System.IO.Directory.CreateDirectory(pathString);
参数
-
path
-
类型:
System.String
要创建的目录路径。
判断文件是否存在
public static bool Exists( string path )
System.IO.File.Exists(pathString)
创建文件(存在则覆盖)
public static FileStream Create( string path, int bufferSize, FileOptions options, FileSecurity fileSecurity )
System.IO.FileStream fs = System.IO.File.Create(pathString)
参数
-
path
-
类型:
System.String
文件的名称。
-
bufferSize
-
类型:
System.Int32
用于读取和写入文件的已放入缓冲区的字节数。
-
options
-
类型:
System.IO.FileOptions
FileOptions 值之一,它描述如何创建或覆盖该文件。
-
fileSecurity
-
类型:
System.Security.AccessControl.FileSecurity
FileSecurity 值之一,它确定文件的访问控制和审核安全性。