예제 #1
0
        public void Statistic()
        {
            Movies = new List <Movie>();
            string name = Path.GetFileNameWithoutExtension(Properties.Settings.Default.DataBasePath).ToLower();

            name = "DataBase\\" + name;
            MySqlite db = new MySqlite(name);

            Movies = db.SelectMoviesBySql("SELECT * FROM movie");
            db.CloseDB();
        }
예제 #2
0
        private static void CreateVideoData(string name)
        {
            if (!name.EndsWith(".sqlite"))
            {
                name += ".sqlite";
            }
            string   path = Path.Combine(GlobalVariable.VideoDataPath, name);
            MySqlite db   = new MySqlite(path);

            db.CreateTable(DataBase.SQLITETABLE_MOVIE);
            db.CreateTable(DataBase.SQLITETABLE_ACTRESS);
            db.CreateTable(DataBase.SQLITETABLE_LIBRARY);
            db.CreateTable(DataBase.SQLITETABLE_JAVDB);
            db.CloseDB();
        }
예제 #3
0
        public void Statistic()
        {
            Movies = new List <Movie>();
            string name = Properties.Settings.Default.DataBasePath.Split('\\').Last().Split('.').First().ToLower();

            if (name != "info")
            {
                name = "DataBase\\" + name;
            }
            MySqlite db = new MySqlite(name);

            Movies = db.SelectMoviesBySql("SELECT * FROM movie");
            db.CloseDB();

            AllCount        = Movies.Count;
            UncensoredCount = Movies.Where(arg => arg.vediotype == 1).Count();
            CensoredCount   = Movies.Where(arg => arg.vediotype == 2).Count();
            EuropeCount     = Movies.Where(arg => arg.vediotype == 3).Count();

            CensoredCountPercent   = (int)(100 * CensoredCount / (AllCount == 0 ? 1 : AllCount));
            UncensoredCountPercent = (int)(100 * UncensoredCount / (AllCount == 0 ? 1 : AllCount));
            EuropeCountPercent     = (int)(100 * EuropeCount / (AllCount == 0 ? 1 : AllCount));


            ChartValuesCensoredCount = new ChartValues <double>()
            {
                CensoredCount
            };
            ChartValuesUnCensoredCount = new ChartValues <double>()
            {
                UncensoredCount
            };
            ChartValuesEuropeCount = new ChartValues <double>()
            {
                EuropeCount
            };
            PointLabel = chartPoint => string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);

            //按识别码显示
            LoadID();
            LoadGenre();
            LoadTag();
            LoadActor();
            Formatter = value => value.ToString("N");
        }
예제 #4
0
        public void Create()
        {
            int      max      = number;
            string   savepath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "database", $"sample_{max}.sqlite");
            MySqlite db       = new MySqlite(savepath, true);

            db.CreateTable(DataBase.SQLITETABLE_MOVIE);
            db.CreateTable(DataBase.SQLITETABLE_ACTRESS);
            db.CreateTable(DataBase.SQLITETABLE_LIBRARY);
            db.CreateTable(DataBase.SQLITETABLE_JAVDB);
            db.CloseDB();

            List <string> ID = GetID(max);

            using (MySqlite mySqlite = new MySqlite(savepath, true))
            {
                for (int i = 0; i < max; i++)
                {
                    Movie movie = new Movie()
                    {
                        id          = ID[i],
                        favorites   = new Random(Guid.NewGuid().GetHashCode()).Next(0, 6),
                        visits      = new Random(Guid.NewGuid().GetHashCode()).Next(0, 100),
                        title       = GetSomeText(30, i),
                        runtime     = new Random(Guid.NewGuid().GetHashCode()).Next(0, 300),
                        rating      = (float)(new Random(Guid.NewGuid().GetHashCode()).Next(0, 100)) / 10,
                        filesize    = Math.Abs(5 * 1024 * new Random(Guid.NewGuid().GetHashCode()).Next(0, 1024 * 1024)),
                        subsection  = i % 100 == 0 ? "path1;path2" : "",
                        scandate    = DateTime.Now.AddDays(-new Random(Guid.NewGuid().GetHashCode()).Next(-500, 500)).ToString("yyyy-MM-dd HH:mm:ss"),
                        otherinfo   = DateTime.Now.AddDays(-new Random(Guid.NewGuid().GetHashCode()).Next(-500, 500)).ToString("yyyy-MM-dd HH:mm:ss"),
                        releasedate = DateTime.Now.AddDays(-new Random(Guid.NewGuid().GetHashCode()).Next(-500, 500)).ToString("yyyy-MM-dd"),
                        vediotype   = new Random(Guid.NewGuid().GetHashCode()).Next(1, 4),
                        tag         = "系列" + new Random(Guid.NewGuid().GetHashCode()).Next(defaultmax),
                        director    = "导演" + new Random(Guid.NewGuid().GetHashCode()).Next(defaultmax),
                        studio      = "发行商" + new Random(Guid.NewGuid().GetHashCode()).Next(defaultmax)
                    };
                    movie.genre = GetGenre(movie);
                    movie.actor = GetActor(max);
                    movie.label = GetLabel(max);
                    mySqlite.InsertFullMovie(movie, "movie");
                    Console.WriteLine(i);
                }
            }
        }
예제 #5
0
 private void InitDataBase()
 {
     if (!File.Exists(TranslateDataBasePath))
     {
         MySqlite db = new MySqlite("Translate");
         db.CreateTable(DataBase.SQLITETABLE_YOUDAO);
         db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE);
         db.CloseDB();
     }
     else
     {
         //是否具有表结构
         MySqlite db = new MySqlite("Translate");
         if (!db.IsTableExist("youdao"))
         {
             db.CreateTable(DataBase.SQLITETABLE_YOUDAO);
         }
         if (!db.IsTableExist("baidu"))
         {
             db.CreateTable(DataBase.SQLITETABLE_BAIDUTRANSLATE);
         }
         db.CloseDB();
     }
 }
예제 #6
0
        private void Rename(TextBox textBox)
        {
            string name = textBox.Text;

            //不修改
            if (name == beforeRename)
            {
                textBox.IsReadOnly = true;
                textBox.Cursor     = Cursors.Hand;
                beforeRename       = "";
                return;
            }


            //新建一个数据库
            if (beforeRename == "")
            {
                if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrEmpty(name) && !IsItemInList(name, DataBases) && name.IndexOfAny(Path.GetInvalidFileNameChars()) == -1)
                {
                    //新建

                    MySqlite db = new MySqlite("DataBase\\Comics\\" + name);
                    db.CreateTable(SqliteHelper.SQLITETABLE_COMICS);
                    db.CloseDB();

                    if (DataBases.Contains(Jvedio.Language.Resources.NewLibrary))
                    {
                        DataBases.Remove(Jvedio.Language.Resources.NewLibrary);
                    }
                    textBox.IsReadOnly = true;
                    textBox.Cursor     = Cursors.Hand;

                    DataBases.Add(name);
                    DataBases.Add(Jvedio.Language.Resources.NewLibrary);
                    RefreshItemsControl();
                }
                else
                {
                    textBox.Text = Jvedio.Language.Resources.NewLibrary;
                }
            }
            else
            {
                //重命名
                if (IsItemInList(name, DataBases))
                {
                    textBox.Text = beforeRename; //重复的
                }
                else
                {
                    //重命名
                    if (name.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) == -1)
                    {
                        try
                        {
                            File.Move(AppDomain.CurrentDomain.BaseDirectory + $"DataBase\\Comics\\{beforeRename}.sqlite",
                                      AppDomain.CurrentDomain.BaseDirectory + $"DataBase\\Comics\\{name}.sqlite");
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message);
                            Logger.LogE(ex);
                        }
                    }
                    else
                    {
                        textBox.Text = beforeRename;
                    }
                }
                beforeRename = "";
            }
            textBox.IsReadOnly    = true;
            textBox.Cursor        = Cursors.Hand;
            textBox.TextAlignment = TextAlignment.Left;
        }
예제 #7
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());
            }
        }
예제 #8
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());
            }
        }