Beispiel #1
0
        public Item[] QueryItemsById(int[] ids, int changeSet,
                                     bool generateDownloadUrls)
        {
            Message msg = new Message(GetWebRequest(new Uri(Url)), "QueryItemsById");

            msg.Body.WriteStartElement("itemIds");
            foreach (int id in ids)
            {
                msg.Body.WriteElementString("int", Convert.ToString(id));
            }
            msg.Body.WriteEndElement();

            msg.Body.WriteElementString("changeSet", Convert.ToString(changeSet));
            msg.Body.WriteElementString("generateDownloadUrls",
                                        generateDownloadUrls.ToString().ToLower());

            List <Item> items = new List <Item>();

            using (HttpWebResponse response = Invoke(msg))
            {
                XmlReader results = msg.ResponseReader(response);

                while (results.Read())
                {
                    if (results.NodeType == XmlNodeType.Element &&
                        results.Name == "Item")
                    {
                        items.Add(Item.FromXml(this, results));
                    }
                }
            }

            return(items.ToArray());
        }
Beispiel #2
0
        internal static BranchRelative FromXml(Repository repository, XmlReader reader)
        {
            string         elementName = reader.Name;
            BranchRelative branch      = new BranchRelative();

            branch.relativeToItemId   = Convert.ToInt32(reader.GetAttribute("reltoid"));
            branch.relativeFromItemId = Convert.ToInt32(reader.GetAttribute("relfromid"));
            branch.isRequestedItem    = Convert.ToBoolean(reader.GetAttribute("reqstd"));

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == elementName)
                {
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "BranchFromItem":
                        branch.branchFromItem = Item.FromXml(repository, reader);
                        break;

                    case "BranchToItem":
                        branch.branchToItem = Item.FromXml(repository, reader);
                        break;
                    }
                }
            }

            return(branch);
        }
Beispiel #3
0
        internal static Change FromXml(Repository repository, XmlReader reader)
        {
            Change change = new Change();

            string chgAttr = reader.GetAttribute("chg");

            if (String.IsNullOrEmpty(chgAttr))
            {
                chgAttr = reader.GetAttribute("type");
            }

            change.changeType = (ChangeType)Enum.Parse(typeof(ChangeType), chgAttr.Replace(" ", ","), true);

            reader.Read();
            change.item = Item.FromXml(repository, reader);

            return(change);
        }
Beispiel #4
0
        internal static VersionControlLabel FromXml(Repository repository, XmlReader reader)
        {
            VersionControlLabel label = new VersionControlLabel();
            string elementName        = reader.Name;

            label.lastModifiedDate = DateTime.Parse(reader.GetAttribute("date"));
            label.name             = reader.GetAttribute("name");
            label.ownerName        = reader.GetAttribute("owner");
            label.scope            = reader.GetAttribute("scope");
            label.labelId          = Convert.ToInt32(reader.GetAttribute("lid"));

            List <Item> items = new List <Item>();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == elementName)
                {
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "Item":
                        items.Add(Item.FromXml(repository, reader));
                        break;

                    case "Comment":
                        label.comment = reader.ReadString();
                        break;
                    }
                }
            }

            label.items = items.ToArray();
            return(label);
        }
Beispiel #5
0
        internal static ItemSet FromXml(Repository repository, XmlReader reader)
        {
            string      elementName = reader.Name;
            ItemSet     itemSet     = new ItemSet();
            List <Item> items       = new List <Item>();

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.EndElement && reader.Name == elementName)
                {
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "Item":
                        items.Add(Item.FromXml(repository, reader));
                        break;

                    case "Pattern":
                        itemSet.pattern = reader.ReadElementContentAsString();
                        break;

                    case "QueryPath":
                        itemSet.queryPath = reader.ReadElementContentAsString();
                        break;
                    }
                }
            }

            items.Sort(Item.GenericComparer);
            itemSet.items = items.ToArray();
            return(itemSet);
        }