private void btn_save_Click(object sender, EventArgs e) { if (txt_id.Text == "") { AppEntry newApp = new AppEntry(); newApp.Name = txt_name.Text; newApp.Path = txt_path.Text; newApp.Category = txt_category.Text; if (pic_image.Image != null) { newApp.Image2 = Tools.GetByteFromImage(pic_image.Image); } if (pic_screenshot1.Image != null) { newApp.Screenshot1 = Tools.GetByteFromImage(pic_screenshot1.Image); } if (pic_screenshot2.Image != null) { newApp.Screenshot2 = Tools.GetByteFromImage(pic_screenshot2.Image); } if (pic_screenshot3.Image != null) { newApp.Screenshot3 = Tools.GetByteFromImage(pic_screenshot3.Image); } DbController.AddEntry(newApp); (System.Windows.Forms.Application.OpenForms["AppEntryDetailsForm"] as AppEntryDetailsForm).Close(); (System.Windows.Forms.Application.OpenForms["Form1"] as Form1).ShowAppEntries(); } else { AppEntry modifyApp = DbController.GetEntry(Convert.ToInt32(txt_id.Text)); modifyApp.Name = txt_name.Text; modifyApp.Path = txt_path.Text; modifyApp.Category = txt_category.Text; if (pic_image.Image != null & image_isModified) { modifyApp.Image2 = Tools.GetByteFromImage(pic_image.Image); } if (pic_screenshot1.Image != null && screenshot1_isModified) { modifyApp.Screenshot1 = Tools.GetByteFromImage(pic_screenshot1.Image); } if (pic_screenshot2.Image != null && screenshot2_isModified) { modifyApp.Screenshot2 = Tools.GetByteFromImage(pic_screenshot2.Image); } if (pic_screenshot3.Image != null && screenshot3_isModified) { modifyApp.Screenshot3 = Tools.GetByteFromImage(pic_screenshot3.Image); } DbController.ModifyEntry(modifyApp); (System.Windows.Forms.Application.OpenForms["AppEntryDetailsForm"] as AppEntryDetailsForm).Close(); (System.Windows.Forms.Application.OpenForms["Form1"] as Form1).ShowAppEntries(); } }
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); } } } } }
private void flowLayoutPanel1_DragDrop(object sender, DragEventArgs e) { string[] files3 = (string[])e.Data.GetData(DataFormats.FileDrop); if (quickMode && files3 != null) { foreach (var item in files3) { ShortcutInfo sInfo = new ShortcutInfo(); sInfo = ShortcutsController.GetShortcutInfo(item); if (!sInfo.isError) { if (model.AppEntries.Count(x => x.Path == sInfo.Path) > 0) { continue; } 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); } } ShowAppEntries(); } if (!quickMode && files3 != null) { ShortcutInfo sInfo = new ShortcutInfo(); sInfo = ShortcutsController.GetShortcutInfo(files3[0]); if (!sInfo.isError) { AppEntryDetailsForm entryDetailsForm = new AppEntryDetailsForm(); entryDetailsForm.Show(); entryDetailsForm.InitializeValuesFromShortcut(sInfo); } } }