Ejemplo n.º 1
0
        public static bool ValidateAsComposite <T>(this T installer, ICompositeInstaller <T> parent1, ICompositeInstaller <T> parent2)
            where T : IInstaller
        {
            var compositeInstaller = installer as ICompositeInstaller <T>;

            if (compositeInstaller == null)
            {
                return(true);
            }

            if (compositeInstaller == parent1 ||
                compositeInstaller == parent2)
            {
                return(false);
            }

            var leafInstallers = compositeInstaller.LeafInstallers;

            for (int i = 0; i < leafInstallers.Count; ++i)
            {
                var  leafInstaller = leafInstallers[i];
                bool leafResult    = leafInstaller.ValidateAsComposite(parent1, parent2, compositeInstaller);
                if (!leafResult)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static bool ValidateLeafInstallers <T>(this ICompositeInstaller <T> compositeInstaller)
            where T : IInstaller
        {
            var leafInstallers = compositeInstaller.LeafInstallers;

            for (int i = 0; i < leafInstallers.Count; ++i)
            {
                var  leafInstaller = leafInstallers[i];
                bool leafResult    = leafInstaller.ValidateAsComposite(compositeInstaller);
                if (!leafResult)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static bool ValidateAsComposite <T>(this T installer, ICompositeInstaller <T> parent1, ICompositeInstaller <T> parent2, ICompositeInstaller <T> parent3, ICompositeInstaller <T> parent4)
            where T : IInstaller
        {
            var compositeInstaller = installer as ICompositeInstaller <T>;

            if (compositeInstaller == null)
            {
                return(true);
            }

            if (compositeInstaller == parent1 ||
                compositeInstaller == parent2 ||
                compositeInstaller == parent3 ||
                compositeInstaller == parent4)
            {
                return(false);
            }

            var childParentInstallers = new List <ICompositeInstaller <T> >(8)
            {
                parent1,
                parent2,
                parent3,
                parent4,
                compositeInstaller,
            };

            var leafInstallers = compositeInstaller.LeafInstallers;

            for (int i = 0; i < leafInstallers.Count; ++i)
            {
                var  leafInstaller = leafInstallers[i];
                bool leafResult    = leafInstaller.ValidateAsCompositeSavedAlloc(childParentInstallers);
                if (!leafResult)
                {
                    return(false);
                }
            }

            return(true);
        }