private void LoadUtilSofewares() { lvUtilSofeware.Items.Clear(); if (System.IO.Directory.Exists(PubData.GV_IceUtilSofewarePath)) { FileInfo[] files = FileDirSearcher.GetAllFilePath(PubData.GV_IceUtilSofewarePath); Icon icon = null; ListViewItem item = null; ImageList imglUtils = new ImageList(); int index = imglUtils.Images.Count; int i = imglUtils.Images.Count; foreach (FileInfo fi in files) { icon = FileIcon.ExtractAssociatedIcon(fi.FullName); imglUtils.Images.Add(icon); imglUtils.Images.SetKeyName(index, fi.Name); item = new ListViewItem(); item.Text = fi.Name; item.Tag = fi.FullName; lvUtilSofeware.Items.Add(item); index++; } imglUtils.ColorDepth = ColorDepth.Depth32Bit; imglUtils.ImageSize = new Size(32, 32); lvUtilSofeware.LargeImageList = imglUtils; foreach (FileInfo fi in files) { lvUtilSofeware.Items[i].ImageIndex = i; i++; } hasLoadUtils = true; } else { System.IO.Directory.CreateDirectory(PubData.GV_IceUtilSofewarePath); } }
private void bgwkCleanupDesktop_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { if (!System.IO.Directory.Exists(PubData.GV_ShortCutSavePath)) { System.IO.Directory.CreateDirectory(PubData.GV_ShortCutSavePath); } string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); fis = FileDirSearcher.GetAllFilePath(desktopPath); UpdateOperateState(); string dest = string.Empty; arrDestFiles = new ArrayList(); foreach (FileInfo fi in fis) { dest = PubData.GV_ShortCutSavePath + fi.FullName.Substring(fi.FullName.LastIndexOf("\\")); MoveFolderTo(fi.FullName, dest); System.IO.File.Delete(fi.FullName); arrDestFiles.Add(dest); } }