protected override void DoRelease()
 {
     Cleanup();
     _folder?.Dispose();
     _items?.Dispose();
     _subFolders?.Dispose();
 }
        /// <summary>
        /// Watches the child folder.
        /// </summary>
        /// <param name="child">The child folder. Ownership will be taken.</param>
        private void WatchChild(IFolder child, bool takeOwnership)
        {
            if (!_children.ContainsKey(child.EntryID))
            {
                if (_watcher.ShouldFolderBeWatched(this, child))
                {
                    Logger.Instance.Trace(this, "Registering child on {0}: {1}", _folder.LogKey, child.FullFolderPath);

                    // Make sure we register the entry id actually before registering any listeners.
                    // That will cause change notifications, which require the entryid to be registered.
                    IFolder     childEffective = takeOwnership ? child : child.Clone();
                    ZPushFolder folder         = new ZPushFolder(_watcher, this, childEffective);
                    _children.Add(child.EntryID, folder);
                    folder.Initialise();
                    return;
                }
                else
                {
                    Logger.Instance.Trace(this, "Excluding child on {0}: {1}", _folder.LogKey, child.FullFolderPath);
                }
            }

            if (takeOwnership)
            {
                // Release the folder if not used
                child.Dispose();
            }
        }
Beispiel #3
0
        public static bool Unmount(IFolder mount)
        {
            if (MountedFolders.Contains(mount))
            {
                mount.Dispose();
            }

            return(MountedFolders.RemoveAll(f => f == mount) > 0);
        }
        //--- METHODS

        /// <summary>
        /// Releases resources and calls base.Dispose().
        ///
        /// This method will not be called by the garbage collector.
        /// It will only be executed if:
        ///
        /// * This class implements IDisposable; and
        /// * The class instance is created through the using clause
        ///
        /// IMPORTANT - Every override of this method must call base.Dispose()
        /// after executing its own code.
        /// </summary>
        public virtual void Dispose()
        {
            // Call Dispose() for each initialized property of the context
            // in the reverse order of initialization
            if (outputFolder_ != null)
            {
                outputFolder_.Dispose();
            }
            if (log_ != null)
            {
                log_.Dispose();
            }
            if (progress_ != null)
            {
                progress_.Dispose();
            }
            if (dataSource_ != null)
            {
                dataSource_.Dispose();
            }

            // Uncomment except in root class of the hierarchy
            // base.Dispose();
        }
 protected override void DoRelease()
 {
     _folder.Dispose();
 }
Beispiel #6
0
		public static bool Unmount(IFolder mount)
		{
			if (MountedFolders.Contains(mount))
				mount.Dispose();

			return MountedFolders.RemoveAll(f => f == mount) > 0;
		}