Exemple #1
0
        /// <summary>
        /// Creates a new missing target
        /// </summary>
        /// <remarks>
        /// This only works when this <see cref="FileSystemTarget"/> has an underlying collection.
        /// </remarks>
        /// <returns>The new missing target</returns>
        public MissingTarget NewMissingTarget()
        {
            if (Parent == null)
            {
                throw new InvalidOperationException();
            }
            Uri collUrl    = DestinationUrl.GetParent();
            var collTarget = CollectionTarget.NewInstance(collUrl, Parent, _targetActions);

            return(new MissingTarget(DestinationUrl, Name, collTarget, _targetActions));
        }
Exemple #2
0
        /// <summary>
        /// Creates a new collection target
        /// </summary>
        /// <remarks>
        /// This only works when this <see cref="FileSystemTarget"/> has an underlying collection.
        /// </remarks>
        /// <returns>The new collection target</returns>
        public CollectionTarget NewCollectionTarget()
        {
            if (Collection == null)
            {
                throw new InvalidOperationException();
            }
            Uri collUrl    = DestinationUrl.GetParent();
            var collTarget = Parent == null ? null : CollectionTarget.NewInstance(collUrl, Parent, _targetActions);

            return(new CollectionTarget(DestinationUrl, collTarget, Collection, false, _targetActions));
        }
Exemple #3
0
        /// <summary>
        /// Creates a new document target
        /// </summary>
        /// <remarks>
        /// This only works when this <see cref="FileSystemTarget"/> has an underlying collection.
        /// </remarks>
        /// <returns>The new document target</returns>
        public DocumentTarget NewDocumentTarget()
        {
            if (Document == null || Parent == null)
            {
                throw new InvalidOperationException();
            }
            Uri collUrl    = DestinationUrl.GetParent();
            var collTarget = CollectionTarget.NewInstance(collUrl, Parent, _targetActions);

            return(new DocumentTarget(collTarget, DestinationUrl, Document, _targetActions));
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EntryTarget"/> class.
 /// </summary>
 /// <param name="targetActions">The target actions implementation to use</param>
 /// <param name="parent">The parent collection</param>
 /// <param name="destinationUrl">The destination URL for this entry</param>
 /// <param name="entry">The underlying entry</param>
 protected EntryTarget(
     ITargetActions <CollectionTarget, DocumentTarget, MissingTarget> targetActions,
     CollectionTarget parent,
     Uri destinationUrl,
     IEntry entry)
 {
     TargetActions  = targetActions;
     _entry         = entry;
     Name           = entry.Name;
     Parent         = parent;
     DestinationUrl = destinationUrl;
 }