Ejemplo n.º 1
0
        bool PrintDirectory(DiscUtils.DiscDirectoryInfo DirInfo, string Pattern, bool Recurse)
        {
            if (!DirInfo.Exists)
            {
                Console.WriteLine("Unknown Folder {0}", DirInfo.FullName);
                return(false);
            }

            List <DiscUtils.DiscFileSystemInfo> FolderList = new List <DiscUtils.DiscFileSystemInfo>(DirInfo.GetDirectories(Pattern));

            FolderList.AddRange(DirInfo.GetFiles(Pattern));
            FolderList.Sort((LHS, RHS) =>
            {
                return(LHS.Name.CompareTo(RHS.Name));
            });

            Console.WriteLine();
            Console.WriteLine(" Directory of {0}", DirInfo.FullName);
            Console.WriteLine();
            foreach (var Entry in FolderList)
            {
                string Date = Entry.LastWriteTime.ToString("MM/dd/yyyy");
                string Time = Entry.LastWriteTime.ToString("hh:mm tt");
                string Type = "";
                string Size = "";

                if ((Entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
                {
                    Type = "<DIR>";
                }
                else
                {
                    DiscUtils.DiscFileInfo FileInfo = (DiscUtils.DiscFileInfo)Entry;
                    Size = FileInfo.Length.ToString("0,0");
                }

                Console.WriteLine("{0}  {1} {2,8} {3,8} {4}", Date, Time, Type, Size, Entry.Name);
            }

            if (Recurse)
            {
                foreach (var Entry in FolderList)
                {
                    if ((Entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
                    {
                        if (!PrintDirectory((DiscUtils.DiscDirectoryInfo)Entry, Pattern, true))
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public NtStatus FindFiles(string fileName, out IList <FileInformation> files, DokanFileInfo info)
        {
            string[] fileList = this.isoReader.GetFiles(fileName);
            string[] dirList  = this.isoReader.GetDirectories(fileName);
            files = new List <FileInformation>();

            foreach (var file in fileList)
            {
                DiscUtils.DiscFileInfo srcFileInfo = this.isoReader.GetFileInfo(file);
                FileInformation        finfo       = new FileInformation();

                finfo.FileName       = Path.GetFileName(file);
                finfo.Attributes     = srcFileInfo.Attributes;
                finfo.CreationTime   = srcFileInfo.CreationTime;
                finfo.LastAccessTime = srcFileInfo.LastAccessTime;
                finfo.LastWriteTime  = srcFileInfo.LastWriteTime;
                finfo.Length         = srcFileInfo.Length;

                files.Add(finfo);
            }

            foreach (var dir in dirList)
            {
                DiscUtils.DiscDirectoryInfo srcDirInfo = this.isoReader.GetDirectoryInfo(dir);
                FileInformation             finfo      = new FileInformation();

                finfo.FileName       = Path.GetFileName(dir);
                finfo.Attributes     = srcDirInfo.Attributes;
                finfo.CreationTime   = srcDirInfo.CreationTime;
                finfo.LastAccessTime = srcDirInfo.LastAccessTime;
                finfo.LastWriteTime  = srcDirInfo.LastWriteTime;

                files.Add(finfo);
            }

            return(DokanResult.Success);
        }