Exemplo n.º 1
0
        public void MakeDup(string rank_file_diff1_path, string rank_file_diff2_path, InputOutputOption iooption, RankingMethod ranking_method)
        {
            if (!File.Exists(rank_file_diff1_path))
            {
                throw new Exception("ランクファイル(1)が存在しません。");
            }
            if (!File.Exists(rank_file_diff2_path))
            {
                throw new Exception("ランクファイル(2)が存在しません。");
            }

            msgout_.Write("重複チェック中…\r\n");
            RankFile     rank_file_diff1  = new RankFile(rank_file_diff1_path, iooption.GetRankFileCustomFormat());
            RankFile     rank_file_diff2  = new RankFile(rank_file_diff2_path, iooption.GetRankFileCustomFormat());
            List <Video> video_list_diff2 = rank_file_diff2.GetVideoList();
            List <Video> video_list       = new List <Video>();

            for (int i = 0; i < rank_file_diff1.Count; ++i)
            {
                Video video = rank_file_diff1.GetVideo(i);
                int   index = RankFile.SearchVideo(video_list_diff2, video.video_id);
                if (index >= 0)
                {
                    video_list.Add(video);
                }
            }
            RankFile rank_file = new RankFile(video_list, iooption.GetRankFileCustomFormat());

            rank_file.Sort(ranking_method);
            iooption.OutputRankFile(rank_file, ranking_method);
            msgout_.Write("重複チェックが終了しました。\r\n");
        }
Exemplo n.º 2
0
        public void SortRankFile(InputOutputOption iooption, RankingMethod ranking_method)
        {
            RankFile rank_file = iooption.GetRankFile();

            rank_file.Sort(ranking_method);
            iooption.OutputRankFile(rank_file, ranking_method);
            msgout_.Write("再計算しました。\r\n");
        }
Exemplo n.º 3
0
        public void MergeRankFileB(string rank_file_diff1_path, string rank_file_diff2_path, InputOutputOption iooption, RankingMethod ranking_method)
        {
            bool exists_rank_file1 = File.Exists(rank_file_diff1_path);
            bool exists_rank_file2 = File.Exists(rank_file_diff2_path);

            if (!exists_rank_file1 && !exists_rank_file2)
            {
                throw new Exception("ランクファイル(1),(2)が存在しません。");
            }

            msgout_.Write("マージ中…\r\n");
            if (!exists_rank_file1 && rank_file_diff1_path != "")
            {
                msgout_.WriteLine("ランクファイル(1)は存在しません。");
            }
            if (!exists_rank_file2 && rank_file_diff2_path != "")
            {
                msgout_.WriteLine("ランクファイル(2)は存在しません。");
            }
            RankFile rank_file_diff1 = (exists_rank_file1 ? new RankFile(rank_file_diff1_path, iooption.GetRankFileCustomFormat()) : null);
            RankFile rank_file_diff2 = (exists_rank_file2 ? new RankFile(rank_file_diff2_path, iooption.GetRankFileCustomFormat()) : null);

            List <Video> video_list = new List <Video>();

            if (exists_rank_file1)
            {
                for (int i = 0; i < rank_file_diff1.Count; ++i)
                {
                    Video video = rank_file_diff1.GetVideo(i);
                    if (RankFile.SearchVideo(video_list, video.video_id) < 0)
                    {
                        video_list.Add(video);
                    }
                }
            }
            if (exists_rank_file2)
            {
                for (int i = 0; i < rank_file_diff2.Count; ++i)
                {
                    Video video = rank_file_diff2.GetVideo(i);
                    if (RankFile.SearchVideo(video_list, video.video_id) < 0)
                    {
                        video_list.Add(video);
                    }
                }
            }

            RankFile rank_file = new RankFile(video_list, iooption.GetRankFileCustomFormat());

            rank_file.Sort(ranking_method);
            iooption.OutputRankFile(rank_file, ranking_method);
            msgout_.Write("マージが終了しました。\r\n");
        }
Exemplo n.º 4
0
        public void UpdatePoint(string rank_file_diff1_path, string rank_file_diff2_path, InputOutputOption iooption, RankingMethod ranking_method)
        {
            bool exists_rank_file1 = File.Exists(rank_file_diff1_path);

            if (!exists_rank_file1)
            {
                throw new Exception("ランクファイル(1)が存在しません。");
            }

            bool exists_rank_file2 = File.Exists(rank_file_diff2_path);

            if (!exists_rank_file2)
            {
                throw new Exception("ランクファイル(2)が存在しません。");
            }

            msgout_.Write("ポイント更新中…\r\n");

            RankFile rank_file_diff1 = new RankFile(rank_file_diff1_path, iooption.GetRankFileCustomFormat());
            RankFile rank_file_diff2 = new RankFile(rank_file_diff2_path, iooption.GetRankFileCustomFormat());

            List <Video> video_list_diff2 = rank_file_diff2.GetVideoList();
            List <Video> video_list       = new List <Video>();

            for (int i = 0; i < rank_file_diff1.Count; ++i)
            {
                Video video = rank_file_diff1.GetVideo(i);
                int   index = RankFile.SearchVideo(rank_file_diff2.GetVideoList(), video.video_id);
                if (index >= 0)
                {
                    video.title       = video_list_diff2[index].title;
                    video.tag_set     = video_list_diff2[index].tag_set;
                    video.point       = video_list_diff2[index].point;
                    video.description = video_list_diff2[index].description;
                    video_list.Add(video);
                }
            }

            RankFile rank_file = new RankFile(video_list, iooption.GetRankFileCustomFormat());

            rank_file.Sort(ranking_method);
            iooption.OutputRankFile(rank_file, ranking_method);
            msgout_.Write("ポイント更新が終了しました。\r\n");
        }
Exemplo n.º 5
0
        public void MakeDiff(string rank_file_diff1_path, string rank_file_diff2_path, InputOutputOption iooption, RankingMethod ranking_method, DateTime exclusion_date)
        {
            if (!File.Exists(rank_file_diff1_path))
            {
                throw new Exception("ランクファイル(1)が存在しません。");
            }
            if (!File.Exists(rank_file_diff2_path))
            {
                throw new Exception("ランクファイル(2)が存在しません。");
            }

            msgout_.Write("差分を計算中…\r\n");
            RankFile     rank_file_diff1  = new RankFile(rank_file_diff1_path, iooption.GetRankFileCustomFormat());
            RankFile     rank_file_diff2  = new RankFile(rank_file_diff2_path, iooption.GetRankFileCustomFormat());
            List <Video> video_list_diff2 = rank_file_diff2.GetVideoList();
            List <Video> video_list       = new List <Video>();

            for (int i = 0; i < rank_file_diff1.Count; ++i)
            {
                Video video = rank_file_diff1.GetVideo(i);
                int   index = RankFile.SearchVideo(video_list_diff2, video.video_id);
                if (index >= 0)
                {
                    video.point -= video_list_diff2[index].point;
                    video_list.Add(video);
                }
                else
                {
                    if (exclusion_date <= video.submit_date)
                    {
                        video_list.Add(video);
                    }
                }
            }
            RankFile rank_file = new RankFile(video_list, iooption.GetRankFileCustomFormat());

            rank_file.Sort(ranking_method);
            iooption.OutputRankFile(rank_file, ranking_method);
            msgout_.Write("差分を計算しました。\r\n");
        }
Exemplo n.º 6
0
        public void MergeRankFileA(string rank_file_diff1_path, string rank_file_diff2_path, InputOutputOption iooption, RankingMethod ranking_method)
        {
            bool exists_rank_file1 = File.Exists(rank_file_diff1_path);
            bool exists_rank_file2 = File.Exists(rank_file_diff2_path);

            if (!exists_rank_file1 && !exists_rank_file2)
            {
                throw new Exception("ランクファイル(1),(2)が存在しません。");
            }

            msgout_.Write("マージ中…\r\n");
            if (!exists_rank_file1 && rank_file_diff1_path != "")
            {
                msgout_.WriteLine("ランクファイル(1)は存在しません。");
            }
            if (!exists_rank_file2 && rank_file_diff2_path != "")
            {
                msgout_.WriteLine("ランクファイル(2)は存在しません。");
            }
            RankFile rank_file_diff1 = (exists_rank_file1 ? new RankFile(rank_file_diff1_path, iooption.GetRankFileCustomFormat()) : null);
            RankFile rank_file_diff2 = (exists_rank_file2 ? new RankFile(rank_file_diff2_path, iooption.GetRankFileCustomFormat()) : null);

            List <Video> video_list = new List <Video>();

            if (exists_rank_file1)
            {
                MergeToList(rank_file_diff1, video_list, ranking_method);
            }
            if (exists_rank_file2)
            {
                MergeToList(rank_file_diff2, video_list, ranking_method);
            }

            RankFile rank_file = new RankFile(video_list, iooption.GetRankFileCustomFormat());

            rank_file.Sort(ranking_method);
            iooption.OutputRankFile(rank_file, ranking_method);
            msgout_.Write("マージが終了しました。\r\n");
        }