//private void btnRefresh_Click(object sender, RoutedEventArgs e) //{ // RefreshVersions(); //} //private void RefreshVersions() //{ // if (!Directory.Exists(this.updateFolder)) // Directory.CreateDirectory(this.updateFolder); // Regex regex = new Regex(@"^[A-Z]\d{6}_\d{6}$"); // this.listBox1.Items.Clear(); // this.lstVersionFolders = Directory.GetDirectories(this.updateFolder) // .Where(x => regex.IsMatch(new DirectoryInfo(x).Name)) // .ToList(); // foreach (string version in this.lstVersionFolders) // { // this.listBox1.Items.Add(new DirectoryInfo(version).Name); // } // SetButtonState(); //} //private void hyperlink1_Click(object sender, RoutedEventArgs e) //{ //} //private void Window_Unloaded(object sender, RoutedEventArgs e) //{ // localMachinekey.Close(); // cpsKey.Close(); //} private void CollectionViewSource_Filter(object sender, FilterEventArgs e) { FWViewModel fwVM = e.Item as FWViewModel; if (fwVM.Region == this.mainVM.SelectedRegion) { e.Accepted = true; } else { e.Accepted = false; } }
private void CreateOneVersion(IEnumerable <FWViewModel> lstFWVMs) { if (lstFWVMs == null || lstFWVMs.Count() == 0) { return; } string now = DateTime.Now.ToString("_yyyyMMddHHmmssfff"); FWViewModel firstFWVM = lstFWVMs.First(); //string strFWKey = new DirectoryInfo(versionFullPath).Name + now; string strFWKey = Guid.NewGuid().ToString(); RegistryKey fwKey = packKey.CreateSubKey(strFWKey, RegistryKeyPermissionCheck.ReadWriteSubTree); if (fwKey == null) { MessageBox.Show(string.Format("Error:cannot create {0}!", strFWKey)); return; } //string Pakpd032 = Directory.GetDirectories(versionFullPath)[0]; HashSet <string> pmFolders = new HashSet <string>(); foreach (FWViewModel fwVMs in lstFWVMs) { pmFolders.Add(fwVMs.FolderName2PM); } int cnt = 0; foreach (string pmFolder in pmFolders) { cnt++; fwKey.SetValue(string.Format("Path{0}", cnt), pmFolder); } //foreach (string pm in Directory.GetDirectories(Pakpd032)) //{ // cnt++; // fwKey.SetValue(string.Format("Path{0}", cnt), pm); //} //fwKey.SetValue("Region", (this.cboRegion.SelectedItem as ComboBoxItem).Content.ToString()); //fwKey.SetValue("Title", "Title" + strFWKey); //fwKey.SetValue("Type", "Type" + strFWKey); fwKey.SetValue("Region", this.dicRegion[firstFWVM.Region]); fwKey.SetValue("Title", "Title" + strFWKey); fwKey.SetValue("Type", "Type" + strFWKey); fwKey.Close(); }
private void SearchAllFWs() { this.LstFWVMs = new ObservableCollection <FWViewModel>(); //this.dicVerModel = new Dictionary<string, string>(); this.lstVersionFolers = new List <string>(); this.GetVerFolders(this.UpdateFolder); foreach (string verFolder in this.lstVersionFolers) { foreach (string pak32 in Directory.GetDirectories(verFolder)) { foreach (string pm in Directory.GetDirectories(pak32)) { foreach (string modelFolder in Directory.GetDirectories(pm)) { FWViewModel fwVM = new FWViewModel(pm, modelFolder); this.LstFWVMs.Add(fwVM); } } } } }