Ejemplo n.º 1
0
        public static InstallerPhase InspectRhinoAndWriteXml(string PathToRhino, string OutputDirectory)
        {
            Logger.Log(LogLevel.Debug, "InspectRhino\tBeginning inspection of '" + PathToRhino + "'");

            // This should only be called from a separate process.
            if (string.IsNullOrEmpty(OutputDirectory))
            {
                return(InstallerPhase.InspctWrkDirMissing);
            }

            RhinoInfo info = new RhinoInfo();

            info.Inspect(PathToRhino);
            if (!info.IsValid())
            {
                return(InstallerPhase.InspctFailed);
            }

            string xmlname = info.GetXmlFileName();

            Directory.CreateDirectory(OutputDirectory);
            string path = Path.Combine(OutputDirectory, xmlname);

            info.WriteXml(path);
            return(InstallerPhase.Success);
        }
Ejemplo n.º 2
0
        public override bool IsCompatible(RhinoInfo rhino)
        {
            if (rhino.RhinoVersion.Major == 5)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        private bool RegisterPlugin(PluginInfo plugin_info, RhinoInfo rhino_info)
        {
            ReportProgress("Registering plugin: " + plugin_info.PluginPath, LogLevel.Info);
            RegistryKey PluginsRegKey = null;

            if (m_user == InstallerUser.AllUsers)
            {
                ReportProgress("Registering for all users", LogLevel.Debug);
                PluginsRegKey = rhino_info.OpenAllUsersPluginKey();
            }
            else if (m_user == InstallerUser.CurrentUser)
            {
                ReportProgress("Registering for current user", LogLevel.Debug);
                PluginsRegKey = rhino_info.OpenCurrentUserPluginKey();
            }
            else
            {
                throw new RhinoInstallerException(string.Format(CultureInfo.InvariantCulture, "Unexpected user '{0}' encountered in RegisterPlugin.", m_user));
            }

            if (PluginsRegKey == null)
            {
                ReportProgress("Plug-in registration failed: RegKey == null", LogLevel.Error);
                return(false);
            }

            // 2012-04-03, Brian Gillespie.
            // Plug-ins installed by the RHI file should always be re-loaded by Rhino;
            // Older versions of this code would check for existing plug-in registrations
            // and would set the {GUID}\Plug-in\Name and {GUID}\Plug-in\FileName keys instead.
            // But the old behavior fails to update the plug-in commands, or cause new .RUI files
            // to be loaded by Rhino.
            ReportProgress("Creating new plug-in registration", LogLevel.Debug);
            // Doesn't exist; Create it and register the plug-in
            RegistryKey ThisPluginGuidKey = PluginsRegKey.CreateSubKey(plugin_info.ID.ToString().ToUpperInvariant());

            if (ThisPluginGuidKey == null)
            {
                return(false);
            }

            // Create Name key
            ReportProgress("Setting Name to '" + plugin_info.Title + "'", LogLevel.Debug);
            ThisPluginGuidKey.SetValue("Name", plugin_info.Title);
            ReportProgress("Setting FileName to '" + plugin_info.PluginPath + "'", LogLevel.Debug);
            ThisPluginGuidKey.SetValue("FileName", plugin_info.PluginPath);

            // Delete load mode:
            object loadMode = ThisPluginGuidKey.GetValue("LoadMode");

            if (loadMode != null)
            {
                ThisPluginGuidKey.DeleteValue("LoadMode");
            }

            return(true);
        }
Ejemplo n.º 4
0
 public override bool IsCompatible(RhinoInfo rhino)
 {
     foreach (PluginInfo pii in m_plugin_lookup.Values)
     {
         if (pii.IsCompatible(rhino))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        public override bool AfterInstall(Package package, RhinoInfo[] RhinoList, RMA.RhiExec.Engine.InstallerUser InstallAsUser)
        {
            ClearPluginInfo();

              m_package = package;
              if (m_package == null)
            return false;

              string PackageFolder = package.PackagePath;
              ReportProgress("PythonPackage.Install() starting for Package at '" + PackageFolder + "'", LogLevel.Info);

              // Find all the *_cmd.py files (in top directory only, not subdirectories) and register them with IronPython
              if (!Plugin.IsValid())
              {
            ReportProgress("Package Description:\n" + Describe(), LogLevel.Info);
            ReportProgress("Package failed to initialize properly: " + PackageFolder, LogLevel.Error);
            return false;
              }

              string[] commands = Plugin.Commands;

              if (commands.Length == 0)
              {
            ReportProgress("No files named *_cmd.py found in " + PackageFolder, LogLevel.Error);
            return false;
              }

              // HKEY_CURRENT_USER\Software\McNeel\Rhinoceros\5.0\Plug-Ins\814d908a-e25c-493d-97e9-ee3861957f49\CommandList
              RegistryKey RegCmd_32 = Registry.CurrentUser.CreateSubKey(@"Software\McNeel\Rhinoceros\5.0\Plug-Ins\814d908a-e25c-493d-97e9-ee3861957f49\CommandList");
              if (RegCmd_32 == null)
            ReportProgress(@"Unable to write to HKCU\Software\McNeel\Rhinoceros\5.0\Plug-Ins\814d908a-e25c-493d-97e9-ee3861957f49\CommandList", LogLevel.Error);

              RegistryKey RegCmd_64 = Registry.CurrentUser.CreateSubKey(@"Software\McNeel\Rhinoceros\5.0x64\Plug-Ins\814d908a-e25c-493d-97e9-ee3861957f49\CommandList");
              if (RegCmd_64 == null)
            ReportProgress(@"Unable to write to HKCU\Software\McNeel\Rhinoceros\5.0\Plug-Ins\814d908a-e25c-493d-97e9-ee3861957f49\CommandList", LogLevel.Error);

              foreach (string cmd in commands)
              {
            // Register this command in IronPython:
            if (RegCmd_32 != null) // 32-bit
              RegCmd_32.SetValue(cmd, "66;" + cmd, RegistryValueKind.String);
            if (RegCmd_64 != null) // 64-bit
              RegCmd_64.SetValue(cmd, "66;" + cmd, RegistryValueKind.String);

            ReportProgress("Registering command: " + cmd, LogLevel.Info);
              }

              return true;
        }
 public override bool IsCompatible(RhinoInfo rhino)
 {
     foreach (RhinoPlatform platform in m_manifest.SupportedPlatforms)
     {
         if (platform == rhino.RhinoPlatform)
         {
             ReportProgress("Package (" + this.PackagePath + ") is compatible with Rhino: " + rhino.RhinoVersion.ToString(), LogLevel.Info);
             return(true);
         }
         else
         {
             ReportProgress("Package (" + this.PackagePath + ") NOT compatible with Rhino: " + rhino.RhinoVersion.ToString(), LogLevel.Debug);
         }
     }
     return(false);
 }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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;
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Check if this Package is compatible with an installed Rhino.
 /// </summary>
 /// <param name="info">
 /// A RhinoInfo class representing an installation of Rhino on the target machine.
 /// </param>
 /// <returns>
 /// true if this Package is compatible with Rhino represented by info.
 /// false otherwise.
 /// </returns>
 public abstract bool IsCompatible(RhinoInfo rhino);
Ejemplo n.º 12
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;
 }
Ejemplo n.º 13
0
        public bool IsCompatible(RhinoInfo rhino)
        {
            PluginInfo plugin = this;

            if (!rhino.IsValid())
            {
                Logger.Log(LogLevel.Debug, "RhinoInfo::IsPluginCompatible called with invalid PluginInfo: " + plugin.m_plugin_path);
                return(false);
            }

            // Plug-in uses RhinoDotNet?
            if (!string.IsNullOrEmpty(plugin.DotNetSDKVersion))
            {
                // Get last section of Rhino DotNet version number
                Match  m         = Regex.Match(rhino.RhinoDotNetVersion, @"\.(\d+)$");
                string sRhinoRev = m.Groups[1].Value;
                int    nRhinoRev = -1;
                if (!int.TryParse(sRhinoRev, out nRhinoRev))
                {
                    nRhinoRev = -1;
                }

                // Get last section of Plug-in DotNet version number
                m = Regex.Match(plugin.DotNetSDKVersion, @"\.(\d+)$");
                string sPluginRev = m.Groups[1].Value;
                int    nPluginRev = -1;

                if (!int.TryParse(sPluginRev, out nPluginRev))
                {
                    nPluginRev = -1;
                }

                if (nRhinoRev < 0 || nPluginRev < 0)
                {
                    Logger.Log(LogLevel.Debug, "RhinoDotNet version incompatibility: Rhino: " + rhino.RhinoDotNetVersion + ", Plug-in: " + plugin.DotNetSDKVersion);
                    return(false);
                }

                if (nRhinoRev < 100)
                {
                    // Rhino is 4.0
                    if (nPluginRev < 100)
                    {
                        // Plug-in is 4.0; go ahead and install
                    }
                    else
                    {
                        // Plug-in is newer than 4.0; do not install.
                        Logger.Log(LogLevel.Debug, "RhinoDotNet version incompatibility: Rhino: " + rhino.RhinoDotNetVersion + ", Plug-in: " + plugin.DotNetSDKVersion);
                        return(false);
                    }
                }
                else
                {
                    // Rhino is 5.0
                }

                // Plug-in is dotNet, but Rhino has older version of dotNet
                int cf = string.Compare(rhino.RhinoDotNetVersion, plugin.DotNetSDKVersion, StringComparison.OrdinalIgnoreCase);
                if (cf < 0)
                {
                    Logger.Log(LogLevel.Debug, "RhinoDotNet version incompatibility: Rhino: " + rhino.RhinoDotNetVersion + ", Plug-in: " + plugin.DotNetSDKVersion);
                    return(false);
                }
            }

            // Plug-in uses RhinoCommon?
            if (!string.IsNullOrEmpty(plugin.RhinoCommonSDKVersion))
            {
                // Plug-in uses RhinoCommon, but Rhino doesn't have it
                if (string.IsNullOrEmpty(rhino.RhinoCommonVersion))
                {
                    Logger.Log(LogLevel.Debug, "RhinoCommon version incompatibility: Rhino: not found, Plug-in: " + plugin.RhinoCommonSDKVersion);
                    return(false);
                }

                // Plug-in uses RhinoCommon, but Rhino has older version of RhinoCommon
                int cf = string.Compare(rhino.RhinoCommonVersion, plugin.RhinoCommonSDKVersion, StringComparison.OrdinalIgnoreCase);
                if (cf < 0)
                {
                    Logger.Log(LogLevel.Debug, "RhinoCommon version incompatibility: Rhino: " + rhino.RhinoCommonVersion + ", Plug-in: " + plugin.RhinoCommonSDKVersion);
                    return(false);
                }
            }

            // Plug-in uses C++?
            if (!string.IsNullOrEmpty(plugin.RhinoSDKVersion))
            {
                if (rhino.RhinoSdkVersion.EndsWith("0", StringComparison.OrdinalIgnoreCase))
                {
                    // Rhino is 4.0
                    if (plugin.RhinoSDKVersion.EndsWith("0", StringComparison.OrdinalIgnoreCase))
                    {
                        // Do nothing. Plug-in is compatible.
                    }
                    else
                    {
                        Logger.Log(LogLevel.Debug, "RhinoSdkVersion incompatibility: Rhino: " + rhino.RhinoSdkVersion + ", Plug-in: " + plugin.RhinoSDKVersion);
                        return(false); // Plug-in is not compatible
                    }
                }
                else if (rhino.RhinoSdkVersion.EndsWith("5", StringComparison.OrdinalIgnoreCase))
                {
                    // Rhino is 5.0
                    if (plugin.RhinoSDKVersion.EndsWith("5", StringComparison.OrdinalIgnoreCase))
                    {
                        // Plugin is 4.0 or 5.0
                        // do nothing; rhino is compatible
                    }
                    else
                    {
                        Logger.Log(LogLevel.Debug, "RhinoSdkVersion incompatibility: Rhino: " + rhino.RhinoSdkVersion + ", Plug-in: " + plugin.RhinoSDKVersion);
                        return(false);
                    }
                }
                else
                {
                    Logger.Log(LogLevel.Debug, "RhinoSdkVersion incompatibility: Rhino: " + rhino.RhinoSdkVersion + ", Plug-in: " + plugin.RhinoSDKVersion);
                    return(false);
                }
            }

            if (!string.IsNullOrEmpty(plugin.RhinoSDKServiceRelease))
            {
                if (rhino.RhinoSdkServiceRelease.EndsWith("0", StringComparison.OrdinalIgnoreCase))
                {
                    // Rhino is 4.0
                    if (plugin.RhinoSDKServiceRelease.EndsWith("0", StringComparison.OrdinalIgnoreCase))
                    {
                        // do nothing, rhino is compatible
                    }
                    else
                    {
                        Logger.Log(LogLevel.Debug, "RhinoSdkServiceRelease incompatibility: Rhino: " + rhino.RhinoSdkServiceRelease + ", Plug-in: " + plugin.RhinoSDKServiceRelease);
                        return(false);
                    }
                }
                else if (rhino.RhinoSdkServiceRelease.EndsWith("5", StringComparison.OrdinalIgnoreCase))
                {
                    if (plugin.RhinoSDKServiceRelease.EndsWith("0", StringComparison.OrdinalIgnoreCase) ||
                        plugin.RhinoSDKServiceRelease.EndsWith("5", StringComparison.OrdinalIgnoreCase))
                    {
                        // do nothing, rhino is compatible
                    }
                    else
                    {
                        Logger.Log(LogLevel.Debug, "RhinoSdkServiceRelease incompatibility: Rhino: " + rhino.RhinoSdkServiceRelease + ", Plug-in: " + plugin.RhinoSDKServiceRelease);
                        return(false);
                    }
                }
                else
                {
                    // unknown Rhino
                    Logger.Log(LogLevel.Debug, "RhinoSdkServiceRelease incompatibility: Rhino: " + rhino.RhinoSdkServiceRelease + ", Plug-in: " + plugin.RhinoSDKServiceRelease);
                    return(false);
                }
            }

            Logger.Log(LogLevel.Info, "Compatible Rhino found: " + rhino.RhinoExePath);
            return(true);
        }
 public override bool IsCompatible(RhinoInfo rhino)
 {
     foreach (RhinoPlatform platform in m_manifest.SupportedPlatforms)
       {
     if (platform == rhino.RhinoPlatform)
     {
       ReportProgress("Package (" + this.PackagePath + ") is compatible with Rhino: " + rhino.RhinoVersion.ToString(), LogLevel.Info);
       return true;
     }
     else
     {
       ReportProgress("Package (" + this.PackagePath + ") NOT compatible with Rhino: " + rhino.RhinoVersion.ToString(), LogLevel.Debug);
     }
       }
       return false;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Check if this Package is compatible with an installed Rhino.
 /// </summary>
 /// <param name="info">
 /// A RhinoInfo class representing an installation of Rhino on the target machine.
 /// </param>
 /// <returns>
 /// true if this Package is compatible with Rhino represented by info.
 /// false otherwise.
 /// </returns>
 public abstract bool IsCompatible(RhinoInfo rhino);
Ejemplo n.º 16
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;
        }
Ejemplo n.º 17
0
        private bool RegisterPlugin(PluginInfo plugin_info, RhinoInfo rhino_info)
        {
            ReportProgress("Registering plugin: " + plugin_info.PluginPath, LogLevel.Info);
              RegistryKey PluginsRegKey = null;
              if (m_user == InstallerUser.AllUsers)
              {
            ReportProgress("Registering for all users", LogLevel.Debug);
            PluginsRegKey = rhino_info.OpenAllUsersPluginKey();
              }
              else if (m_user == InstallerUser.CurrentUser)
              {
            ReportProgress("Registering for current user", LogLevel.Debug);
            PluginsRegKey = rhino_info.OpenCurrentUserPluginKey();
              }
              else
              {
            throw new RhinoInstallerException(string.Format(CultureInfo.InvariantCulture, "Unexpected user '{0}' encountered in RegisterPlugin.", m_user));
              }

              if (PluginsRegKey == null)
              {
            ReportProgress("Plug-in registration failed: RegKey == null", LogLevel.Error);
            return false;
              }

              // 2012-04-03, Brian Gillespie.
              // Plug-ins installed by the RHI file should always be re-loaded by Rhino;
              // Older versions of this code would check for existing plug-in registrations
              // and would set the {GUID}\Plug-in\Name and {GUID}\Plug-in\FileName keys instead.
              // But the old behavior fails to update the plug-in commands, or cause new .RUI files
              // to be loaded by Rhino.
              ReportProgress("Creating new plug-in registration", LogLevel.Debug);
              // Doesn't exist; Create it and register the plug-in
              RegistryKey ThisPluginGuidKey = PluginsRegKey.CreateSubKey(plugin_info.ID.ToString().ToUpperInvariant());
              if (ThisPluginGuidKey == null)
            return false;

              // Create Name key
              ReportProgress("Setting Name to '" + plugin_info.Title + "'", LogLevel.Debug);
              ThisPluginGuidKey.SetValue("Name", plugin_info.Title);
              ReportProgress("Setting FileName to '" + plugin_info.PluginPath + "'", LogLevel.Debug);
              ThisPluginGuidKey.SetValue("FileName", plugin_info.PluginPath);

              // Delete load mode:
              object loadMode = ThisPluginGuidKey.GetValue("LoadMode");
              if (loadMode != null)
            ThisPluginGuidKey.DeleteValue("LoadMode");

              return true;
        }
Ejemplo n.º 18
0
        static void DetectInstalledRhino()
        {
            List<string> InstallPaths = SearchRegistryForRhinoInstallPaths();
              foreach (string path in InstallPaths)
            ReportProgress(LogLevel.Debug, string.Format("Rhino found here: {0}", path));

              string[] rhino_xml_files = Directory.GetFiles(m_state.TemporaryFolder, "__~~RhinoInfo~~__.*.tmp.xml");
              foreach (string rhino_xml_file in rhino_xml_files)
            File.Delete(rhino_xml_file);

              foreach (string rhpath in InstallPaths)
              {
            if (!File.Exists(rhpath))
            {
              // Don't bother spawning an inspection process if rhpath is not found.
              // Fixes http://dev.mcneel.com/bugtrack/?q=68438
              ReportProgress(LogLevel.Info, InstallerPhase.Unknown, "DetectInstalledRhino() cound not find file: " + rhpath);
              continue;
            }

            InstallerPhase rc = Program.ExecuteChildProcess(OSPlatform.x86, "/INSPECTRHINO \"" + rhpath + "\" /INSPECTWORKINGDIR \"" + m_state.TemporaryFolder + "\"", false);
            if (rc != InstallerPhase.Success)
            {
              if (Is64BitProcess())
              {
            Program.ExecuteChildProcess(OSPlatform.x64, "/INSPECTRHINO \"" + rhpath + "\" /INSPECTWORKINGDIR \"" + m_state.TemporaryFolder + "\"", false);
              }
            }
              }

              string[] rhino_info_files = Directory.GetFiles(m_state.TemporaryFolder, "__~~RhinoInfo~~__*.tmp.xml");

              foreach (string rhino_info in rhino_info_files)
              {
            RhinoInfo info = new RhinoInfo();
            info.ReadXml(Path.Combine(m_state.TemporaryFolder, rhino_info));
            m_state.AddRhino(info);
              }
        }
Ejemplo n.º 19
0
 public void AddRhino(RhinoInfo info)
 {
     lock (m_lock_obj)
     m_rhinos.Add(info);
 }
Ejemplo n.º 20
0
        public bool IsCompatible(RhinoInfo rhino)
        {
            PluginInfo plugin = this;
              if (!rhino.IsValid())
              {
            Logger.Log(LogLevel.Debug, "RhinoInfo::IsPluginCompatible called with invalid PluginInfo: " + plugin.m_plugin_path);
            return false;
              }

              // Plug-in uses RhinoDotNet?
              if (!string.IsNullOrEmpty(plugin.DotNetSDKVersion))
              {
            // Get last section of Rhino DotNet version number
            Match m = Regex.Match(rhino.RhinoDotNetVersion, @"\.(\d+)$");
            string sRhinoRev = m.Groups[1].Value;
            int nRhinoRev = -1;
            if (!int.TryParse(sRhinoRev, out nRhinoRev))
              nRhinoRev = -1;

            // Get last section of Plug-in DotNet version number
            m = Regex.Match(plugin.DotNetSDKVersion, @"\.(\d+)$");
            string sPluginRev = m.Groups[1].Value;
            int nPluginRev = -1;

            if (!int.TryParse(sPluginRev, out nPluginRev))
              nPluginRev = -1;

            if (nRhinoRev < 0 || nPluginRev < 0)
            {
              Logger.Log(LogLevel.Debug, "RhinoDotNet version incompatibility: Rhino: " + rhino.RhinoDotNetVersion + ", Plug-in: " + plugin.DotNetSDKVersion);
              return false;
            }

            if (nRhinoRev < 100)
            {
              // Rhino is 4.0
              if (nPluginRev < 100)
              {
            // Plug-in is 4.0; go ahead and install
              }
              else
              {
            // Plug-in is newer than 4.0; do not install.
            Logger.Log(LogLevel.Debug, "RhinoDotNet version incompatibility: Rhino: " + rhino.RhinoDotNetVersion + ", Plug-in: " + plugin.DotNetSDKVersion);
            return false;
              }
            }
            else
            {
              // Rhino is 5.0
            }

            // Plug-in is dotNet, but Rhino has older version of dotNet
            int cf = string.Compare(rhino.RhinoDotNetVersion, plugin.DotNetSDKVersion, StringComparison.OrdinalIgnoreCase);
            if (cf < 0)
            {
              Logger.Log(LogLevel.Debug, "RhinoDotNet version incompatibility: Rhino: " + rhino.RhinoDotNetVersion + ", Plug-in: " + plugin.DotNetSDKVersion);
              return false;
            }
              }

              // Plug-in uses RhinoCommon?
              if (!string.IsNullOrEmpty(plugin.RhinoCommonSDKVersion))
              {
            // Plug-in uses RhinoCommon, but Rhino doesn't have it
            if (string.IsNullOrEmpty(rhino.RhinoCommonVersion))
            {
              Logger.Log(LogLevel.Debug, "RhinoCommon version incompatibility: Rhino: not found, Plug-in: " + plugin.RhinoCommonSDKVersion);
              return false;
            }

            // Plug-in uses RhinoCommon, but Rhino has older version of RhinoCommon
            int cf = string.Compare(rhino.RhinoCommonVersion, plugin.RhinoCommonSDKVersion, StringComparison.OrdinalIgnoreCase);
            if (cf < 0)
            {
              Logger.Log(LogLevel.Debug, "RhinoCommon version incompatibility: Rhino: " + rhino.RhinoCommonVersion + ", Plug-in: " + plugin.RhinoCommonSDKVersion);
              return false;
            }
              }

              // Plug-in uses C++?
              if (!string.IsNullOrEmpty(plugin.RhinoSDKVersion))
              {
            if (rhino.RhinoSdkVersion.EndsWith("0", StringComparison.OrdinalIgnoreCase))
            {
              // Rhino is 4.0
              if (plugin.RhinoSDKVersion.EndsWith("0", StringComparison.OrdinalIgnoreCase))
              {
            // Do nothing. Plug-in is compatible.
              }
              else
              {
            Logger.Log(LogLevel.Debug, "RhinoSdkVersion incompatibility: Rhino: " + rhino.RhinoSdkVersion + ", Plug-in: " + plugin.RhinoSDKVersion);
            return false; // Plug-in is not compatible
              }
            }
            else if (rhino.RhinoSdkVersion.EndsWith("5", StringComparison.OrdinalIgnoreCase))
            {
              // Rhino is 5.0
              if (plugin.RhinoSDKVersion.EndsWith("5", StringComparison.OrdinalIgnoreCase))
              {
            // Plugin is 4.0 or 5.0
            // do nothing; rhino is compatible
              }
              else
              {
            Logger.Log(LogLevel.Debug, "RhinoSdkVersion incompatibility: Rhino: " + rhino.RhinoSdkVersion + ", Plug-in: " + plugin.RhinoSDKVersion);
            return false;
              }
            }
            else
            {
              Logger.Log(LogLevel.Debug, "RhinoSdkVersion incompatibility: Rhino: " + rhino.RhinoSdkVersion + ", Plug-in: " + plugin.RhinoSDKVersion);
              return false;
            }
              }

              if (!string.IsNullOrEmpty(plugin.RhinoSDKServiceRelease))
              {
            if (rhino.RhinoSdkServiceRelease.EndsWith("0", StringComparison.OrdinalIgnoreCase))
            {
              // Rhino is 4.0
              if (plugin.RhinoSDKServiceRelease.EndsWith("0", StringComparison.OrdinalIgnoreCase))
              {
            // do nothing, rhino is compatible
              }
              else
              {
            Logger.Log(LogLevel.Debug, "RhinoSdkServiceRelease incompatibility: Rhino: " + rhino.RhinoSdkServiceRelease + ", Plug-in: " + plugin.RhinoSDKServiceRelease);
            return false;
              }
            }
            else if (rhino.RhinoSdkServiceRelease.EndsWith("5", StringComparison.OrdinalIgnoreCase))
            {
              if (plugin.RhinoSDKServiceRelease.EndsWith("0", StringComparison.OrdinalIgnoreCase)
              || plugin.RhinoSDKServiceRelease.EndsWith("5", StringComparison.OrdinalIgnoreCase))
              {
            // do nothing, rhino is compatible
              }
              else
              {
            Logger.Log(LogLevel.Debug, "RhinoSdkServiceRelease incompatibility: Rhino: " + rhino.RhinoSdkServiceRelease + ", Plug-in: " + plugin.RhinoSDKServiceRelease);
            return false;
              }
            }
            else
            {
              // unknown Rhino
              Logger.Log(LogLevel.Debug, "RhinoSdkServiceRelease incompatibility: Rhino: " + rhino.RhinoSdkServiceRelease + ", Plug-in: " + plugin.RhinoSDKServiceRelease);
              return false;
            }
              }

              Logger.Log(LogLevel.Info, "Compatible Rhino found: " + rhino.RhinoExePath);
              return true;
        }
Ejemplo n.º 21
0
 public void AddRhino(RhinoInfo info)
 {
     lock (m_lock_obj)
         m_rhinos.Add(info);
 }
Ejemplo n.º 22
0
        public static InstallerPhase InspectRhinoAndWriteXml(string PathToRhino, string OutputDirectory)
        {
            Logger.Log(LogLevel.Debug, "InspectRhino\tBeginning inspection of '" + PathToRhino + "'");

              // This should only be called from a separate process.
              if (string.IsNullOrEmpty(OutputDirectory))
            return InstallerPhase.InspctWrkDirMissing;

              RhinoInfo info = new RhinoInfo();
              info.Inspect(PathToRhino);
              if (!info.IsValid())
            return InstallerPhase.InspctFailed;

              string xmlname = info.GetXmlFileName();
              Directory.CreateDirectory(OutputDirectory);
              string path = Path.Combine(OutputDirectory, xmlname);
              info.WriteXml(path);
              return InstallerPhase.Success;
        }
Ejemplo n.º 23
0
 public override bool IsCompatible(RhinoInfo rhino)
 {
     foreach (PluginInfo pii in m_plugin_lookup.Values)
       {
     if (pii.IsCompatible(rhino))
       return true;
       }
       return false;
 }
Ejemplo n.º 24
0
        public override bool IsCompatible(RhinoInfo rhino)
        {
            if (rhino.RhinoVersion.Major == 5)
            return true;

              return false;
        }