Esempio n. 1
0
        public virtual void GenerateRenameSubFiles(int index, bool copyToMovieLocation = false)
        {
            var subFileInfo = SubFiles[index];
            var fileName    = MovieFileName.Substring(0, MovieFileName.LastIndexOf(".", StringComparison.Ordinal));
            var extension   = subFileInfo.Name.Substring(
                subFileInfo.Name.Substring(subFileInfo.Name.Length - 15).IndexOf(".", StringComparison.Ordinal) +
                (subFileInfo.Name.Length - 15));

            if (copyToMovieLocation)
            {
                if (MovieFile.Directory != null)
                {
                    var path = Path.Combine(MovieFile.Directory.FullName, fileName + extension);
                    RenamedSubFiles.Insert(index, new FileInfo(path));
                }
                else
                {
                    throw new FileNotFoundException("视频文件不存在", MovieFile.FullName);
                }
            }
            else
            {
                if (subFileInfo.Directory != null)
                {
                    var path = Path.Combine(subFileInfo.Directory.FullName, fileName + extension);
                    RenamedSubFiles.Insert(index, new FileInfo(path));
                }
                else
                {
                    throw new FileNotFoundException("字幕文件不存在", subFileInfo.FullName);
                }
            }
        }