Example #1
0
        public override bool AfterInstall(Package package, RhinoInfo[] RhinoList, InstallerUser InstallAsUser)
        {
            string packagePath = package.PackagePath;

            m_user = InstallAsUser;
            bool bSuccess = true;

            // find newest plug-in compatible with each Rhino on the system, and then register it.
            ReportProgress("PluginPackage.Install starting for package at '" + packagePath + "'", LogLevel.Info);

            foreach (RhinoInfo rhino in RhinoList)
            {
                PluginInfo plugin_to_install = null;
                foreach (PackageFileKey plugin_key in ListRhpFiles(package))
                {
                    PluginInfo plugin;
                    if (!m_plugin_lookup.TryGetValue(plugin_key, out plugin))
                    {
                        // Rather than throwing an exception, log this warning, and continue on.
                        // fixes http://dev.mcneel.com/bugtrack/?q=105121
                        ReportProgress("m_plugin_list doesn't contain PluginInfo for " + plugin_key.Key, LogLevel.Warning);
                        continue;
                    }

                    // Set the path to the RHP file based on
                    // where the package says it currently lives
                    plugin.PluginPath = package.GetFullPath(plugin_key);

                    if (plugin.IsCompatible(rhino))
                    {
                        if (plugin.CompareTo(plugin_to_install) > 0)
                        {
                            plugin_to_install = plugin;
                        }
                    }
                }

                if (plugin_to_install == null)
                {
                    continue;
                }

                if (!RegisterPlugin(plugin_to_install, rhino))
                {
                    bSuccess = false;
                }
            }

            ReportProgress("PluginPackage.Install ending", LogLevel.Info);

            return(bSuccess);
        }
Example #2
0
        public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
        {
            // Delete the entire Localization folder if it exists in the Roaming profile.
            // It will be replaced by a Template Files folder, and most localization stuff will move to the local profile.
            //try
            //{
            //  string oldPath = Path.Combine(InstallerEngine.CurrentUserRoamingProfileRoot, @"Localization");
            //  if (Directory.Exists(oldPath))
            //  {
            //    Directory.Delete(oldPath, true);
            //  }
            //}
            //finally
            //{
            //}

            return(true);
        }
        public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
        {
            // Delete the entire Localization folder if it exists in the Roaming profile.
              // It will be replaced by a Template Files folder, and most localization stuff will move to the local profile.
              //try
              //{
              //  string oldPath = Path.Combine(InstallerEngine.CurrentUserRoamingProfileRoot, @"Localization");
              //  if (Directory.Exists(oldPath))
              //  {
              //    Directory.Delete(oldPath, true);
              //  }
              //}
              //finally
              //{
              //}

              return true;
        }
 public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
 {
     string oldDir = Path.Combine(InstallerEngine.CurrentUserRoamingProfileRoot, @"Localization\HelpMedia");
       if (Directory.Exists(oldDir))
       {
     try
     {
       Directory.Delete(oldDir, true);
     }
     // ReSharper disable EmptyGeneralCatchClause
     catch
     // ReSharper restore EmptyGeneralCatchClause
     {
       // We don't care if it fails; it'll clean up more next time.
     }
       }
       return true;
 }
Example #5
0
        public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
        {
            string oldDir = Path.Combine(InstallerEngine.CurrentUserRoamingProfileRoot, string.Format(@"Localization\{0}\Help", m_manifest.Locale.TwoLetterISOLanguageName));

            if (Directory.Exists(oldDir))
            {
                try
                {
                    Directory.Delete(oldDir, true);
                }
// ReSharper disable EmptyGeneralCatchClause
                catch
// ReSharper restore EmptyGeneralCatchClause
                {
                    // We don't care if it fails; it'll clean up more next time.
                }
            }
            return(true);
        }
 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;
 }
Example #7
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);
        }
Example #8
0
        public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
        {
            if (Directory.Exists(package.DestinationFolder))
            {
                string[] files = Directory.GetFiles(package.DestinationFolder, "*.tb");
                foreach (string file in files)
                {
                    try
                    {
                        File.Delete(file);
                    }
                    catch (System.UnauthorizedAccessException)
                    {
                        // Fixes http://dev.mcneel.com/bugtrack/?q=68713
                        // Unable to delete .tb file; we'll try again next time.
                    }
                }
            }

            return(true);
        }
Example #9
0
        public override bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
        {
            if (Directory.Exists(package.DestinationFolder))
              {
            string[] files = Directory.GetFiles(package.DestinationFolder, "*.tb");
            foreach (string file in files)
            {
              try
              {
            File.Delete(file);
              }
              catch (System.UnauthorizedAccessException)
              {
            // Fixes http://dev.mcneel.com/bugtrack/?q=68713
            // Unable to delete .tb file; we'll try again next time.
              }
            }
              }

              return true;
        }
Example #10
0
 /// <summary>
 /// Called by the InstallerEngine to finalize the installation 
 /// </summary>
 /// <returns></returns>
 public virtual bool BeforeInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
 {
     return true;
 }
Example #11
0
        public string PackageFolder;         // = null;


        public void SetOptions(string[] args)
        {
            CommandLineParser cmdline = new CommandLineParser(args);

            if (cmdline.GetBoolValue("ADMIN"))
            {
                User = InstallerUser.AllUsers;
            }

            SilentInstall           = cmdline.GetBoolValue("SILENT");
            LogFilePath             = cmdline.GetStringValue("LOGFILE");
            InstallPackagesForRhino = cmdline.GetBoolValue("INSTALLPACKAGESFORRHINO");
            EnableErrorReporting    = !cmdline.GetBoolValue("NOERRORREPORTS");

            RhinoSdkVersionNumber   = cmdline.GetIntValue("RHINOSDKVERSIONNUMBER");
            InspectRhinoPath        = cmdline.GetStringValue("INSPECTRHINO");
            InspectPluginPath       = cmdline.GetStringValue("INSPECTPLUGIN");
            PackageFolder           = cmdline.GetStringValue("PACKAGEFOLDER");
            InspectWorkingDirectory = cmdline.GetStringValue("INSPECTWORKINGDIR");
            try
            {
                string sLogLevel = cmdline.GetStringValue("LOGLEVEL");
                if (!string.IsNullOrEmpty(sLogLevel))
                {
                    sLogLevel = sLogLevel.ToLowerInvariant();
                    sLogLevel = sLogLevel[0].ToString().ToUpperInvariant() + sLogLevel.Substring(1);
                    LogLevel  = (LogLevel)Enum.Parse(LogLevel.GetType(), sLogLevel);
                }
            }
            catch (ArgumentException)
            {
                LogLevel = LogLevel.Debug;
            }


            if (cmdline.ContainsKey("LOCALE"))
            {
                try
                {
                    // see if an integer value was passed in as Locale argument
                    int nLocale = cmdline.GetIntValue("LOCALE", -1);
                    if (nLocale != -1)
                    {
                        Locale = new CultureInfo(nLocale);
                    }
                    else
                    {
                        Locale = new CultureInfo(cmdline.GetStringValue("LOCALE"));
                    }
                }
                catch (System.ArgumentException)
                {
                    Engine.InstallerEngine.ReportProgress(LogLevel.Error, "Options::SetOptions() encountered invalid Locale: " + cmdline["LOCALE"]);
                }
            }

            foreach (string arg in args)
            {
                if (arg.EndsWith(".rhi", StringComparison.OrdinalIgnoreCase))
                {
                    InstallerFile = arg;
                }
            }

            string logfilename;

            if (InstallPackagesForRhino)
            {
                logfilename = "InstallPackagesForRhino";
            }
            else if (!string.IsNullOrEmpty(InspectRhinoPath))
            {
                logfilename = "InspectRhino";
            }
            else if (!string.IsNullOrEmpty(InspectPluginPath))
            {
                logfilename = "InspectPlugin";
            }
            else
            {
                logfilename = Path.GetFileNameWithoutExtension(InstallerFile);
            }

            logfilename += " (" + DateTime.Now.ToString("yyyyMMdd-HHmmss", System.Globalization.CultureInfo.InvariantCulture) + ").log";
            if (String.IsNullOrEmpty(LogFilePath))
            {
                if (User == InstallerUser.AllUsers)
                {
                    LogFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"McNeel\Rhinoceros\5.0\logs\" + logfilename);
                }
                else if (User == InstallerUser.CurrentUser)
                {
                    LogFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"McNeel\Rhinoceros\5.0\logs\" + logfilename);
                }
            }
        }
Example #12
0
        public override bool AfterInstall(Package package, RhinoInfo[] RhinoList, InstallerUser InstallAsUser)
        {
            string packagePath = package.PackagePath;
              m_user = InstallAsUser;
              bool bSuccess = true;

              // find newest plug-in compatible with each Rhino on the system, and then register it.
              ReportProgress("PluginPackage.Install starting for package at '" + packagePath + "'", LogLevel.Info);

              foreach (RhinoInfo rhino in RhinoList)
              {
            PluginInfo plugin_to_install = null;
            foreach (PackageFileKey plugin_key in ListRhpFiles(package))
            {
              PluginInfo plugin;
              if (!m_plugin_lookup.TryGetValue(plugin_key, out plugin))
              {
            // Rather than throwing an exception, log this warning, and continue on.
            // fixes http://dev.mcneel.com/bugtrack/?q=105121
            ReportProgress("m_plugin_list doesn't contain PluginInfo for " + plugin_key.Key, LogLevel.Warning);
            continue;
              }

              // Set the path to the RHP file based on
              // where the package says it currently lives
              plugin.PluginPath = package.GetFullPath(plugin_key);

              if (plugin.IsCompatible(rhino))
              {
            if (plugin.CompareTo(plugin_to_install) > 0)
              plugin_to_install = plugin;
              }
            }

            if (plugin_to_install == null)
              continue;

            if (!RegisterPlugin(plugin_to_install, rhino))
              bSuccess = false;
              }

              ReportProgress("PluginPackage.Install ending", LogLevel.Info);

              return bSuccess;
        }
Example #13
0
        public void SetOptions(string[] args)
        {
            CommandLineParser cmdline = new CommandLineParser(args);

              if (cmdline.GetBoolValue("ADMIN"))
            User = InstallerUser.AllUsers;

              SilentInstall = cmdline.GetBoolValue("SILENT");
              LogFilePath = cmdline.GetStringValue("LOGFILE");
              InstallPackagesForRhino = cmdline.GetBoolValue("INSTALLPACKAGESFORRHINO");
              EnableErrorReporting = !cmdline.GetBoolValue("NOERRORREPORTS");

              RhinoSdkVersionNumber = cmdline.GetIntValue("RHINOSDKVERSIONNUMBER");
              InspectRhinoPath = cmdline.GetStringValue("INSPECTRHINO");
              InspectPluginPath = cmdline.GetStringValue("INSPECTPLUGIN");
              PackageFolder = cmdline.GetStringValue("PACKAGEFOLDER");
              InspectWorkingDirectory = cmdline.GetStringValue("INSPECTWORKINGDIR");
              try
              {
            string sLogLevel = cmdline.GetStringValue("LOGLEVEL");
            if (!string.IsNullOrEmpty(sLogLevel))
            {
              sLogLevel = sLogLevel.ToLowerInvariant();
              sLogLevel = sLogLevel[0].ToString().ToUpperInvariant() + sLogLevel.Substring(1);
              LogLevel = (LogLevel)Enum.Parse(LogLevel.GetType(), sLogLevel);
            }
              }
              catch (ArgumentException)
              {
            LogLevel = LogLevel.Debug;
              }

              if (cmdline.ContainsKey("LOCALE"))
              {
            try
            {
              // see if an integer value was passed in as Locale argument
              int nLocale = cmdline.GetIntValue("LOCALE", -1);
              if (nLocale != -1)
            Locale = new CultureInfo(nLocale);
              else
            Locale = new CultureInfo(cmdline.GetStringValue("LOCALE"));
            }
            catch (System.ArgumentException)
            {
              Engine.InstallerEngine.ReportProgress(LogLevel.Error, "Options::SetOptions() encountered invalid Locale: " + cmdline["LOCALE"]);
            }
              }

              foreach (string arg in args)
              {
            if (arg.EndsWith(".rhi", StringComparison.OrdinalIgnoreCase))
              InstallerFile = arg;
              }

              string logfilename;
              if (InstallPackagesForRhino)
            logfilename = "InstallPackagesForRhino";
              else if (!string.IsNullOrEmpty(InspectRhinoPath))
            logfilename = "InspectRhino";
              else if (!string.IsNullOrEmpty(InspectPluginPath))
            logfilename = "InspectPlugin";
              else
            logfilename = Path.GetFileNameWithoutExtension(InstallerFile);

              logfilename += " (" + DateTime.Now.ToString("yyyyMMdd-HHmmss", System.Globalization.CultureInfo.InvariantCulture) + ").log";
              if (String.IsNullOrEmpty(LogFilePath))
              {
            if (User == InstallerUser.AllUsers)
              LogFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"McNeel\Rhinoceros\5.0\logs\" + logfilename);
            else if (User == InstallerUser.CurrentUser)
              LogFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"McNeel\Rhinoceros\5.0\logs\" + logfilename);
              }
        }
Example #14
0
 /// <summary>
 /// Called by the InstallerEngine to finalize the installation
 /// </summary>
 /// <returns></returns>
 public virtual bool AfterInstall(Package package, RhinoInfo[] RhinoList, InstallerUser installAsUser)
 {
     return(true);
 }