巴基斯坦老电影人世间:WP7 隔离存储空间 创建文件 读取文件内容

来源:百度文库 编辑:偶看新闻 时间:2024/04/28 13:25:34
 using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
{
    //判断文件是否存在
    if (!isf.FileExists(Used.strKeyPath))
    {
      //创建文件夹
      isf.CreateDirectory(Used.strMainPath);
      //创建注册文件
      StreamWriter writerKey = new StreamWriter(new IsolatedStorageFileStream(Used.strSignInPath, FileMode.OpenOrCreate, isf));
      writerKey.WriteLine("1");
      writerKey.Close();
      }
      //读取文件内容      if (!isf.DirectoryExists(Used.strSignInPath))
      {
         StreamReader reader = new StreamReader(new IsolatedStorageFileStream(Used.strSignInPath, FileMode.Open, isf));
         Used.strSignIn = reader.ReadLine();
      } }