Exemplo n.º 1
0
        private static ToolInfo GetToolInfo(DirectoryInfo toolInf, UnzipToolReturnAccumulator accumulator)
        {
            var    toolInfo = new ToolInfo();
            string infoFile = Path.Combine(toolInf.FullName, INFO_PROPERTIES);

            if (File.Exists(infoFile))
            {
                ExternalToolProperties readin;
                try
                {
                    readin = new ExternalToolProperties(infoFile);
                }
                catch (Exception)
                {
                    // Failed to read the .properties file
                    throw new ToolExecutionException(string.Format(Resources.ToolInstaller_GetToolInfo_Failed_to_process_the__0__file, INFO_PROPERTIES));
                }

                toolInfo.SetPackageVersion(readin.Version);
                toolInfo.SetPackageIdentifier(readin.Identifier);
                toolInfo.SetPackageName(readin.Name);

                //Check for Package Installation specified in info.properties
                var ppc = ToolMacros.GetProgramPathContainer(readin.Command);
                if (ppc != null)
                {
                    FindPackagesToInstall(readin, accumulator, ppc);
                }
            }
            else //No info.properties file in the tool-inf directory.
            {
                throw new ToolExecutionException(TextUtil.LineSeparate(
                                                     Resources.ToolInstaller_UnpackZipTool_The_selected_zip_file_is_not_a_valid_installable_tool_,
                                                     string.Format(Resources.ToolInstaller_GetToolInfo_Error__It_does_not_contain_the_required__0__in_the__1__directory_,
                                                                   INFO_PROPERTIES, TOOL_INF)));
            }
            return(toolInfo);
        }
Exemplo n.º 2
0
        private static ToolInfo GetToolInfo(DirectoryInfo toolInf, UnzipToolReturnAccumulator accumulator)
        {
            var toolInfo = new ToolInfo();
            string infoFile = Path.Combine(toolInf.FullName, INFO_PROPERTIES);
            if (File.Exists(infoFile))
            {
                ExternalToolProperties readin;
                try
                {
                    readin = new ExternalToolProperties(infoFile);
                }
                catch (Exception)
                {
                    // Failed to read the .properties file
                    throw new ToolExecutionException(string.Format(Resources.ToolInstaller_GetToolInfo_Failed_to_process_the__0__file, INFO_PROPERTIES));
                }

                toolInfo.SetPackageVersion(readin.Version);
                toolInfo.SetPackageIdentifier(readin.Identifier);
                toolInfo.SetPackageName(readin.Name);

                //Check for Package Installation specified in info.properties
                var ppc = ToolMacros.GetProgramPathContainer(readin.Command);
                if (ppc != null)
                {
                    FindPackagesToInstall(readin, accumulator, ppc);
                }

            }
            else //No info.properties file in the tool-inf directory.
            {
                throw new ToolExecutionException(TextUtil.LineSeparate(
                    Resources.ToolInstaller_UnpackZipTool_The_selected_zip_file_is_not_a_valid_installable_tool_,
                    string.Format(Resources.ToolInstaller_GetToolInfo_Error__It_does_not_contain_the_required__0__in_the__1__directory_,
                                  INFO_PROPERTIES, TOOL_INF)));
            }
            return toolInfo;
        }