public override RMA.RhiExec.Engine.PackageInstallState GetInstallState(Package package)
        {
            PackageManifest manifestInstalled = new PackageManifest(m_content_type);

            if (!LoadManifest(this.InstallFolder(InstallerEngine.InstallRoot(this.InstallRoot)), m_content_type, out manifestInstalled))
            {
                return(PackageInstallState.NotInstalled);
            }

            PackageManifest manifestNew = new PackageManifest(m_content_type);

            if (!LoadManifest(PackagePath, m_content_type, out manifestNew))
            {
                throw new ManifestFileNotFoundException(PackagePath);
            }

            if (manifestInstalled.VersionNumber > manifestNew.VersionNumber)
            {
                return(PackageInstallState.NewerVersionInstalledCurrentUser);
            }
            else if (manifestInstalled.VersionNumber == manifestNew.VersionNumber)
            {
                return(PackageInstallState.SameVersionInstalledCurrentUser);
            }
            else if (manifestInstalled.VersionNumber < manifestNew.VersionNumber)
            {
                return(PackageInstallState.OlderVersionInstalledCurrentUser);
            }
            else
            {
                return(PackageInstallState.NotInstalled);
            }
        }
        public override RMA.RhiExec.Engine.PackageInstallState GetInstallState(Package package)
        {
            // See what version this package contains.
            PythonPluginInfo ppi = new PythonPluginInfo();

            if (!ppi.Initialize(package))
            {
                throw new PackageNotCompatibleException(package.PackagePath);
            }

            // Is this installed for All Users?
            ReportProgress("Getting InstallState for " + this.PackagePath, LogLevel.Debug);

            // Is plug-in installed for all users?
            ReportProgress("Checking install state for current user", LogLevel.Debug);
            string folder = InstallerEngine.InstallRoot(this.InstallRoot);

            // AllUsersInstallFolder returns ...\plug-in name\version
            // we want to look in just ...\plug-in name
            folder = Path.GetDirectoryName(folder);

            Version InstalledVersion = GetNewestVersionOfInstalledPackage(folder);

            return(CompareVersions(this.PackageVersion, InstalledVersion));
        }
Example #3
0
        public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
        {
            // Delete tutorials from roaming profile, if they exist.
            string RoamingProfileTutorialFolder = InstallerEngine.InstallRoot(PackageInstallRoot.CurrentUserRoamingProfile);

            RoamingProfileTutorialFolder = Path.Combine(RoamingProfileTutorialFolder, "Tutorials");
            if (Directory.Exists(RoamingProfileTutorialFolder))
            {
                try
                {
                    Directory.Delete(RoamingProfileTutorialFolder, true);
                }
// ReSharper disable EmptyGeneralCatchClause
                catch
// ReSharper restore EmptyGeneralCatchClause
                {
                    // We don't care if the delete doesn't succeed.
                }
            }
            return(true);
        }