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; } }
/// <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); }
public RegistrySystemHiveDirectory(ISystemEntry parent, string name) : base(parent, name) { }
public TerminalSystemEntry(ISystemEntry parent, string name) : base(parent, name) { }
public FileSystemEntry(ISystemEntry parent, string name, string path) : base(parent, name) { this.Initialize(parent, name, path, () => IO::Directory.Exists(this.FileSystemPath.FullPath)); }
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; }
public bool Equals(ISystemEntry entry) { return this.Path.Equals(entry); }
public override IEnumerable<ISystemEntry> GetRootEntries(ISystemEntry parent) { return Seq.Make(new FileSystemDriveDirectory(parent, "Drives")); }
public FileSystemDriveDirectory(ISystemEntry parent, string name) : base(parent, name) { }
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) { }
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) { }
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; }
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; }
public ProcessSystemEntry(ISystemEntry parent, string name, Process proc) : base(parent, name) { this.ProcessId = proc.Id; this.Initialize(); }
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); }