Ejemplo n.º 1
0
        private static bool CheckForTypeCollisions(UninstallerType target, IEnumerable <UninstallerType> running)
        {
            if (target == UninstallerType.InstallShield || target == UninstallerType.WindowsFeature ||
                target == UninstallerType.SdbInst || target == UninstallerType.Unknown)
            {
                target = UninstallerType.Msiexec;
            }

            foreach (var item in running)
            {
                var x = item;
                if (x == UninstallerType.InstallShield || x == UninstallerType.WindowsFeature ||
                    x == UninstallerType.SdbInst || x == UninstallerType.Unknown)
                {
                    x = UninstallerType.Msiexec;
                }

                if (x == target)
                {
                    return(true);
                }
            }

            return(false);
        }
        private static bool CheckForTypeCollisions(UninstallerType target, IEnumerable <UninstallerType> running)
        {
            switch (target)
            {
            // Might cause collisions with Msiexec, don't run concurrently
            case UninstallerType.Msiexec:
            case UninstallerType.InstallShield:
            case UninstallerType.SdbInst:
            case UninstallerType.WindowsFeature:
            case UninstallerType.WindowsUpdate:
            case UninstallerType.Unknown:
            // Chocolatey can use app's original uninstaller, so it's essentially unknown
            case UninstallerType.Chocolatey:
            // Scripts can do many things that could interfere
            case UninstallerType.PowerShell:
                target = UninstallerType.Msiexec;
                break;

            // Can be ran concurrently
            case UninstallerType.InnoSetup:
            case UninstallerType.Steam:
            case UninstallerType.Nsis:
            case UninstallerType.StoreApp:
            case UninstallerType.SimpleDelete:
                break;

            default:
                Debug.Fail("Unhandled UninstallerType - " + target);
                goto case UninstallerType.Unknown;
            }

            foreach (var item in running)
            {
                var x = item;
                if (x == UninstallerType.InstallShield || x == UninstallerType.WindowsFeature || x == UninstallerType.SdbInst || x == UninstallerType.Unknown)
                {
                    x = UninstallerType.Msiexec;
                }

                if (x == target)
                {
                    return(true);
                }
            }

            return(false);
        }
        private static bool CheckForTypeCollisions(UninstallerType target, IEnumerable <UninstallerType> running)
        {
            switch (target)
            {
            // Might cause collisions, don't run concurrently
            case UninstallerType.InstallShield:
            case UninstallerType.SdbInst:
            case UninstallerType.WindowsFeature:
            case UninstallerType.WindowsUpdate:
            case UninstallerType.Unknown:
                target = UninstallerType.Msiexec;
                break;

            // Can be ran concurrently
            case UninstallerType.Msiexec:
            case UninstallerType.InnoSetup:
            case UninstallerType.Steam:
            case UninstallerType.Nsis:
            case UninstallerType.StoreApp:
            case UninstallerType.SimpleDelete:
                break;

            default:
                Debug.Fail("Unhandled UninstallerType - " + target);
                break;
            }

            foreach (var item in running)
            {
                var x = item;
                if (x == UninstallerType.InstallShield || x == UninstallerType.WindowsFeature || x == UninstallerType.SdbInst || x == UninstallerType.Unknown)
                {
                    x = UninstallerType.Msiexec;
                }

                if (x == target)
                {
                    return(true);
                }
            }

            return(false);
        }