Ejemplo n.º 1
0
        public static ObservableCollection <VideoFolder> LoadChildrenFiles(IFolder Parentdir, bool newpath = false)
        {
            ObservableCollection <VideoFolder> Toparent = new ObservableCollection <VideoFolder>();

            List <FileInfo> files = FileExplorerCommonHelper.GetFilesByExtensions(Parentdir.Directory, formats);

            if (files.Count > 0)
            {
                ApplicationService.CreateLastSeenFolder(Parentdir);
                ApplicationService.LoadLastSeenFile(Parentdir);
            }

            for (int i = 0; i < files.Count; i++)
            {
                VideoFolderChild vd;
                PlayedFiles      pdf = (PlayedFiles)LastSeenHelper.GetProgress(Parentdir, files[i].Name);
                vd = new VideoFolderChild(Parentdir, files[i])
                {
                    FileSize = FileExplorerCommonHelper.FileSizeConverter(files[i].Length),
                    FileType = FileType.File
                };
                if (pdf != null)
                {
                    vd.LastPlayedPoisition = pdf;
                }
                else
                {
                    vd.LastPlayedPoisition = new PlayedFiles(files[i].Name);
                }


                Toparent.Add(vd);
            }
            return(Toparent);
        }
Ejemplo n.º 2
0
        public static VideoFolder LoadParent2(DirectoryInfo DirectoryPosition, SortType sorttype)
        {
            VideoFolder          ParentDir    = null;
            List <VideoFolder>   children     = new List <VideoFolder>();
            List <DirectoryInfo> ParentSubDir = FileExplorerCommonHelper.GetParentSubDirectory(DirectoryPosition, FileLoader.formats);

            // Dispatcher.Invoke(new Action(delegate
            //{
            ParentDir = new VideoFolder(DirectoryPosition.FullName);
            foreach (var item in ParentSubDir)
            {
                VideoFolder child = LoadParent2(item, sorttype);
                children.Add(child);
            }
            GetRootDetails(sorttype, ParentDir);
            // }));

            return(ParentDir);
        }
Ejemplo n.º 3
0
        public static VideoFolder LoadChildrenFiles(DirectoryInfo directoryInfo, bool newpath = false)
        {
            IFolder Parentdir = new VideoFolder(directoryInfo.Parent.FullName);

            ApplicationService.CreateLastSeenFolder(Parentdir);
            ApplicationService.LoadLastSeenFile(Parentdir);
            FileInfo         fileInfo = new FileInfo(directoryInfo.FullName);
            VideoFolderChild vd;
            PlayedFiles      pdf = (PlayedFiles)LastSeenHelper.GetProgress(Parentdir, fileInfo.Name);

            vd = new VideoFolderChild(Parentdir, fileInfo)
            {
                FileSize = FileExplorerCommonHelper.FileSizeConverter(fileInfo.Length),
                FileType = FileType.File
            };
            if (pdf != null)
            {
                vd.LastPlayedPoisition = pdf;
            }
            else
            {
                vd.LastPlayedPoisition = new PlayedFiles(fileInfo.Name);
            }
            IEnumerable <FileInfo> files = null;

            using (ShellObject shell = ShellObject.FromParsingName(vd.FilePath))
            {
                IShellProperty prop = shell.Properties.System.Media.Duration;
                vd.Duration = prop.FormatForDisplay(PropertyDescriptionFormat.ShortTime);
                var duration = shell.Properties.System.Media.Duration;
                if (duration.Value != null)
                {
                    vd.MaxiProgress = double.Parse(duration.Value.ToString());
                }

                files = FileExplorerCommonHelper.GetSubtitleFiles(directoryInfo.Parent);
            }
            vd.SubPath = FileExplorerCommonHelper.MatchSubToMedia(vd.Name, files);
            return(vd);
        }
Ejemplo n.º 4
0
        public static VideoFolder LoadParentFiles(VideoFolder ParentDir, SortType sorttype, ICollectionViewModel collectionVM)
        {
            // Dispatcher.Invoke(new Action(delegate {
            ObservableCollection <VideoFolder> children;
            List <DirectoryInfo> ParentSubDir = FileExplorerCommonHelper.GetParentSubDirectory(ParentDir.Directory, formats);

            if (ParentSubDir == null)
            {
                collectionVM.IsLoading = false; return(new VideoFolder(ParentDir, ParentDir.Directory.Extension));
            }

            children = new ObservableCollection <VideoFolder>();
            collectionVM.IsLoading = true;
            children = LoadChildrenFiles(ParentDir);
            for (int i = 0; i < ParentSubDir.Count; i++)
            {
                if (ParentSubDir[i].Name == ".movies")
                {
                    ParentSubDir.Remove(ParentSubDir[i]);
                    i -= 1;
                    continue;
                }
                VideoFolder child = LoadDirInfo(ParentDir, ParentSubDir[i]);
                children.Add(child);
            }

            if (ParentDir.OtherFiles == null || children.Count > ParentDir.OtherFiles.Count)
            {
                ParentDir.OtherFiles = new ObservableCollection <VideoFolder>();
                ParentDir.OtherFiles.AddRange(children);
                GetRootDetails(sorttype, ParentDir);
            }

            //   }));
            collectionVM.IsLoading = false;
            return(ParentDir);
        }