/// <summary>Constructs the <see cref="FileItemBase"/> without any file info.</summary> /// /// <param name="name">The name of the item.</param> /// <param name="type">The type of the item.</param> /// <param name="flags">The flags for the item (except <see cref="FileAttributes"/>).</param> private protected FileItemBase(string name, FileItemType type, FileItemFlags flags) { if (flags != FileItemFlags.None) { this.flags |= (flags & FileItemFlags.TypeFlagsMask); } if (type == FileItemType.Volume) { name = PathUtils.AddDirectorySeparator(name); } Name = name; Type = type; state |= FileItemStates.Exists; }
/// <summary>Constructs the <see cref="RootItem"/> with a <see cref="DirectoryInfo"/>.</summary> /// /// <param name="scanning">The service used for scanning the file tree.</param> /// <param name="info">The file information.</param> /// <param name="isAbsoluteRoot">True if there is no <see cref="RootItem"/> containing this.</param> public RootItem(ScanningService scanning, DirectoryInfo info, bool isAbsoluteRoot) : base(info, GetType(info.FullName), GetFlags(isAbsoluteRoot)) { this.scanning = scanning; if (isAbsoluteRoot) { scanning.SpaceChanged += UpdateSpace; } RootPath = Path.GetFullPath(info.FullName); if (Type == FileItemType.Volume) { RootPath = PathUtils.AddDirectorySeparator(RootPath); } SetupRoot(); }