Exemplo n.º 1
0
        public void RemoveUnnecessaryEnd()
        {
            List <string> toRemove = new List <string>();

            foreach (KeyValuePair <string, string> chapter in Chapters)
            {
                long timeInMiliSec = ChapterService.StrToMilisec(chapter.Key);
                if (timeInMiliSec >= LengthInMiliSec - 1001)
                {
                    Logger.Info(chapter.Value + ":" + chapter.Key + "的时间在文件结尾1秒内,删除。");
                    toRemove.Add(chapter.Key);
                }
            }

            if (toRemove.Count > 0)
            {
                foreach (string key in toRemove)
                {
                    Chapters.Remove(key);
                }
                WriteChapter();
            }
        }