public static List <Guid> GetGroupGuids(this CataloguePath path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } var isIndirectChildOfGroup = path.Reverse().Skip(1).TakeWhile(x => !(x is IGroup)).Any(x => x is IEntry); return(isIndirectChildOfGroup ? new List <Guid>(0) : path.Reverse() .SkipWhile(x => !(x is IGroup)) .Reverse() .ToList() .GetEntryPath() .Select(x => x.Id.Value) .ToList()); }
public static string GetGroupId(this CataloguePath path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } var isIndirectChildOfGroup = path.Reverse().Skip(1).TakeWhile(x => !(x is IGroup)).Any(x => x is IEntry); return(isIndirectChildOfGroup ? null : path.Reverse() .SkipWhile(x => !(x is IGroup)) .Reverse() .ToList() .GetEntryPath() .Select(x => x.Id.RawValue) .ToList() .CombineLinkedId()); }