//<QueryItemsResult xmlns="http://schemas.microsoft.com/TeamFoundation/2005/06/VersionControl/ClientServices/03"> // <ItemSet> // <QueryPath>$/</QueryPath> // <Items> // <Item cs="1" date="2006-12-15T16:16:26.95Z" enc="-3" type="Folder" itemid="1" item="$/" /> internal static ItemSet FromXml(XElement element) { ItemSet itemSet = new ItemSet(); List <Item> items = new List <Item>(); var patternElement = element.Element(XmlNamespaces.GetMessageElementName("Pattern")); itemSet.pattern = patternElement != null ? patternElement.Value : string.Empty; var queryPathElement = element.Element(XmlNamespaces.GetMessageElementName("QueryPath")); itemSet.queryPath = queryPathElement != null ? queryPathElement.Value : string.Empty; var itemElements = element.Element(XmlNamespaces.GetMessageElementName("Items")).Elements(XmlNamespaces.GetMessageElementName("Item")); items.AddRange(itemElements.Select(it => Item.FromXml(it))); items.Sort(); itemSet.items = items.ToArray(); return(itemSet); }
// <ExtendedItem lver="int" did="int" latest="int" type="Any or Folder or File" enc="int" itemid="int" local="string" titem="string" sitem="string" chg="None or Add or Edit or Encoding or Rename or Delete or Undelete or Branch or Merge or Lock or Rollback or SourceRename or Property" chgEx="int" ochg="boolean" lock="None or Checkin or CheckOut or Unchanged" lowner="string" lownerdisp="string" date="dateTime"> // <IsBranch>boolean</IsBranch> // <PropertyValues xsi:nil="true" /> // </ExtendedItem> // <s:complexType name="ExtendedItem"> // <s:sequence> // <s:element minOccurs="0" maxOccurs="1" default="false" name="IsBranch" type="s:boolean"/> // <s:element minOccurs="0" maxOccurs="1" name="PropertyValues" type="tns:ArrayOfPropertyValue"/> // </s:sequence> // <s:attribute default="0" name="lver" type="s:int"/> // <s:attribute default="0" name="did" type="s:int"/> // <s:attribute default="0" name="latest" type="s:int"/> // <s:attribute default="Any" name="type" type="tns:ItemType"/> // <s:attribute default="-3" name="enc" type="s:int"/> // <s:attribute default="0" name="itemid" type="s:int"/> // <s:attribute name="local" type="s:string"/> // <s:attribute name="titem" type="s:string"/> // <s:attribute name="sitem" type="s:string"/> // <s:attribute default="None" name="chg" type="tns:ChangeType"/> // <s:attribute default="0" name="chgEx" type="s:int"/> // <s:attribute default="false" name="ochg" type="s:boolean"/> // <s:attribute default="None" name="lock" type="tns:LockLevel"/> // <s:attribute name="lowner" type="s:string"/> // <s:attribute name="lownerdisp" type="s:string"/> // <s:attribute name="date" type="s:dateTime" use="required"/> // </s:complexType> internal static ExtendedItem FromXml(XElement element) { ExtendedItem item = new ExtendedItem { ChangeType = ChangeType.None, VersionLocal = 0, DeletionId = 0, VersionLatest = 0, ItemType = ItemType.Any, Encoding = -3, ItemId = 0, HasOtherPendingChange = false, LockStatus = LockLevel.None }; item.ChangeType = EnumHelper.ParseChangeType(element.GetAttribute("chg")); item.HasOtherPendingChange = GeneralHelper.XmlAttributeToBool(element.GetAttribute("ochg")); item.LockStatus = EnumHelper.ParseLockLevel(element.GetAttribute("lock")); item.LockOwner = element.GetAttribute("lowner"); item.LocalItem = TfsPath.ToPlatformPath(element.GetAttribute("local")); item.TargetServerItem = element.GetAttribute("titem"); item.SourceServerItem = element.GetAttribute("sitem"); item.ItemType = EnumHelper.ParseItemType(element.GetAttribute("type")); item.ItemId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("itemid")); item.Encoding = GeneralHelper.XmlAttributeToInt(element.GetAttribute("enc")); item.VersionLocal = GeneralHelper.XmlAttributeToInt(element.GetAttribute("lver")); item.VersionLatest = GeneralHelper.XmlAttributeToInt(element.GetAttribute("latest")); item.DeletionId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("did")); item.CheckinDate = GeneralHelper.XmlAttributeToDate(element.GetAttribute("date")); if (element.Element(XmlNamespaces.GetMessageElementName("IsBranch")) != null && !string.IsNullOrEmpty(element.Element(XmlNamespaces.GetMessageElementName("IsBranch")).Value)) { item.IsBranch = GeneralHelper.XmlAttributeToBool(element.Element(XmlNamespaces.GetMessageElementName("IsBranch")).Value); } return(item); }