static void CreateOneVersion(IEnumerable <FWViewModel> lstFWVMs) { if (lstFWVMs == null || lstFWVMs.Count() == 0) { return; } string now = DateTime.Now.ToString("_yyyyMMddHHmmssfff"); FWViewModel firstFWVM = lstFWVMs.First(); string strFWKey = firstFWVM.Version + now; RegistryKey fwKey = packKey.CreateSubKey(strFWKey, RegistryKeyPermissionCheck.ReadWriteSubTree); if (fwKey == null) { Console.WriteLine(string.Format("出错,不能创建节点 {0}!", strFWKey)); return; } int cnt = 0; foreach (FWViewModel fwVMs in lstFWVMs) { cnt++; fwKey.SetValue(string.Format("Path{0}", cnt), fwVMs.FolderName2PM); } fwKey.SetValue("Region", dicRegion[firstFWVM.Region]); fwKey.SetValue("Title", "Title" + strFWKey); fwKey.SetValue("Type", "Type" + strFWKey); fwKey.Close(); }
static void SearchAllFWs() { Console.WriteLine("------搜索所有安装目录下的FW包------"); LstFWVMs = new List <FWViewModel>(); lstVersionFolers = new List <string>(); GetVerFolders(updateFolder); foreach (string verFolder in lstVersionFolers) { string pak32 = Directory.GetDirectories(verFolder)[0]; foreach (string pm in Directory.GetDirectories(pak32)) { foreach (string modelFolder in Directory.GetDirectories(pm)) { FWViewModel fwVM = new FWViewModel(pm, modelFolder); LstFWVMs.Add(fwVM); } } } }