Пример #1
0
        /// <summary>
        ///Adds ther file to the folder, overwriting the file if it exists..
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public IFileDirectoryItem AddFile(IFileInfo file)
        {
            var name    = file.Name;
            var newItem = new FileDirectoryItem(file, this);

            AddItem(name, newItem);
            return(newItem);
        }
Пример #2
0
        public override void ApplyUpdate(IFileInfo newFileInfo)
        {// take a snapshot of current directory item with the old file.
            var oldItem = new FileDirectoryItem(this.FileInfo, this.ParentFolder, false);

            // now change the file to the new file on this item.
            FileInfo = newFileInfo;
            // now signal the file has changed.
            OnRaiseItemUpdated(oldItem);
        }
Пример #3
0
 protected override void OnParentUpdated(object sender, DirectoryItemUpdatedEventArgs e)
 {
     // If the parent path changes (i.e folder rename?),
     // or its existence changes, it effects us so we need to notify subscribers we have been affected!
     if ((e.OldItem.Path != e.NewItem.Path))
     {
         var oldItem = new FileDirectoryItem(this.FileInfo, e.OldItem as IFolderDirectoryItem, false);
         OnRaiseItemUpdated(oldItem);
     }
 }
Пример #4
0
        public override void Visit(FileDirectoryItem item)
        {
            switch (_visitMode)
            {
            case VisitMode.Register:
                Register(item);
                break;

            case VisitMode.Unregister:
                _UnregisterWasSuccessful = false;
                _UnregisterWasSuccessful = Unregister(item);
                break;
            }
        }
Пример #5
0
 public virtual void Visit(FileDirectoryItem item)
 {
     // no op.
 }