Example #1
0
        public void GetFileReturnsWrapper()
        {
            storage.CreateFile("test.js").Close();

            var directory = new IsolatedStorageDirectory(() => storage);
            var file      = directory.GetFile("test.js");

            file.ShouldBeType <IsolatedStorageFile>();
            file.FullPath.ShouldEqual("~/test.js");
            file.Directory.ShouldBeSameAs(directory);
        }
Example #2
0
 public IsolatedStorageFileWrapper_Tests()
 {
     storage   = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForAssembly();
     directory = new IsolatedStorageDirectory(storage);
     using (var stream = storage.CreateFile("exists.js"))
     {
         "content".AsStream().CopyTo(stream);
         stream.Flush();
     }
 }
 public IsolatedStorageFileWrapper_Tests()
 {
     storage = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForAssembly();
     directory = new IsolatedStorageDirectory(storage);
     using (var stream = storage.CreateFile("exists.js"))
     {
         "content".AsStream().CopyTo(stream);
         stream.Flush();
     }
 }
Example #4
0
 void PhotoTask_Completed(object sender, PhotoResult e)
 {
     if (e.TaskResult == TaskResult.OK && e.ChosenPhoto != null)
     {
         System.Windows.Media.Imaging.WriteableBitmap  bmp = Microsoft.Phone.PictureDecoder.DecodeJpeg(e.ChosenPhoto);
         System.IO.IsolatedStorage.IsolatedStorageFile isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
         if (isf.FileExists("back_temp.jpg"))
         {
             isf.DeleteFile("back_temp.jpg");
         }
         System.IO.IsolatedStorage.IsolatedStorageFileStream PhotoStream = isf.CreateFile("back_temp.jpg");
         System.Windows.Media.Imaging.Extensions.SaveJpeg(bmp, PhotoStream, 1024, 768, 0, 100); //这里设置保存后图片的大小、品质
         PhotoStream.Close();                                                                   //写入完毕,关闭文件流
     }
 }
Example #5
0
        internal static void SaveDataBase(string databasename)
        {
            var collections = GetCollections(databasename);

            foreach (var coll in collections)
            {
                SaveCollection(databasename, coll);
            }

            var es = GetEventStore(databasename);

#if WINDOWS_PHONE
            using (var fs = iss.CreateFile(Path.Combine(Path.Combine(Configuration.BasePath, databasename), "denso.trn")))
#else
            using (var fs = File.Create(Path.Combine(Path.Combine(Configuration.BasePath, databasename), "denso.trn")))
#endif
                using (var bw = new BinaryWriter(fs))
                    bw.Write(es.LastExecutedCommandSN);

            es.ShrinkEventStore();
        }