示例#1
0
 public void Close(FileWrapper file)
 {
     lock (this)
     {
         if (_files.ContainsKey(file.Path))
         {
             FileCounter counter = _files[file.Path];
             if (--counter.Count == 0)
             {
                 counter.Stream.Close();
                 _files.Remove(file.Path);
             }
         }
     }
 }
示例#2
0
 public FileWrapper GetFile(string path)
 {
     lock (this)
     {
         FileCounter counter;
         if (!_files.ContainsKey(path))
         {
             var stream = new IsolatedStorageFileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, _storage);
             counter = _files[path] = new FileCounter(stream);
         }
         else
         {
             counter = _files[path];
             counter.Count++;
         }
         return new FileWrapper(path, counter.Stream, this);
     }
 }
示例#3
0
 public FileWrapper GetFile(string path)
 {
     lock (this)
     {
         FileCounter counter;
         if (!_files.ContainsKey(path))
         {
             var stream = new IsolatedStorageFileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, _storage);
             counter = _files[path] = new FileCounter(stream);
         }
         else
         {
             counter = _files[path];
             counter.Count++;
         }
         return(new FileWrapper(path, counter.Stream, this));
     }
 }