using System; using System.Net; namespace WebsitePanel.WebDav.Core { /// /// WebDav.Client Namespace. /// /// namespace Client { public class WebDavSession { public NetworkCredential Credentials { get; set; } /// /// Returns IFolder corresponding to path. /// /// Path to the folder. /// Folder corresponding to requested path. public IFolder OpenFolder(string path) { var folder = new WebDavFolder(); folder.SetCredentials(Credentials); folder.Open(path); return folder; } /// /// Returns IFolder corresponding to path. /// /// Path to the folder. /// Folder corresponding to requested path. public IFolder OpenFolder(Uri path) { var folder = new WebDavFolder(); folder.SetCredentials(Credentials); folder.Open(path); return folder; } /// /// Returns IResource corresponding to path. /// /// Path to the resource. /// Resource corresponding to requested path. public IResource OpenResource(string path) { return OpenResource(new Uri(path)); } /// /// Returns IResource corresponding to path. /// /// Path to the resource. /// Resource corresponding to requested path. public IResource OpenResource(Uri path) { IFolder folder = OpenFolder(path); return folder.GetResource(path.Segments[path.Segments.Length - 1]); } } } }