public static void RefreshFolders() { List <string> folders = new List <string>(); folders.Add(@"C:\Users\nachog4\Desktop\Gamez\"); folders.Add(@"C:\Users\nachog4\Desktop\VR Gamez\"); foreach (var folder in folders) { string[] filePaths = Directory.GetFiles(folder, "*.lnk", SearchOption.AllDirectories); foreach (var item in filePaths) { ShortcutInfo sInfo = GetShortcutInfo(item); if (sInfo != null && !sInfo.isError && !String.IsNullOrEmpty(sInfo.Path)) { if (DbController.GetEntries(sInfo.Path).Count() == 0) { var results = ImagesProvider.googleSearch(sInfo.Name + " cover"); AppEntry newEntry = new AppEntry(); newEntry.Name = sInfo.Name; newEntry.Path = sInfo.Path; newEntry.Image2 = Tools.GetByteFromUrl(results[0].Link); DbController.AddEntry(newEntry); } } } } }
public void ShowAppEntries() { flowLayoutPanel1.Controls.Clear(); List <AppEntry> appList = DbController.GetEntries(); string lastGroup = ""; //ORDER if (isGroupingEnabled) { switch (GroupingType) { case "CATEGORY": appList = appList.OrderBy(x => x.Category).ThenBy(x => x.Name).ToList(); break; case "DRIVE": appList = appList.OrderBy(x => x.Path.Substring(0, 1)).ThenBy(x => x.Name).ToList(); break; } } else { appList = appList.OrderBy(x => x.Name).ToList(); } foreach (var item in appList) { if (!isGroupingEnabled) { ShowEntry_v2(item); } if (isGroupingEnabled && GroupingType == "CATEGORY") { if (item.Category != lastGroup) { setFlowBreak(item.Category); } ShowEntry_v2(item); lastGroup = item.Category; } if (isGroupingEnabled && GroupingType == "DRIVE") { string currentDrive = item.Path.Substring(0, 1); if (currentDrive != lastGroup) { setFlowBreak(currentDrive); } ShowEntry_v2(item); lastGroup = currentDrive; } } }
public void refreshFolder() { foreach (var item in DbController.GetEntries()) { bool stillExist = File.Exists(item.Path); if (!stillExist) { DbController.DeleteEntry(item); } } }