Ejemplo n.º 1
0
        internal GettingEventArgs(Workspace workspace, GetOperation operation)
        {
            this.workspace = workspace;
                this.operation = operation;

                if (operation.ChangeType == ChangeType.Delete)
                    status = OperationStatus.Deleting;
                else status = OperationStatus.Getting;
        }
Ejemplo n.º 2
0
        //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);
        }
Ejemplo n.º 3
0
        //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;
        }