示例#1
0
        public static Dictionary <VideoFilePart, List <VideoFilePart> > Collect(string courseRootPath)
        {
            var dict = new Dictionary <VideoFilePart, List <VideoFilePart> >();
            IEnumerable <string> files = Directory.EnumerateFiles(courseRootPath, "*.mp4", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                try
                {
                    var videoFile = VideoFile.CreateFromFullPath(file);
                    if (dict.ContainsKey(videoFile.FileName.Section))
                    {
                        dict[videoFile.FileName.Section].Add(videoFile.FileName.Lecture);
                    }
                    else
                    {
                        dict.Add(videoFile.FileName.Section, new List <VideoFilePart> {
                            videoFile.FileName.Lecture
                        });
                    }
                }
                catch (Exception ex)
                {
                    Logger.Write($"Error parsing file->{file}. Exception:{ex}");
                }
            }
            return(dict);
        }
示例#2
0
        public static List <VideoFile> Collect2(string courseRootPath)
        {
            var list = new List <VideoFile>();

            foreach (var file in Directory.EnumerateFiles(courseRootPath, "*.mp4", SearchOption.AllDirectories))
            {
                try
                {
                    list.Add(VideoFile.CreateFromFullPath(file));
                }
                catch (Exception ex)
                {
                    Logger.Write($"Error parsing file->{file}. Exception:{ex}");
                }
            }
            return(list);
        }