• Windows Phone 7 中拷贝文件到独立存储


    private void CopyToIsolatedStorage()
    {
        using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
        {
            string[] files = new string[] { "下雨天.mp3", "用心听.mp3", "我们的歌.mp3" };

            foreach (var _fileName in files)
            {
                if (!storage.FileExists(_fileName))
               {
                   string _filePath = "Audio/" + _fileName;
                   StreamResourceInfo resource = Application.GetResourceStream(new Uri(_filePath, UriKind.Relative));

                      using (IsolatedStorageFileStream file = storage.CreateFile(_fileName))
                     {
                              int chunkSize = 4096;
                            byte[] bytes = new byte[chunkSize];
                          int byteCount;

                         while ((byteCount = resource.Stream.Read(bytes, 0, chunkSize)) > 0)
                         {
                              file.Write(bytes, 0, byteCount);
                         }
                     }
               }
           }
        }
    }

  • 相关阅读:
    主成分分析法(PCA)答疑
    搜索引擎的高级用法
    Makefile 编写实例
    GCC常用命令
    一个进程最多能开多少个线程?
    归并排序
    选择排序(数组、链表)
    求连续子数组的最大和
    生产者-消费者问题(1)
    基于cmake编译安装MySQL-5.5
  • 原文地址:https://www.cnblogs.com/qiuyueguangxuan/p/3991520.html
Copyright © 2020-2023  润新知