Example #1
0
        public void Query(string movieid)
        {
            DetailMovie detailMovie = null;
            string      table       = GetCurrentListFromMain();

            if (!string.IsNullOrEmpty(table))
            {
                //清单
                using (MySqlite mySqlite = new MySqlite("mylist.sqlite"))
                {
                    detailMovie = mySqlite.SelectDetailMovieBySql($"select * from {table} where id='{movieid}'");
                }
            }
            else
            {
                detailMovie = DataBase.SelectDetailMovieById(movieid);
                //访问次数+1
                if (detailMovie != null)
                {
                    detailMovie.visits += 1;
                    DataBase.UpdateMovieByID(movieid, "visits", detailMovie.visits);
                }
            }



            //释放图片内存
            if (DetailMovie != null)
            {
                DetailMovie.smallimage = null;
                DetailMovie.bigimage   = null;
                for (int i = 0; i < DetailMovie.extraimagelist.Count; i++)
                {
                    DetailMovie.extraimagelist[i] = null;
                }

                for (int i = 0; i < DetailMovie.actorlist.Count; i++)
                {
                    DetailMovie.actorlist[i].bigimage   = null;
                    DetailMovie.actorlist[i].smallimage = null;
                }
            }
            GC.Collect();


            DetailMovie = new DetailMovie();
            if (detailMovie != null)
            {
                detailMovie.bigimage = ImageProcess.GetBitmapImage(detailMovie.id, "BigPic");
                MySqlite db = new MySqlite("Translate");
                //加载翻译结果
                if (Properties.Settings.Default.TitleShowTranslate)
                {
                    string translate_title = db.GetInfoBySql($"select translate_title from youdao where id='{detailMovie.id}'");
                    if (translate_title != "")
                    {
                        detailMovie.title = translate_title;
                    }
                }

                if (Properties.Settings.Default.PlotShowTranslate)
                {
                    string translate_plot = db.GetInfoBySql($"select translate_plot from youdao where id='{detailMovie.id}'");
                    if (translate_plot != "")
                    {
                        detailMovie.plot = translate_plot;
                    }
                }
                db.CloseDB();

                //显示新增按钮
                List <string> labels = detailMovie.labellist;
                detailMovie.labellist = new List <string>();
                detailMovie.labellist.Add("+");
                detailMovie.labellist.AddRange(labels);
                DetailMovie           = detailMovie;
                detailMovie.tagstamps = "";
                FileProcess.addTag(ref detailMovie);
                if (string.IsNullOrEmpty(DetailMovie.title))
                {
                    DetailMovie.title = Path.GetFileNameWithoutExtension(DetailMovie.filepath);
                }
                QueryCompleted?.Invoke(this, new EventArgs());
            }
        }
Example #2
0
        public void Query(string movieid)
        {
            ((WindowDetails)FileProcess.GetWindowByName("WindowDetails")).SetStatus(false);
            DetailMovie detailMovie = null;

            detailMovie = DataBase.SelectDetailMovieById(movieid);
            //访问次数+1
            if (detailMovie != null)
            {
                detailMovie.visits += 1;
                DataBase.UpdateMovieByID(movieid, "visits", detailMovie.visits);
            }

            //释放图片内存
            if (DetailMovie != null)
            {
                DetailMovie.smallimage = null;
                DetailMovie.bigimage   = null;
                for (int i = 0; i < DetailMovie.extraimagelist.Count; i++)
                {
                    DetailMovie.extraimagelist[i] = null;
                }

                for (int i = 0; i < DetailMovie.actorlist.Count; i++)
                {
                    DetailMovie.actorlist[i].bigimage   = null;
                    DetailMovie.actorlist[i].smallimage = null;
                }
            }
            GC.Collect();


            DetailMovie = new DetailMovie();
            if (detailMovie != null)
            {
                BitmapImage bigimage = ImageProcess.GetBitmapImage(detailMovie.id, "BigPic");
                if (bigimage == null)
                {
                    bigimage = DefaultBigImage;
                }
                detailMovie.bigimage = bigimage;
                MySqlite db = new MySqlite("Translate");
                //加载翻译结果
                if (Properties.Settings.Default.TitleShowTranslate)
                {
                    string translate_title = db.GetInfoBySql($"select translate_title from youdao where id='{detailMovie.id}'");
                    if (translate_title != "")
                    {
                        detailMovie.title = translate_title;
                    }
                }

                if (Properties.Settings.Default.PlotShowTranslate)
                {
                    string translate_plot = db.GetInfoBySql($"select translate_plot from youdao where id='{detailMovie.id}'");
                    if (translate_plot != "")
                    {
                        detailMovie.plot = translate_plot;
                    }
                }
                db.CloseDB();

                DetailMovie           = detailMovie;
                detailMovie.tagstamps = "";
                FileProcess.addTag(ref detailMovie);
                if (string.IsNullOrEmpty(DetailMovie.title))
                {
                    DetailMovie.title = Path.GetFileNameWithoutExtension(DetailMovie.filepath);
                }
                QueryCompleted?.Invoke(this, new EventArgs());
            }
        }