Esempio n. 1
0
        /// <summary>
        /// Checks if the specified by input parameter tool's system variable is correctly specified
        /// and the specified tool can be executed.
        /// </summary>
        /// <param name="keyWord">the keyword specifying the tool (GhostScript or ImageMagick)</param>
        /// <returns>
        /// boolean result of checking: true - System variable is correctly specified
        /// and the specified tool can be executed
        /// </returns>
        public bool IsVersionCommandExecutable(String keyWord)
        {
            if (keyWord == null)
            {
                return(false);
            }
            String command = null;

            switch (keyWord)
            {
            case GHOSTSCRIPT_KEYWORD: {
                command = gsExec;
                break;
            }

            case MAGICK_COMPARE_KEYWORD: {
                command = compareExec;
                break;
            }
            }
            try {
                String result = SystemUtil.RunProcessAndGetOutput(command, "-version");
                return(result.Contains(keyWord));
            }
            catch (Exception) {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Checks if the command, passed as parameter, is executable and the output version text contains
 /// expected text
 /// </summary>
 /// <param name="command">a string command to execute</param>
 /// <param name="versionText">an expected version text line</param>
 /// <returns>
 /// boolean result of checking: true - the required command is executable and the output version
 /// text is correct
 /// </returns>
 public static bool IsVersionCommandExecutable(String command, String versionText)
 {
     if ((command == null) || (versionText == null))
     {
         return(false);
     }
     try {
         String result = SystemUtil.RunProcessAndGetOutput(command, "-version");
         return(result.Contains(versionText));
     }
     catch (Exception) {
         return(false);
     }
 }