internal static void RaiseFtpChangedEvent(WatcherChangeTypes changeType, Uri uri, string newName)
 {
     if (ChangedListeners != null)
     {
         List<EventHandler<FtpChangedEventArg>> list;
         FtpChangedEventArg arg;
         Uri parent = FtpItemInfo.GetParent(uri);
         if (parent == null)
         {
             throw new ArgumentException("Cannot get parent from this uri");
         }
         ChangedLock.AcquireReaderLock(-1);
         try
         {
             list = new List<EventHandler<FtpChangedEventArg>>(ChangedListeners.Count);
             foreach (WeakReference reference in ChangedListeners)
             {
                 if (reference.IsAlive)
                 {
                     list.Add((EventHandler<FtpChangedEventArg>) reference.Target);
                 }
             }
         }
         finally
         {
             ChangedLock.ReleaseReaderLock();
         }
         if (changeType == WatcherChangeTypes.Renamed)
         {
             arg = new FtpChangedEventArg(uri, parent, newName);
         }
         else
         {
             arg = new FtpChangedEventArg(changeType, uri, parent);
         }
         foreach (EventHandler<FtpChangedEventArg> handler in list)
         {
             if (handler != null)
             {
                 handler(null, arg);
             }
         }
     }
 }
 private void OnFtpChanged(object sender, FtpChangedEventArg e)
 {
     this.Cache.Lock.AcquireWriterLock(-1);
     try
     {
         this.Cache.Remove(e.BaseUri);
         if (e.ChangeType != WatcherChangeTypes.Created)
         {
             this.Cache.Remove(e.AbsoluteUri);
         }
     }
     finally
     {
         this.Cache.Lock.ReleaseWriterLock();
     }
 }