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;
}