public Item(string name, string url, ItemVersion version)
 {
     Name = name;
     Url = url;
     ParentVersion = version;
     Path = "";
     DllPath = "";
     User = "";
     Password = "";
 }
        public static ItemVersion GetOrCreateVersion(Artifact artifact, string version)
        {
            foreach (ItemVersion iv in artifact.Versions)
            {
                if (iv.Id == version)
                {
                    return iv;
                }
            }

            ItemVersion ver = new ItemVersion(version, artifact);
            artifact.Versions.Add(ver);
            return ver;
        }
 public UIItemVersion(ItemVersion version)
 {
     ItemVersionModel = version;
     Items = new List<UIItem>();
 }
 public Item NextItem(ItemVersion version)
 {
     return new Item("Item " + _nextItem, "https://maven.org?item=" + _nextItem++, version);
 }
        public IList<ItemVersion> GetVersions(string groupId, Artifact artifact)
        {
            string url = getVersionsUrl(groupId, artifact.Id);
            string versionsString = _client.DownloadString(url);
            VersionsListing vl = _serializer.Deserialize<VersionsListing>(versionsString);
            IList<ItemVersion> versions = new List<ItemVersion>();

            foreach (VersionsDoc doc in vl.response.docs)
            {
                ItemVersion iv = new ItemVersion(doc.v, artifact);
                iv.Items = getItems(iv, doc.ec);
                if (iv.Items.Count > 0)
                    versions.Add(iv);
            }
            return versions;
        }
 private IList<Item> getItems(ItemVersion iv, string[] files)
 {
     IList<Item> items = new List<Item>();
     foreach (string file in files)
     {
         if(ItemFilter(file))
         {
             String url = generateFileUrl(file, iv);
             Item i = new Item(generateFileName(file, iv),url, iv);
             items.Add(i);
         }
     }
     return items;
 }
 private string generateFileUrl(string fileName, ItemVersion version)
 {
     string parameter = version.ParentArtifact.GroupId.Replace(".", "/");
     parameter += "/" + version.ParentArtifact.Id;
     parameter += "/" + version.Id;
     parameter += "/" + generateFileName(fileName, version);
     return _fileBaseUrl + parameter;
 }
 private string generateFileName(string fileName, ItemVersion version)
 {
     return version.ParentArtifact.Id + "-" + version.Id + fileName;
 }