Пример #1
0
        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());
        }
Пример #2
0
        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());
        }