// <PendingChange chg="Add Edit Encoding" hash="" uhash="" pcid="-339254" /> internal static PendingChange FromXml(Repository repository, XmlReader reader) { PendingChange change = new PendingChange(); change.versionControlServer = repository.VersionControlServer; change.serverItem = reader.GetAttribute("item"); change.localItem = TfsPath.ToPlatformPath(reader.GetAttribute("local")); change.itemId = Convert.ToInt32(reader.GetAttribute("itemid")); change.encoding = Convert.ToInt32(reader.GetAttribute("enc")); change.creationDate = DateTime.Parse(reader.GetAttribute("date")); string itype = reader.GetAttribute("type"); if (!String.IsNullOrEmpty(itype)) { change.itemType = (ItemType)Enum.Parse(typeof(ItemType), itype, true); } change.downloadUrl = reader.GetAttribute("durl"); string chgAttr = reader.GetAttribute("chg"); change.changeType = (ChangeType)Enum.Parse(typeof(ChangeType), chgAttr.Replace(" ", ","), true); if (change.changeType == ChangeType.Edit) { change.itemType = ItemType.File; } return(change); }
internal static Failure FromXml(Repository repository, XmlReader reader) { Failure failure = new Failure(); string requestType = reader.GetAttribute("req"); if (!String.IsNullOrEmpty(requestType)) { failure.requestType = (RequestType)Enum.Parse(typeof(RequestType), requestType, true); } failure.code = reader.GetAttribute("code"); failure.localItem = TfsPath.ToPlatformPath(reader.GetAttribute("local")); string elementName = reader.Name; while (reader.Read()) { if (reader.NodeType == XmlNodeType.EndElement && reader.Name == elementName) { break; } if (reader.NodeType == XmlNodeType.Element && reader.Name == "Message") { failure.message = reader.ReadString(); } } return(failure); }
internal static WorkingFolder FromXml(Repository repository, XmlReader reader) { string local = TfsPath.ToPlatformPath(reader.GetAttribute("local")); string serverItem = reader.GetAttribute("item"); return(new WorkingFolder(serverItem, local)); }
//<s:complexType name="GetOperation"> // <s:sequence> // <s:element minOccurs="0" maxOccurs="1" name="HashValue" type="s:base64Binary"/> // <s:element minOccurs="0" maxOccurs="1" name="Properties" type="tns:ArrayOfPropertyValue"/> // <s:element minOccurs="0" maxOccurs="1" name="PropertyValues" type="tns:ArrayOfPropertyValue"/> // </s:sequence> // <s:attribute default="Any" name="type" type="tns:ItemType"/> // <s:attribute default="0" name="itemid" type="s:int"/> // <s:attribute name="slocal" type="s:string"/> // <s:attribute name="tlocal" type="s:string"/> // <s:attribute name="titem" type="s:string"/> // <s:attribute name="sitem" type="s:string"/> // <s:attribute default="0" name="sver" type="s:int"/> // <s:attribute default="-2" name="vrevto" type="s:int"/> // <s:attribute default="0" name="lver" type="s:int"/> // <s:attribute default="0" name="did" type="s:int"/> // <s:attribute default="0" name="chgEx" type="s:int"/> // <s:attribute default="None" name="chg" type="tns:ChangeType"/> // <s:attribute default="None" name="lock" type="tns:LockLevel"/> // <s:attribute default="true" name="il" type="s:boolean"/> // <s:attribute default="0" name="pcid" type="s:int"/> // <s:attribute default="false" name="cnflct" type="s:boolean"/> // <s:attribute default="None" name="cnflctchg" type="tns:ChangeType"/> // <s:attribute default="0" name="cnflctchgEx" type="s:int"/> // <s:attribute default="0" name="cnflctitemid" type="s:int"/> // <s:attribute name="nmscnflct" type="s:unsignedByte" use="required"/> // <s:attribute name="durl" type="s:string"/> // <s:attribute default="-2" name="enc" type="s:int"/> // <s:attribute default="0001-01-01T00:00:00" name="vsd" type="s:dateTime"/> //</s:complexType> internal static GetOperation FromXml(XElement element) { GetOperation getOperation = new GetOperation { ChangeType = ChangeType.None, ItemType = ItemType.Any, LockLevel = LockLevel.None, VersionServer = 0, VersionLocal = 0, }; getOperation.ItemType = EnumHelper.ParseItemType(element.GetAttribute("type")); getOperation.ItemId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("itemid")); getOperation.SourceLocalItem = TfsPath.ToPlatformPath(element.GetAttribute("slocal")); getOperation.TargetLocalItem = TfsPath.ToPlatformPath(element.GetAttribute("tlocal")); getOperation.SourceServerItem = element.GetAttribute("sitem"); getOperation.TargetServerItem = element.GetAttribute("titem"); getOperation.VersionServer = GeneralHelper.XmlAttributeToInt(element.GetAttribute("sver")); getOperation.VersionLocal = GeneralHelper.XmlAttributeToInt(element.GetAttribute("lver")); getOperation.ChangeType = EnumHelper.ParseChangeType(element.GetAttribute("chg")); // setup download url if found getOperation.ArtifactUri = element.GetAttribute("durl"); // here's what you get if you remap a working folder from one // team project to another team project with the same file // first you get the update getOperation, then you get this later on // <GetOperation type="File" itemid="159025" slocal="foo.xml" titem="$/bar/foo.xml" lver="12002"><HashValue /></GetOperation> // look for a deletion id getOperation.DeletionId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("did")); return(getOperation); }
internal static WorkingFolder FromXml(XElement element) { string local = TfsPath.ToPlatformPath(element.Attribute("local").Value); string serverItem = element.Attribute("item").Value; var workFolder = new WorkingFolder(serverItem, local); if (element.Attribute("type") != null) { workFolder.Type = (WorkingFolderType)Enum.Parse(typeof(WorkingFolderType), element.Attribute("type").Value); } return(workFolder); }
//<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" //ochg="boolean" lock="None or Checkin or CheckOut or Unchanged" //lowner="string" /> internal static ExtendedItem FromXml(Repository repository, XmlReader reader) { ExtendedItem item = new ExtendedItem(); string chg = reader.GetAttribute("chg"); if (!String.IsNullOrEmpty(chg)) { item.changeType = (ChangeType)Enum.Parse(typeof(ChangeType), chg, true); } string ochg = reader.GetAttribute("ochg"); if (!String.IsNullOrEmpty(ochg)) { item.hasOtherPendingChange = bool.Parse(ochg); } string xlock = reader.GetAttribute("lock"); if (!String.IsNullOrEmpty(xlock)) { item.lockStatus = (LockLevel)Enum.Parse(typeof(LockLevel), xlock, true); } item.lockOwner = reader.GetAttribute("lowner"); item.localItem = TfsPath.ToPlatformPath(reader.GetAttribute("local")); item.targetServerItem = reader.GetAttribute("titem"); item.sourceServerItem = reader.GetAttribute("sitem"); item.itemType = (ItemType)Enum.Parse(typeof(ItemType), reader.GetAttribute("type"), true); item.itemId = Convert.ToInt32(reader.GetAttribute("itemid")); item.encoding = Convert.ToInt32(reader.GetAttribute("enc")); item.versionLocal = Convert.ToInt32(reader.GetAttribute("lver")); item.versionLatest = Convert.ToInt32(reader.GetAttribute("latest")); item.deletionId = Convert.ToInt32(reader.GetAttribute("did")); return(item); }
//private System.Byte[] hashValue; internal static GetOperation FromXml(string itemUrl, XmlReader reader) { GetOperation getOperation = new GetOperation(); string elementName = reader.Name; string stype = reader.GetAttribute("type"); if (!String.IsNullOrEmpty(stype)) { getOperation.itemType = (ItemType)Enum.Parse(typeof(ItemType), stype, true); } getOperation.itemId = Convert.ToInt32(reader.GetAttribute("itemid")); getOperation.slocal = TfsPath.ToPlatformPath(reader.GetAttribute("slocal")); getOperation.tlocal = TfsPath.ToPlatformPath(reader.GetAttribute("tlocal")); getOperation.titem = reader.GetAttribute("titem"); getOperation.sver = Convert.ToInt32(reader.GetAttribute("sver")); getOperation.lver = Convert.ToInt32(reader.GetAttribute("lver")); string chgAttr = reader.GetAttribute("chg"); if (!String.IsNullOrEmpty(chgAttr)) { getOperation.chg = (ChangeType)Enum.Parse(typeof(ChangeType), chgAttr.Replace(" ", ","), true); } // setup download url if found string durl = reader.GetAttribute("durl"); if (!String.IsNullOrEmpty(durl)) { getOperation.artifactUri = new Uri(String.Format("{0}?{1}", itemUrl, durl)); } // here's what you get if you remap a working folder from one // team project to another team project with the same file // first you get the update getOperation, then you get this later on // <GetOperation type="File" itemid="159025" slocal="foo.xml" titem="$/bar/foo.xml" lver="12002"><HashValue /></GetOperation> // look for a deletion id getOperation.did = Convert.ToInt32(reader.GetAttribute("did")); while (reader.Read()) { if (reader.NodeType == XmlNodeType.EndElement && reader.Name == elementName) { break; } if (reader.NodeType == XmlNodeType.Element && (!reader.IsEmptyElement)) { switch (reader.Name) { case "HashValue": break; } } } return(getOperation); }