Beispiel #1
0
        private void fill_RightPanel(AppEntry entry)
        {
            lbl_rightpanel_title.Text = entry.Name;

            webBrowser1.DocumentText = "<html><body style='background-color:black;'></body></html>";
            new YoutubeProvider().Run(entry.Name + " review");

            if (entry.Screenshot1 == null && entry.Screenshot2 == null & entry.Screenshot3 == null)
            {
                var results = ImagesProvider.googleSearch(entry.Name + " screenshot");

                entry.Screenshot1 = Tools.GetByteFromUrl(results[0].Link);
                entry.Screenshot2 = Tools.GetByteFromUrl(results[1].Link);
                entry.Screenshot3 = Tools.GetByteFromUrl(results[2].Link);

                DbController.ModifyEntry(entry);
            }

            if (entry.Screenshot1 != null)
            {
                pic_rightpanel_1.Image = Tools.GetImageFromByte(entry.Screenshot1);
            }
            if (entry.Screenshot2 != null)
            {
                pic_rightpanel_2.Image = Tools.GetImageFromByte(entry.Screenshot2);
            }
            if (entry.Screenshot3 != null)
            {
                pic_rightpanel_3.Image = Tools.GetImageFromByte(entry.Screenshot3);
            }
        }
Beispiel #2
0
        public static AppEntry AddEntry(string name, string path, string image1)
        {
            AppEntry newEntry = new AppEntry();

            //newEntry.Id = 1;
            newEntry.Name   = name;
            newEntry.Path   = path;
            newEntry.Image1 = image1;

            try
            {
                if (!String.IsNullOrEmpty(image1))
                {
                    var    webClient  = new WebClient();
                    byte[] imageBytes = webClient.DownloadData(image1);
                    newEntry.Image2 = imageBytes;
                }
            }
            catch (Exception ex)
            {
                var    webClient  = new WebClient();
                byte[] imageBytes = webClient.DownloadData(" https://image.freepik.com/free-vector/funny-error-404-background-design_1167-219.jpg");
                newEntry.Image2 = imageBytes;
            }

            newEntry = model.AppEntries.Add(newEntry);
            model.SaveChanges();

            return(newEntry);
        }
Beispiel #3
0
        public void ShowEntry_v2(AppEntry appEntry)
        {
            PictureBox pic = new PictureBox();

            pic.Name = "pb_" + appEntry.Id.ToString();

            pic.Image = Tools.GetImageFromByte(appEntry.Image2);

            pic.SizeMode = PictureBoxSizeMode.Zoom;
            pic.Height   = picturesHeight;

            double ar = (double)pic.Image.Width / (double)pic.Image.Height;

            pic.Width = (int)Math.Round(pic.Height * ar);

            pic.Cursor = Cursors.Hand;
            pic.Click += Pic_Click;

            //check files are ok
            bool filesOk = File.Exists(appEntry.Path);

            if (!filesOk)
            {
                pic.BackColor = Color.Red;
            }

            flowLayoutPanel1.Controls.Add(pic);

            pic.MouseEnter += Pic_MouseHover;
        }
Beispiel #4
0
        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();
            }
        }
Beispiel #5
0
        public void InitializeValuesFromEntry(AppEntry entry)
        {
            txt_id.Text       = entry.Id.ToString();
            txt_name.Text     = entry.Name;
            txt_path.Text     = entry.Path;
            txt_category.Text = entry.Category;

            if (entry.Image2 != null)
            {
                pic_image.Image = Tools.GetImageFromByte(entry.Image2);
            }

            if (entry.Screenshot1 != null)
            {
                pic_screenshot1.Image = Tools.GetImageFromByte(entry.Screenshot1);
            }
            if (entry.Screenshot2 != null)
            {
                pic_screenshot2.Image = Tools.GetImageFromByte(entry.Screenshot2);
            }
            if (entry.Screenshot3 != null)
            {
                pic_screenshot3.Image = Tools.GetImageFromByte(entry.Screenshot3);
            }
        }
Beispiel #6
0
        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);
                        }
                    }
                }
            }
        }
Beispiel #7
0
        private void cmd_delete_Click(object sender, EventArgs e)
        {
            if (txt_id.Text != "")
            {
                AppEntry modifyApp = DbController.GetEntry(Convert.ToInt32(txt_id.Text));
                DbController.DeleteEntry(modifyApp);

                (System.Windows.Forms.Application.OpenForms["AppEntryDetailsForm"] as AppEntryDetailsForm).Close();
                (System.Windows.Forms.Application.OpenForms["Form1"] as Form1).ShowAppEntries();
            }
        }
Beispiel #8
0
        public static AppEntry ModifyEntry(AppEntry modifiedEntry)
        {
            //if (!String.IsNullOrEmpty(modifiedEntry.Image1))
            //{
            //    var webClient = new WebClient();
            //    byte[] imageBytes = webClient.DownloadData(modifiedEntry.Image1);
            //    modifiedEntry.Image2 = imageBytes;
            //}

            model.Entry(modifiedEntry).State = System.Data.Entity.EntityState.Modified;
            model.SaveChanges();

            return(modifiedEntry);
        }
Beispiel #9
0
        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);
                }
            }
        }
Beispiel #10
0
        private void Pic_Click(object sender, EventArgs e)
        {
            MouseEventArgs me = (MouseEventArgs)e;

            if (selectedItem == (sender as PictureBox).Name && me.Button == MouseButtons.Left)
            {
                return;
            }

            PictureBox tmpPictureBox = (PictureBox)sender;
            int        entryId       = Convert.ToInt32(tmpPictureBox.Name.Replace("pb_", ""));
            AppEntry   entry         = DbController.GetEntry(entryId);

            selectedItem     = tmpPictureBox.Name;
            cmd_play.Visible = true;
            (sender as PictureBox).BorderStyle = BorderStyle.Fixed3D;

            foreach (var item in (sender as PictureBox).Parent.Controls.OfType <PictureBox>().Where(x => x.BorderStyle != BorderStyle.None && x.Name != selectedItem))
            {
                item.BorderStyle = BorderStyle.None;
            }

            lbl_status.Text = entry.Path;

            if (me.Button == MouseButtons.Right)
            {
                Form[] formsList = Application.OpenForms.OfType <AppEntryDetailsForm>().Cast <Form>().ToArray();
                foreach (Form openForm in formsList)
                {
                    openForm.Close();
                }

                AppEntryDetailsForm entryDetailsForm = new AppEntryDetailsForm();
                entryDetailsForm.Show();
                entryDetailsForm.InitializeValuesFromEntry(entry);
            }
            else
            {
                fill_RightPanel(entry);
            }
        }
Beispiel #11
0
 public static void DeleteEntry(AppEntry entry)
 {
     model.AppEntries.Remove(entry);
     model.SaveChanges();
 }
Beispiel #12
0
 public static void AddEntry(AppEntry newEntry)
 {
     model.AppEntries.Add(newEntry);
     model.SaveChanges();
 }