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());
        }
        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);
        }
        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);
        }
Beispiel #4
0
        public string GetFullPath(PackageFileKey fileName)
        {
            // Extract to temporary directory
            if (fileName == null || string.IsNullOrEmpty(fileName.Key))
            {
                return(null);
            }

            string fullpath = Path.Combine(DestinationFolder, fileName.Key.Replace(@"/", @"\"));

            if (File.Exists(fullpath))
            {
                return(fullpath);
            }

            fullpath = ExtractFile(fileName, DestinationFolder);
            return(fullpath);
        }
Beispiel #5
0
        private string ExtractFile(PackageFileKey fileName, string folder)
        {
            using (ZipFile f = OpenZipFile(m_package_path))
            {
                ZipEntry entry = f.GetEntry(fileName.Key);
                if (entry == null)
                {
                    Engine.InstallerEngine.ReportProgress(LogLevel.Info, "File not found in package: " + fileName);
                    return(null);
                }

                string fullpath = Path.Combine(folder, fileName.Key.Replace("/", "\\"));
                if (ExtractFile(f, entry, fullpath))
                {
                    return(fullpath);
                }

                return(null);
            }
        }
Beispiel #6
0
        private string ExtractFile(PackageFileKey fileName, string folder)
        {
            using (ZipFile f = OpenZipFile(m_package_path))
              {
            ZipEntry entry = f.GetEntry(fileName.Key);
            if (entry == null)
            {
              Engine.InstallerEngine.ReportProgress(LogLevel.Info, "File not found in package: " + fileName);
              return null;
            }

            string fullpath = Path.Combine(folder, fileName.Key.Replace("/", "\\"));
            if (ExtractFile(f, entry, fullpath))
              return fullpath;

            return null;
              }
        }
Beispiel #7
0
        public string GetFullPath(PackageFileKey fileName)
        {
            // Extract to temporary directory
              if (fileName == null || string.IsNullOrEmpty(fileName.Key))
            return null;

              string fullpath = Path.Combine(DestinationFolder, fileName.Key.Replace(@"/", @"\"));
              if (File.Exists(fullpath))
            return fullpath;

              fullpath = ExtractFile(fileName, DestinationFolder);
              return fullpath;
        }