示例#1
0
        public override bool TryParsePath(ISystemEntry root, string path, out ISystemEntry entry)
        {
            var filePath = new FilePath(path);
            entry = null;
            if (!filePath.IsValid) {
                return false;
            }

            // カレントディレクトリをベースに絶対パス変換
            if (filePath.IsRelative) {
                filePath = new FilePath(Environment.CurrentDirectory).Resolve(filePath);
            }

            if (!filePath.IsValid) {
                return false;
            }

            if (filePath.Fragments.Count == 0) {
                entry = new FileSystemDriveDirectory(root, "Drives");
                return true;
            } else {
                var drives = new FileSystemDriveDirectory(root, "Drives");
                var drive = new FileSystemDrive(drives, filePath.Fragments[0].ToUpper(), filePath.Fragments[0].ToUpper()[0]);

                IFileSystemEntry parent = drive;
                IFileSystemEntry subEntry = drive;
                foreach(var subPath in filePath.FragmentPaths.Skip(1)) {
                    subEntry = new FileSystemEntry(parent, subPath.FileName, subPath.FullPath);
                    parent = subEntry;
                }
                entry = subEntry;

                return true;
            }
        }
示例#2
0
 /// <summary>
 /// コンストラクタ。parentがnullの場合はルートフォルダになります。
 /// </summary>
 /// <param name="parent">親のISystemDirectory</param>
 /// <param name="id">同階層内で一意な識別子</param>
 public SystemEntry(ISystemEntry parent, string name)
 {
     if(name == null){
         throw new ArgumentNullException("name");
     }
     this.Parent = parent;
     this.Name = name;
     this.DisplayName = name;
 }
 public TimelineSystemDirectory(ISystemEntry parent, string name, Account account, Func<CancellationToken, Timeline> timeline)
     : base(parent, name)
 {
     this._SeedTimeline = timeline;
 }
 public TimelineSystemDirectory(ISystemEntry parent, string name, Func<CancellationToken, Timeline> timeline)
     : base(parent, name)
 {
     this._SeedTimeline = timeline;
     this._StatusReadOnlyList = new WrappedReadOnlyObservableList<StatusSystemEntry>(this._StatusList);
 }
示例#5
0
 public RegistrySystemHiveDirectory(ISystemEntry parent, string name)
     : base(parent, name)
 {
 }
示例#6
0
 public TerminalSystemEntry(ISystemEntry parent, string name)
     : base(parent, name)
 {
 }
示例#7
0
 public FileSystemEntry(ISystemEntry parent, string name, string path)
     : base(parent, name)
 {
     this.Initialize(parent, name, path, () => IO::Directory.Exists(this.FileSystemPath.FullPath));
 }
示例#8
0
 public ProcessSystemEntry(ISystemEntry parent, string name, int pid)
     : base(parent, name)
 {
     this.ProcessId = pid;
     this.Initialize();
 }
 public ProcessSystemDirectory(ISystemEntry parent, string name, string machineName)
     : this(parent, machineName, false)
 {
 }
 public EnvironmentVariableSystemEntry(ISystemEntry parent, string name, EnvironmentVariableTarget target, string varName)
     : base(parent, name)
 {
     this.EnvironmentVariableTarget = target;
     this.VariableName = varName;
 }
示例#11
0
 public bool Equals(ISystemEntry entry)
 {
     return this.Path.Equals(entry);
 }
示例#12
0
 public override IEnumerable<ISystemEntry> GetRootEntries(ISystemEntry parent)
 {
     return Seq.Make(new FileSystemDriveDirectory(parent, "Drives"));
 }
 public FileSystemDriveDirectory(ISystemEntry parent, string name)
     : base(parent, name)
 {
 }
示例#14
0
 internal FileSystemEntry(ISystemEntry parent, string name, string path, bool isDirectory)
     : base(parent, name)
 {
     this.Initialize(parent, name, path, () => isDirectory);
 }
 public ProcessSystemDirectory(ISystemEntry parent, string name)
     : this(parent, name, null, false)
 {
 }
示例#16
0
 public override IEnumerable<ISystemEntry> GetRootEntries(ISystemEntry parent)
 {
     return this.Providers.SelectMany(p => p.GetRootEntries(parent));
 }
 public ProcessSystemDirectory(ISystemEntry parent, string name, bool enumAllProcesses)
     : this(parent, name, null, enumAllProcesses)
 {
 }
示例#18
0
 public override bool TryParsePath(ISystemEntry root, string path, out ISystemEntry entry)
 {
     entry = null;
     foreach(var provider in this.Providers) {
         if(provider.TryParsePath(root, path, out entry)) {
             return true;
         }
     }
     return false;
 }
 public ProcessSystemDirectory(ISystemEntry parent, string name, string machineName, bool enumAllProcesses)
     : base(parent, name)
 {
     this.MachineName = machineName;
     this.EnumAllProcesses = enumAllProcesses;
 }
示例#20
0
 public bool TryParsePath(ISystemEntry root, string path, out ISystemEntry entry, out ISystemProvider provider)
 {
     entry = null;
     provider = null;
     foreach(var pro in this.Providers) {
         if(pro.TryParsePath(root, path, out entry)) {
             provider = pro;
             return true;
         }
     }
     return false;
 }
示例#21
0
 public ProcessSystemEntry(ISystemEntry parent, string name, Process proc)
     : base(parent, name)
 {
     this.ProcessId = proc.Id;
     this.Initialize();
 }
示例#22
0
 private void Initialize(ISystemEntry parent, string name, string path, Func<bool> isDirectory)
 {
     this.FileSystemPath = new FilePath(path, FilePathKind.Absolute);
     this._DisplayName = new Lazy<string>(() => this.FileSystemPath.FileName);
     this._IsDirectory = new Lazy<bool>(isDirectory);
 }