Exemplo n.º 1
0
 public Stream CreateContentStream()
 {
     try
     {
         return(FileStreamCache.Get(Item));
     }
     catch (FileNotFoundException ex)
     {
         Error("Failed to access: " + Item.FullName, ex);
         Server.DelayedRescan(WatcherChangeTypes.Deleted);
         throw;
     }
     catch (UnauthorizedAccessException ex)
     {
         Error("Failed to access: " + Item.FullName, ex);
         Server.DelayedRescan(WatcherChangeTypes.Changed);
         throw;
     }
     catch (IOException ex)
     {
         Error("Failed to access: " + Item.FullName, ex);
         Server.DelayedRescan(WatcherChangeTypes.Changed);
         throw;
     }
 }
Exemplo n.º 2
0
 public override void Close()
 {
     if (!killed)
     {
         FileStreamCache.Recycle(this);
         return;
     }
     base.Close();
     logger.DebugFormat("Closed file {0}", info.FullName);
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     foreach (var w in watchers)
     {
         w.Dispose();
     }
     changeTimer?.Dispose();
     watchTimer?.Dispose();
     store?.Dispose();
     FileStreamCache.Clear();
 }
Exemplo n.º 4
0
 public override void Close()
 {
     if (this.CanRead || this.CanSeek)
     {
         //baseFile.lastpos = System.Math.Max(this.Position, baseFile.lastpos);
         if (this.Position > 0 && baseFile.lastpos != this.Position && (this.Position * 100 / this.Length >= 8 || baseFile.lastpos == 0))
         {
             baseFile.lastpos = this.Position;
             baseFile.UpdateCache();
         }
     }
     if (!killed)
     {
         FileStreamCache.Recycle(this);
         return;
     }
     base.Close();
     logger.DebugFormat("Closed file {0}", info.FullName);
 }
Exemplo n.º 5
0
 public void Dispose()
 {
     foreach (var w in watchers)
     {
         w.Dispose();
     }
     if (changeTimer != null)
     {
         changeTimer.Dispose();
     }
     if (watchTimer != null)
     {
         watchTimer.Dispose();
     }
     if (_store != null)
     {
         _store.Dispose();
     }
     FileStreamCache.Clear();
 }