private void button1_Click(object sender, RoutedEventArgs e) { try { if(listBox1.SelectedIndex>=0) { CacheHandler ch = new CacheHandler(); ch.setCache("../../CacheDir"); string packagedata=listBox1.SelectedItem.ToString(); string [] package=packagedata.Split('-'); string []fname=package[package.Length-2].Split('\t'); string filename = fname[fname.Length - 1]; string ver=package[package.Length-1]; string xmlname = filename + ".xml-" + ver; string dpath; filename += "-" + ver; string[] result = client.CreateDownloadList(xmlname, filename); List<string> duplicate = new List<string>(); duplicate.AddRange(result); string[] res = ch.ScanCache(result); if (res != null) { result = res; } FileTransfer ft = new FileTransfer(); System.Windows.Forms.FolderBrowserDialog fd = new System.Windows.Forms.FolderBrowserDialog(); if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) dpath = fd.SelectedPath; else dpath = "."; for (int i = 0; i < result.Length; i++) { ft.DownloadPackages(result[i], ch.getCache(), client); } ft.Cache_To_DlodXfer(duplicate, dpath); listBox4.Items.Clear(); PopulateCacheListBox(); MessageBox.Show("Downloaded Files Successfully"); listBox1.SelectedIndex = -1; DownloadResults(duplicate, res); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, RoutedEventArgs e) { try { string status; Manifest m = new Manifest(); m.setManifestDir("../../Manifests"); if (checkBox1.IsChecked == true) status = "OPEN"; else if (m.hadOpenDependency(listBox3.Items)) { status = "PENDING"; } else status = "CLOSED"; FileInfo file = new FileInfo(textBox1.Text); IList dependencies = listBox3.Items; //Generate the Manifest File of the currently being checked in package FileInfo xml = m.CreateManifest(file, dependencies, status, username); if (file != null) { int ver = client.CheckInPackages(file); int xmlver = ver;//client.CheckInPackages(xml); string filename = file.Name + "-" + ver.ToString(); string xmlname = xml.Name + "-" + xmlver.ToString(); //bool result= U.Upload(filename); int tempver = xmlver - 1; bool result = client.IsRI(xml.Name + "-" + tempver, username); if (result) { FileTransfer f = new FileTransfer(); f.FileUpload(file, filename, client); f.FileUpload(xml, xmlname, client); listBox1.Items.Clear(); listBox2.Items.Clear(); listBox3.Items.Clear(); checkBox1.IsChecked = false; PopulateListBox(); m.DeleteManifests(); listBox3.IsEnabled = false; } else { MessageBox.Show("User Needs to Be RI to do a check In"); } button2.IsEnabled = false; textBox1.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, RoutedEventArgs e) { try { string packagedata=listBox1.SelectedItem.ToString(); string [] package=packagedata.Split('-'); string []fname=package[package.Length-2].Split('\t'); string filename = fname[fname.Length - 1]; string ver=package[package.Length-1]; string xmlname = filename + ".xml-" + ver; string dpath; filename += "-" + ver; string[] result = client.CreateDownloadList(xmlname, filename); FileTransfer ft = new FileTransfer(); System.Windows.Forms.FolderBrowserDialog fd = new System.Windows.Forms.FolderBrowserDialog(); if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) dpath = fd.SelectedPath; else dpath = "."; for (int i = 0; i < result.Length; i++) { ft.DownloadPackages(result[i],dpath,client); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }