示例#1
0
        public override void LoadDirectory(string path)
        {
            Items.Clear();
            DirectoryInfo di = new DirectoryInfo(path);

            FileSystemInfo[] infos = di.GetFileSystemInfos();
            int addUp = Convert.ToInt32(!PathExt.IsDriveRoot(path));

            if (addUp == 1)
            {
                Items.Add(new MoveUpObject());
            }
            foreach (FileSystemInfo info in infos)
            {
                if ((info.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)//OPTIONS: Show hidden files
                {
                    Items.Add(new WindowsFile(info));
                }
            }

            CurrentPlace = new WindowsFile(di);

            //check if drive has changed
            if (Root == null || Path.GetPathRoot(FullPath) != Root.Path)
            {
                Root = new WindowsDrive(DriveLetter);
            }
        }
示例#2
0
        public override IEnumerable <IDirectoryViewItem> GetDirectoryContent(string path)
        {
            DirectoryInfo di = new DirectoryInfo(path);

            FileSystemInfo[] infos = di.GetFileSystemInfos();

            int lengthWithoutHidden = infos.Count(inf => (inf.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden);
            int addUp = Convert.ToInt32(!PathExt.IsDriveRoot(path));

            IDirectoryViewItem[] adapters = new IDirectoryViewItem[lengthWithoutHidden + addUp];

            if (addUp == 1)
            {
                adapters[0] = new MoveUpObject();
            }

            int i = addUp;

            foreach (FileSystemInfo info in infos)
            {
                if ((info.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
                {
                    adapters[i] = new WindowsFile(info);
                    i++;
                }
            }

            CurrentPlace = new WindowsFile(di);
            return(adapters.Cast <IDirectoryViewItem>());
        }
示例#3
0
 public void Upload(WindowsFile file)
 {
     connection.UploadFile(file.FullName, file.Name);
 }
示例#4
0
        public override IEnumerable<IDirectoryViewItem> GetDirectoryContent(string path)
        {
            DirectoryInfo di = new DirectoryInfo(path);
            FileSystemInfo[] infos = di.GetFileSystemInfos();

            int lengthWithoutHidden = infos.Count(inf => (inf.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden);
            int addUp = Convert.ToInt32(!PathExt.IsDriveRoot(path));

            IDirectoryViewItem[] adapters = new IDirectoryViewItem[lengthWithoutHidden + addUp];

            if (addUp == 1)
                adapters[0] = new MoveUpObject();

            int i = addUp;
            foreach (FileSystemInfo info in infos)
            {
                if ((info.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
                {
                    adapters[i] = new WindowsFile(info);
                    i++;
                }
            }

            CurrentPlace = new WindowsFile(di);
            return adapters.Cast<IDirectoryViewItem>();
        }
示例#5
0
        public override void LoadDirectory(string path)
        {
            Items.Clear();
            DirectoryInfo di = new DirectoryInfo(path);
            FileSystemInfo[] infos = di.GetFileSystemInfos();
            int addUp = Convert.ToInt32(!PathExt.IsDriveRoot(path));
            if (addUp == 1)
                Items.Add(new MoveUpObject());
            foreach (FileSystemInfo info in infos)
                if ((info.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)//OPTIONS: Show hidden files
                    Items.Add(new WindowsFile(info));

            CurrentPlace = new WindowsFile(di);

            //check if drive has changed
            if (Root == null || Path.GetPathRoot(FullPath) != Root.Path)
                Root = new WindowsDrive(DriveLetter);
        }