public IBin Open(BinConfiguration config) { IsolatedStorageFileBin bin = new IsolatedStorageFileBin(config, _store); AddToOpenBinsCollection(bin); RegisterForOnCloseEvent(bin); return bin; }
public IBin Open(BinConfiguration config) { IsolatedStorageFileBin bin = new IsolatedStorageFileBin(config, _store); AddToOpenBinsCollection(bin); RegisterForOnCloseEvent(bin); return(bin); }
public static long FileSize(string uri) { lock (_openBins) { if (IsBinAlreadyOpen(uri)) { IsolatedStorageFileBin bin = _openBins[uri]; return(bin.Length()); } using (IsolatedStorageFileStream fileStream = _store.OpenFile(uri, FileMode.Open, FileAccess.Read, FileShare.None)) { return(fileStream.Length); } } }
private static void AddToOpenBinsCollection(IsolatedStorageFileBin bin) { _openBins[bin.Path] = bin; }
private static void RegisterForOnCloseEvent(IsolatedStorageFileBin bin) { bin.OnClose += (sender, arg) => RemoveFromOpenBinCollection(((IsolatedStorageFileBin)sender).Path); }