Пример #1
0
        internal static Conflict FromXml(XElement element, Workspace workspace)
        {
            Conflict conflict = new Conflict();
            conflict.ConflictId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("cid"));
            conflict.PendingChangeId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("pcid"));
            //Your
            conflict.YourChangeType = EnumHelper.ParseChangeType(element.GetAttribute("ychg"));
            conflict.YourServerItem = element.GetAttribute("ysitem");
            conflict.YourServerItemSource = element.GetAttribute("ysitemsrc");
            conflict.YourEncoding = GeneralHelper.XmlAttributeToInt(element.GetAttribute("yenc"));
            conflict.YourItemType = EnumHelper.ParseItemType(element.GetAttribute("ytype"));
            conflict.YourVersion = GeneralHelper.XmlAttributeToInt(element.GetAttribute("yver"));
            conflict.YourItemId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("yitemid"));
            conflict.YourDeletionId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("ydid"));
            conflict.YourLocalChangeType = EnumHelper.ParseChangeType(element.GetAttribute("ylchg"));
            conflict.YourLastMergedVersion = GeneralHelper.XmlAttributeToInt(element.GetAttribute("ylmver"));
            //Base
            conflict.BaseServerItem = element.GetAttribute("bsitem");
            conflict.BaseEncoding = GeneralHelper.XmlAttributeToInt(element.GetAttribute("benc"));
            conflict.BaseItemId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("bitemid"));
            conflict.BaseVersion = GeneralHelper.XmlAttributeToInt(element.GetAttribute("bver"));
            conflict.BaseHashValue = GeneralHelper.ToByteArray(element.GetAttribute("bhash"));
            conflict.BaseDeletionId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("bdid"));
            conflict.BaseItemType = EnumHelper.ParseItemType(element.GetAttribute("btype"));
            conflict.BaseChangeType = EnumHelper.ParseChangeType(element.GetAttribute("bchg"));
            //Their
            conflict.TheirItemId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("titemid"));
            conflict.TheirVersion = GeneralHelper.XmlAttributeToInt(element.GetAttribute("tver"));
            conflict.TheirServerItem = element.GetAttribute("tsitem");
            conflict.TheirEncoding = GeneralHelper.XmlAttributeToInt(element.GetAttribute("tenc"));
            conflict.TheirHashValue = GeneralHelper.ToByteArray(element.GetAttribute("thash"));
            conflict.TheirDeletionId = GeneralHelper.XmlAttributeToInt(element.GetAttribute("tdid"));
            conflict.TheirItemType = EnumHelper.ParseItemType(element.GetAttribute("ttype"));
            conflict.TheirLastMergedVersion = GeneralHelper.XmlAttributeToInt(element.GetAttribute("tlmver"));
            conflict.SourceLocalItem = TfsPath.ToPlatformPath(element.GetAttribute("srclitem"));
            conflict.TargetLocalItem = TfsPath.ToPlatformPath(element.GetAttribute("tgtlitem"));

            conflict.ConflictType = EnumHelper.ParseConflictType(element.GetAttribute("ctype"));
            conflict.Reason = GeneralHelper.XmlAttributeToInt(element.GetAttribute("reason"));
            conflict.IsNamespaceConflict = GeneralHelper.XmlAttributeToBool(element.GetAttribute("isnamecflict"));
            conflict.IsForced = GeneralHelper.XmlAttributeToBool(element.GetAttribute("isforced"));
            conflict.IsResolved = GeneralHelper.XmlAttributeToBool(element.GetAttribute("tgtlitem"));

            conflict.BaseDowloadUrl = element.GetAttribute("bdurl");
            conflict.TheirDowloadUrl = element.GetAttribute("tdurl");
            conflict.YourDowloadUrl = element.GetAttribute("ydurl");

            conflict.Workspace = workspace;
            return conflict;
        }
 public void Resolve(Conflict conflict, ResolutionType resolutionType)
 {
     conflict.Workspace.Resolve(conflict, resolutionType);
 }
 internal ResolveResult Resolve(Conflict conflict, ResolutionType resolutionType)
 {
     var invoker = new SoapInvoker(this);
     var msg = invoker.CreateEnvelope("Resolve");
     msg.Add(new XElement(MessageNs + "workspaceName", conflict.Workspace.Name));
     msg.Add(new XElement(MessageNs + "ownerName", conflict.Workspace.OwnerName));
     msg.Add(new XElement(MessageNs + "conflictId", conflict.ConflictId));
     msg.Add(new XElement(MessageNs + "resolution", resolutionType));
     var response = invoker.InvokeResponse();
     ResolveResult result = new ResolveResult();
     result.GetOperations = GetOperationExtractor(invoker.MethodResultExtractor(response));
     result.UndoOperations = GetOperationExtractor(response.Element(MessageNs + "undoOperations"));
     result.ResolvedConflicts = ConflictExtractor(response.Element(MessageNs + "resolvedConflicts"), conflict.Workspace);
     return result;
 }