public static DiskItem Get(string fullName) { var result = new DiskItem(null); if (string.IsNullOrEmpty(fullName)) return result; fullName = DiskItem.Simplify(fullName); var parts = new List<string>(); while (fullName != "") { parts.Insert(0, fullName); fullName = GetPath(fullName); } foreach (var part in parts) { if ((result == null) || (!result.HasChildren)) return null; result = result.GetChildren().FirstOrDefault(child => child.FullName.Equals(part, StringComparison.InvariantCultureIgnoreCase)); } return result; }
public bool Equals(DiskItem item) => FullName == item.FullName;
public bool IsChildOf(DiskItem item) => IsChildOf(item.FullName);