public static PostDownloadLinks Create(IEnumerable <string> links) { PostDownloadLinks postDownloadLinks = new PostDownloadLinks(); postDownloadLinks.AddItem(); foreach (string link in links) { postDownloadLinks.AddServer(DownloadFileServerInfo.GetServerNameFromLink(link)); postDownloadLinks.AddLink(link); } return(postDownloadLinks); }
private DownloadItemLink[] CreateDownloadItemLinkArray() { //IRequestDownloadItemLink[] requestItemLinks = requestDownloadLinks.GetLinks(); //DownloadItemLink[] downloadItemLinks = new DownloadItemLink[downloadLinks.Length + 1]; //List<DownloadItemLink> downloadItemLinks = new List<DownloadItemLink>(); //for (int i1 = 0; i1 < downloadLinks.Length; i1++) //foreach (string link in downloadLinks) //{ //IRequestDownloadItemLink requestItemLink = requestItemLinks[i1]; DownloadItemLink downloadItemLink = new DownloadItemLink(); //downloadItemLink.Name = requestItemLink.GetName(); downloadItemLink.Downloaded = false; //IRequestDownloadServerLink[] requestFileLinks = requestItemLink.GetServerLinks(); downloadItemLink.ServerLinks = new DownloadServerLink[downloadLinks.Length + 1]; int i2 = 0; DownloadServerLink fileLink = new DownloadServerLink(); fileLink.Name = "DownloadedLink"; fileLink.FilePartLinks = new DownloadFilePartLink[1]; DownloadFilePartLink filePartLink = new DownloadFilePartLink(); filePartLink.Downloaded = false; filePartLink.DownloadLink = downloadLink; filePartLink.State = state; filePartLink.DownloadedFile = file; filePartLink.File = file; filePartLink.StartDownloadTime = startDownloadTime; filePartLink.EndDownloadTime = endDownloadTime; filePartLink.DownloadDuration = downloadDuration; fileLink.FilePartLinks[0] = filePartLink; downloadItemLink.ServerLinks[i2++] = fileLink; //for (int i2 = 0; i2 < requestFileLinks.Length; i2++) foreach (string link in downloadLinks) { //IRequestDownloadServerLink requestFileLink = requestFileLinks[i2]; fileLink = new DownloadServerLink(); //fileLink.Name = requestFileLink.GetName(); fileLink.Name = DownloadFileServerInfo.GetServerNameFromLink(link); //string[] filePartLinks = requestFileLink.GetFilePartLinks(); fileLink.FilePartLinks = new DownloadFilePartLink[1]; //for (int i3 = 0; i3 < filePartLinks.Length; i3++) //{ filePartLink = new DownloadFilePartLink(); filePartLink.Downloaded = false; filePartLink.DownloadLink = link; filePartLink.State = DownloadState.NotDownloaded; fileLink.FilePartLinks[0] = filePartLink; //} downloadItemLink.ServerLinks[i2++] = fileLink; } //downloadItemLinks.Add(downloadItemLink); //} return(new DownloadItemLink[] { downloadItemLink }); }