public static VideoFile CreateFromFullPath(string fullFilePath)
        {
            var di = new DirectoryInfo(fullFilePath);

            return(new VideoFile(fullFilePath,
                                 new VideoFileName(VideoFileParser.ParseFromSection(di.Parent?.Name),
                                                   VideoFileParser.ParseFromLecture(di.Name))));
        }
示例#2
0
        public static Result RemoveSectionParts(string courseRootPath)
        {
            foreach (var file in Directory.EnumerateFiles(courseRootPath, "*.mp4", SearchOption.AllDirectories))
            {
                try
                {
                    var    videoFileName   = VideoFileParser.ParseFromFileNameInLongFormat(file);
                    string newFullFilePath = Path.Combine(Path.GetDirectoryName(file), videoFileName.Lecture.ToString());

                    File.Move(file, newFullFilePath);
                }
                catch (Exception ex)
                {
                    return(Result.Fail($"Error parsing file->{file}. Exception:{ex}"));
                }
            }
            return(Result.Ok());
        }
 public static VideoFile CreateFromFileNameInLongFormat(string fullFilePath)
 {
     return(new VideoFile(fullFilePath, VideoFileParser.ParseFromFileNameInLongFormat(fullFilePath)));
 }