コード例 #1
0
        private void btnCapabilities_Click(object sender, System.EventArgs e)
        {
            webDav1.UserName = edtUser.Text;
            webDav1.Password = edtPassword.Text;

            string url = edtHost.Text;

            if (lvResources.SelectedItems.Count > 0)
            {
                url = lvResources.SelectedItems[0].Text;
            }

            webDav1.GetCapabilities(url);

            StringCollectionEx list = new StringCollectionEx();

            list.Add("WebDav Class: " + webDav1.Capabilities.WebDavClass);

            list.Add("");
            list.Add("Allowed Methods:");
            list.AddRange(webDav1.Capabilities.AllowedMethods);

            list.Add("");
            list.Add("Public Methods:");
            list.AddRange(webDav1.Capabilities.PublicMethods);

            ViewPropsForm dlg = new ViewPropsForm();

            dlg.Text           = "WebDAV Capabilities";
            dlg.textBox1.Lines = list.ToArray();
            dlg.textBox1.Select(0, 0);

            dlg.ShowDialog();
        }
コード例 #2
0
        private void btnGetAllProps_Click(object sender, System.EventArgs e)
        {
            webDav1.UserName = edtUser.Text;
            webDav1.Password = edtPassword.Text;

            if (cbDepth.SelectedIndex == 0)
            {
                webDav1.Depth = WebDavDepth.ResourceOnly;
            }
            else
            {
                webDav1.Depth = (WebDavDepth)cbDepth.SelectedIndex;
            }

            string url = edtHost.Text;

            if (lvResources.SelectedItems.Count > 0)
            {
                url = lvResources.SelectedItems[0].Text;
            }

            webDav1.GetAllProperties(url);
            webDav1.GetActiveLocks(url);

            StringCollectionEx list = new StringCollectionEx();

            list.Add(url);
            list.Add("");
            list.Add("Properties:");

            foreach (WebDavProperty prop in webDav1.ResourceProperties)
            {
                list.Add(prop.Name + " = " + prop.Value);
            }

            list.Add("");
            list.Add("Active Locks:");

            foreach (WebDavLock item in webDav1.ActiveLocks)
            {
                list.Add("Owner: " + item.Owner);
                list.Add("Lock Token: " + item.LockToken);
                list.Add("Lock Type: " + item.LockType);
                list.Add("Lock Timeout: " + item.TimeOut);
            }

            ViewPropsForm dlg = new ViewPropsForm();

            dlg.Text           = "View Resource Properties";
            dlg.textBox1.Lines = list.ToArray();
            dlg.textBox1.Select(0, 0);

            dlg.ShowDialog();
        }