Exemplo n.º 1
0
        private static string[] GetDirectoriesIncludingRoot(
            IStorageService oStorage,
            string sPath,
            bool bIncludeSubDirs,
            List <string> selectedSubDirs = null)
        {
            List <string> Dirs = new List <string>();

            if (!bIncludeSubDirs || selectedSubDirs == null || selectedSubDirs.Count == 0)
            {
                // Root directory is always copied
                Dirs.Add(sPath);
            }

            if (bIncludeSubDirs)
            {
                // Query for subdirs
                Dirs.AddRange(oStorage.QuerySubDirs(sPath, true, DirectoryView.Tree));

                if (selectedSubDirs != null && selectedSubDirs.Count > 0)
                {
                    string[] foundFirs = SetUtil <string> .GetIntersection(Dirs, selectedSubDirs);

                    Dirs.Clear();

                    Dirs.AddRange(foundFirs);
                }
            }

            return(Dirs.ToArray());
        }
Exemplo n.º 2
0
        public void superSetsOfSingleElement()
        {
            HashSet <HashSet <int> > expected = new HashSet <HashSet <int> >();

            expected.Add(setWithElements());
            expected.Add(setWithElements(1));
            setEquals(expected, SetUtil.superSets(setWithElements(1)));
        }
Exemplo n.º 3
0
        public static bool MustHaveOneOfRequiredRoles(
            string[] PresentRoles,
            string[] RequiredRoles)
        {
            if (RequiredRoles.Length > 0)
            {
                return(SetUtil <string> .GetIntersection(
                           PresentRoles,
                           RequiredRoles).Length > 0);
            }

            return(false);
        }
Exemplo n.º 4
0
        public static bool HasOneOfRequiredRoles(
            string[] PresentRoles,
            string[] RequiredRoles)
        {
            if (RequiredRoles.Length == 0)
            {
                // No roles required - ok
                return(true);
            }

            return(SetUtil <string> .GetIntersection(
                       PresentRoles,
                       RequiredRoles).Length > 0);
        }
Exemplo n.º 5
0
        public void superSetsOfBiggerSet()
        {
            HashSet <HashSet <int> > expected = new HashSet <HashSet <int> >();

            expected.Add(setWithElements());
            expected.Add(setWithElements(1));
            expected.Add(setWithElements(2));
            expected.Add(setWithElements(3));
            expected.Add(setWithElements(1, 2));
            expected.Add(setWithElements(1, 3));
            expected.Add(setWithElements(2, 3));
            expected.Add(setWithElements(1, 2, 3));

            setEquals(expected, SetUtil.superSets(setWithElements(1, 2, 3)));
        }
Exemplo n.º 6
0
        public EntityTypeInfo(Type oType)
        {
            TheType = oType;

            OwnerParent = GetOwnerParent(TheType);

            AllDirectParents   = GetDirectParents(TheType);
            AggregatedChildren = GetAggregatedChildren(TheType);
            OwnedChildren      = GetOwnedChildrenLists(TheType);
            LinkedChildren     = GetLinkedChildrenLists(TheType);

            AllChildren = (EntityChildrenListInfo[])ArrayBuilder.ChangeArrayType(
                SetUtil <EntityChildrenListInfo> .GetUnion(OwnedChildren, LinkedChildren),
                typeof(EntityChildrenListInfo));

            Parameters = GetParameters(TheType, AggregatedChildren);

            UniqueParentLinks = GetUniqueParentLinks(TheType);

            ObsoleteMembers = GetObsoleteMembers(TheType);
        }
Exemplo n.º 7
0
 public void superSetsOfEmptySet()
 {
     setEquals(new HashSet <HashSet <int> >(), SetUtil.superSets(new HashSet <int>()));
 }