private static McLockElement GetMcLockElement(OpaqueLockToken lockToken, PropertyInfoCollection propInfoColl) { if (propInfoColl == null) { throw new ArgumentNullException("propInfoColl"); } McLockElement retVal = null; PropertyInfo mcLockDateProp = propInfoColl[PropertyInfo.McLockDateProperty]; if (mcLockDateProp != null) { WebDavDocument document = WebDavDocument.CreateDocument(); McLockDateElement mcLockDateEl = (McLockDateElement) document.ImportNode((XmlElement)mcLockDateProp.Value, true); //Try to find McLock element with same token as lockToken foreach (McLockElement lockEl in mcLockDateEl.GetLocks()) { if (lockEl.Token == lockToken.ToString()) { retVal = lockEl; break; } } } return(retVal); }
/// <summary> /// Gets the active locks. /// </summary> /// <param name="element">The element.</param> /// <returns></returns> public override IEnumerable <ActiveLockElement> GetActiveLocks(WebDavElementInfo element) { List <ActiveLockElement> retVal = new List <ActiveLockElement>(); WebDavDocument document = WebDavDocument.CreateDocument(); PropertyInfoCollection collection = GetProperties(element); //Remove obsolete lock WebDavLockManager.RemoveObsoleteLock(this, collection); PropertyInfo lockDiscoveryProp = collection[PropertyInfo.LockDiscoveryProperty]; if (lockDiscoveryProp != null) { LockDiscoveryPropertyElement lockDiscoveryEl = (LockDiscoveryPropertyElement) document.ImportNode((XmlElement)lockDiscoveryProp.Value, true); foreach (ActiveLockElement activeLockEl in lockDiscoveryEl.GetActiveLocks()) { yield return(activeLockEl); } } }