Example #1
0
        public override bool GetFileInfo(string path, out FsFileInfo fileInfo)
        {
            String convertedPath = ConvertMFPathToPath(path);
            bool   isDirectory   = Directory.Exists(convertedPath);
            bool   isFile        = File.Exists(convertedPath);

            if (!isDirectory && !isFile)
            {
                fileInfo.Attributes     = 0;
                fileInfo.CreationTime   = 0;
                fileInfo.LastAccessTime = 0;
                fileInfo.LastWriteTime  = 0;
                fileInfo.Size           = 0;
                fileInfo.FileName       = "";

                return(false);
            }

            FileSystemInfo info = (isDirectory) ? (FileSystemInfo) new DirectoryInfo(convertedPath) : (FileSystemInfo) new FileInfo(convertedPath);

            fileInfo.Attributes     = ResolveAttributes(info.Attributes);
            fileInfo.CreationTime   = info.CreationTime.ToFileTime();
            fileInfo.LastAccessTime = info.LastAccessTime.ToFileTime();
            fileInfo.LastWriteTime  = info.LastWriteTime.ToFileTime();
            fileInfo.Size           = (isDirectory) ? 0 : ((FileInfo)info).Length;
            fileInfo.FileName       = null; // no need to set the filename, as the caller already have it.

            return(true);
        }
Example #2
0
            public bool GetNext(out FsFileInfo fileInfo)
            {
                if ((_directories != null) && (_dirIndex < _directories.Length))
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(_directories[_dirIndex]);

                    fileInfo.Attributes     = WindowsFileSystem.ResolveAttributes(dirInfo.Attributes);
                    fileInfo.CreationTime   = dirInfo.CreationTime.ToFileTime();
                    fileInfo.LastAccessTime = dirInfo.LastAccessTime.ToFileTime();
                    fileInfo.LastWriteTime  = dirInfo.LastWriteTime.ToFileTime();
                    fileInfo.Size           = 0;
                    fileInfo.FileName       = dirInfo.Name;

                    _dirIndex++;

                    return(true);
                }

                if ((_files != null) && (_fileIndex < _files.Length))
                {
                    FileInfo fi = new FileInfo(_files[_fileIndex]);

                    if (fi.Name == "_vol_")
                    {
                        _fileIndex++;

                        if (_fileIndex < _files.Length)
                        {
                            fi = new FileInfo(_files[_fileIndex]);
                        }
                        else
                        {
                            fi = null;
                        }
                    }

                    if (fi != null)
                    {
                        fileInfo.Attributes     = WindowsFileSystem.ResolveAttributes(fi.Attributes);
                        fileInfo.CreationTime   = fi.CreationTime.ToFileTime();
                        fileInfo.LastAccessTime = fi.LastAccessTime.ToFileTime();
                        fileInfo.LastWriteTime  = fi.LastWriteTime.ToFileTime();
                        fileInfo.Size           = fi.Length;
                        fileInfo.FileName       = fi.Name;

                        _fileIndex++;

                        return(true);
                    }
                }

                fileInfo.Attributes     = 0;
                fileInfo.CreationTime   = 0;
                fileInfo.LastAccessTime = 0;
                fileInfo.LastWriteTime  = 0;
                fileInfo.Size           = 0;
                fileInfo.FileName       = "";

                return(false);
            }
Example #3
0
        int IFSDriver.GetFileInfo(uint volumeId, string path, ref FsFileInfo fileInfo, ref bool found)
        {
            try
            {
                found = GetManagedFileSystem(volumeId).GetFileInfo(path, out fileInfo);
            }
            catch (Exception e)
            {
                return(TranslateException(e));
            }

            return(0);
        }
Example #4
0
        int IFSDriver.FindNext(uint searchHandle, ref FsFileInfo fileInfo, ref bool found)
        {
            try
            {
                uint   volumeId;
                ushort emulatorHandle;

                ParseHandle(searchHandle, out volumeId, out emulatorHandle);

                found = GetManagedFileSystem(volumeId).FindNext(emulatorHandle, out fileInfo);
            }
            catch (Exception e)
            {
                return(TranslateException(e));
            }

            return(0);
        }
Example #5
0
 public virtual bool GetFileInfo(string path, out FsFileInfo fileInfo)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public virtual bool FindNext(ushort handle, out FsFileInfo fileInfo)
 {
     throw new NotImplementedException();
 }
Example #7
0
        public override bool FindNext(ushort handle, out FsFileInfo fileInfo)
        {
            SearchData search = _openedSearches[handle];

            return(search.GetNext(out fileInfo));
        }