Example #1
0
        /// <summary>
        /// Finds files partially matching the specified name in a directory on
        /// the server.
        /// </summary>
        /// <param name="name">The name that should be searched for.</param>
        /// <param name="directory">
        /// The directory on the server to search in.
        /// </param>
        /// <returns>
        /// The full name of the first matching file on the server, or
        /// <c>null</c> if no matching files could be found.
        /// </returns>
        protected override string FindDuplicate(string name, string directory)
        {
            var listing   = client.ListDirectory(directory);
            var duplicate = listing.FirstOrDefault(x => x.Contains(name));

            if (duplicate.StartsWith("/"))
            {
                return(duplicate);
            }
            return(PathUtility.UriCombine(directory, duplicate));
        }