public bool Initialize(Package package)
        {
            if (package == null)
            {
                InstallerEngine.ReportProgress(LogLevel.Error, "PythonPluginInfo::Initialize called with null package");
                return(false);
            }
            PackageFileKey plugin_py_key = package.FindSingleFile("__plugin__.py");
            string         plugin_py     = package.GetFullPath(plugin_py_key);

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

            if (!LoadPluginPyFile(plugin_py))
            {
                return(false);
            }

            ReadCommandsFromPackage(package);

            InstallerEngine.ReportProgress(LogLevel.Info, "PythonPluginInfo::Initialize failed");
            return(this.IsValid());
        }
예제 #2
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);
        }
        public override bool Initialize(Package package)
        {
            PackageFileKey key           = package.FindSingleFile(PackageManifestName);
            string         manifest_path = package.GetFullPath(key);

            if (!LoadManifest(Path.GetDirectoryName(manifest_path)))
            {
                ReportProgress("Initialize() failed for package at " + package.PackagePath, LogLevel.Debug);
                return(false);
            }

            return(true);
        }
예제 #4
0
        public override bool Initialize(Package package)
        {
            m_package = package;
            // See if at least one compatible Rhino is installed.

            Guid last_plugin_id = Guid.Empty;
            Collection <PackageFileKey> rhp_files = ListRhpFiles(package);

            bool foundOneValidRhino = false;

            foreach (PackageFileKey rhp in rhp_files)
            {
                string         rhp_full_path = package.GetFullPath(rhp);
                InstallerPhase rc            = ExecutePluginInspector(rhp_full_path);

                if (rc != InstallerPhase.Success)
                {
                    continue;
                }

                foundOneValidRhino = true;
                PluginInfo pii = new PluginInfo();
                pii.PluginPath = rhp_full_path;
                pii.ReadXml();
                m_plugin_lookup.Add(rhp, pii);

                if (last_plugin_id != Guid.Empty && pii.ID != last_plugin_id)
                {
                    ReportProgress("Plug-in GUID mismatch: " + pii.ID + " != " + last_plugin_id, LogLevel.Error);
                    throw new GuidMismatchException("All plug-ins in an installer must have the same GUID. Two different GUIDs were found.");
                }

                last_plugin_id = pii.ID;
            }

            if (!foundOneValidRhino)
            {
                ReportProgress("Plug-in inspection failed", LogLevel.Error);
                throw new PackageNotCompatibleException(package.PackagePath);
            }



            m_id = last_plugin_id;
            return(true);
        }
        public override bool ContainsRecognizedPayload(Package package)
        {
            PackageFileKey key = package.FindSingleFile(PackageManifestName);
              if (key != null)
              {
            string manifestFullPath = package.GetFullPath(key);
            if (File.Exists(manifestFullPath))
            {
              return LoadManifest(Path.GetDirectoryName(manifestFullPath));
            }
            ReportProgress(string.Format("Recognized payload as {0} Package", m_content_type.ToString()), LogLevel.Info);
            return true;
              }

              ReportProgress(string.Format("Package not recognized as {0} Package", m_content_type.ToString()), LogLevel.Info);
              return false;
        }
        public override bool ContainsRecognizedPayload(Package package)
        {
            PackageFileKey key = package.FindSingleFile(PackageManifestName);

            if (key != null)
            {
                string manifestFullPath = package.GetFullPath(key);
                if (File.Exists(manifestFullPath))
                {
                    return(LoadManifest(Path.GetDirectoryName(manifestFullPath)));
                }
                ReportProgress(string.Format("Recognized payload as {0} Package", m_content_type.ToString()), LogLevel.Info);
                return(true);
            }

            ReportProgress(string.Format("Package not recognized as {0} Package", m_content_type.ToString()), LogLevel.Info);
            return(false);
        }
        public override bool Initialize(Package package)
        {
            PackageFileKey key = package.FindSingleFile(PackageManifestName);
              string manifest_path = package.GetFullPath(key);

              if (!LoadManifest(Path.GetDirectoryName(manifest_path)))
              {
            ReportProgress("Initialize() failed for package at " + package.PackagePath, LogLevel.Debug);
            return false;
              }

              return true;
        }
예제 #8
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;
        }
예제 #9
0
        public override bool Initialize(Package package)
        {
            m_package = package;
              // See if at least one compatible Rhino is installed.

              Guid last_plugin_id = Guid.Empty;
              Collection<PackageFileKey> rhp_files = ListRhpFiles(package);

              bool foundOneValidRhino = false;

              foreach (PackageFileKey rhp in rhp_files)
              {
            string rhp_full_path = package.GetFullPath(rhp);
            InstallerPhase rc = ExecutePluginInspector(rhp_full_path);

            if (rc != InstallerPhase.Success)
              continue;

            foundOneValidRhino = true;
            PluginInfo pii = new PluginInfo();
            pii.PluginPath = rhp_full_path;
            pii.ReadXml();
            m_plugin_lookup.Add(rhp, pii);

            if (last_plugin_id != Guid.Empty && pii.ID != last_plugin_id)
            {
              ReportProgress("Plug-in GUID mismatch: " + pii.ID + " != " + last_plugin_id, LogLevel.Error);
              throw new GuidMismatchException("All plug-ins in an installer must have the same GUID. Two different GUIDs were found.");
            }

            last_plugin_id = pii.ID;
              }

              if (!foundOneValidRhino)
              {
            ReportProgress("Plug-in inspection failed", LogLevel.Error);
            throw new PackageNotCompatibleException(package.PackagePath);
              }

              m_id = last_plugin_id;
              return true;
        }
예제 #10
0
        public bool Initialize(Package package)
        {
            if (package == null)
              {
            InstallerEngine.ReportProgress(LogLevel.Error, "PythonPluginInfo::Initialize called with null package");
            return false;
              }
              PackageFileKey plugin_py_key = package.FindSingleFile("__plugin__.py");
              string plugin_py = package.GetFullPath(plugin_py_key);
              if (plugin_py == null)
            return false;

              if (!LoadPluginPyFile(plugin_py))
            return false;

              ReadCommandsFromPackage(package);

              InstallerEngine.ReportProgress(LogLevel.Info, "PythonPluginInfo::Initialize failed");
              return this.IsValid();
        }