示例#1
0
        /// <summary>
        /// Gets the names of the fonts referenced in the book but not found on this machine.
        /// </summary>
        /// <param name="bookPath">The path to the book folder</param>
        /// Returns a list of the fonts that the book reference but which are not installed, or null if there was an error
        public List <string> GetMissingFonts(string bookPath, out bool success)
        {
            var missingFonts = new List <string>();

            using (var reportFile = SIL.IO.TempFile.CreateAndGetPathButDontMakeTheFile())
            {
                string bloomArguments    = $"getfonts --bookpath \"{bookPath}\" --reportpath \"{reportFile.Path}\"";
                bool   subprocessSuccess = _bloomCli.StartAndWaitForBloomCli(bloomArguments, _kGetFontsTimeoutSecs * 1000, out int exitCode, out string stdOut, out string stdError);

                if (!subprocessSuccess || !SIL.IO.RobustFile.Exists(reportFile.Path))
                {
                    _logger.LogError("Error: Could not determine fonts from book located at " + bookPath);
                    _logger.LogVerbose("Standard output:\n" + stdOut);
                    _logger.LogVerbose("Standard error:\n" + stdError);

                    success = false;
                    return(missingFonts);
                }

                var bookFontNames = GetFontsFromReportFile(reportFile.Path);
                missingFonts = GetMissingFonts(bookFontNames);
            }

            success = true;
            return(missingFonts);
        }
示例#2
0
 // Log a trace with Severity = Error
 public void LogError(string messageFormat, params object[] args)
 {
     this.TrackTrace(SeverityLevel.Error, messageFormat, args);
     _fileLogger.LogError(messageFormat, args);
 }