private static VideoFolder CreateDirectory(VideoFolder MediaFolder, DirectoryInfo directoryInfo) { var subdir = Fileexplorercommonhelper.GetParentSubDirectory(directoryInfo, ApplicationService.Formats); var files = Fileexplorercommonhelper.GetFilesByExtensions(directoryInfo, ApplicationService.Formats); VideoFolder videoFolder = null; if (subdir.Count > 0 && files.Count > 0) { videoFolder = FileLoader.LoadParentFiles(MediaFolder, subdir, files, MediaFolder.SortedBy); } else if (subdir.Count > 0) { videoFolder = FileLoader.LoadParentFiles(MediaFolder, subdir, MediaFolder.SortedBy); } else if (files.Count > 0) { videoFolder = FileLoader.LoadParentFiles(MediaFolder, files, MediaFolder.SortedBy); } return(videoFolder); }
private static void CreateFile(object sender, string path) { DispatcherService.InvokeDispatchAction(new Action(() => { System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(path); var Mediafolder = ((MediaFileWatcher)sender).MediaFolder; if (directoryInfo.Exists) { var videoFolder = CreateDirectory(Mediafolder, new DirectoryInfo(path)); if (videoFolder != null) { Mediafolder.OtherFiles.Add(videoFolder); FileLoader.SortList(Mediafolder.SortedBy, Mediafolder); return; } } FileInfo fileInfo = new FileInfo(path); if (ApplicationService.Formats.ContainsKey(fileInfo.Extension)) { Mediafolder.OtherFiles.Add(FileLoader.CreateVideoFolderChild(Mediafolder, fileInfo)); FileLoader.SortList(Mediafolder.SortedBy, Mediafolder); } })); }