示例#1
0
 private bool CheckSheetSeparator()
 {
     //Not empty or contain only spaces
     if (string.IsNullOrWhiteSpace(Settings.SheetSeparator))
     {
         string msg = $"Sheet separator can not be empty or contain only spaces.";
         logger.Log(LogFactory.CreateErrorMessage(msg));
         return(false);
     }
     return(true);
 }
示例#2
0
 private static void SavePdfFile(PdfDocument document, string fullPathToFile)
 {
     try
     {
         document.Save(fullPathToFile);
         string msg = $"Pdf file '{fullPathToFile}' saved.";
         logger.Log(LogFactory.CreateNormalMessage(msg));
     }
     catch (Exception ex)
     {
         string msg = $"Saving pdf '{fullPathToFile}' failed:\n{ex.Message}";
         logger.Log(LogFactory.CreateErrorMessage(msg));
     }
 }
示例#3
0
        private bool CheckSheetFileExistence()
        {
            bool result = true;

            foreach (Sheet s in Sheets.GetAllTargetItems())
            {
                if (!s.Exists())
                {
                    result = false;
                    string msg = $"File '{s.FullPath}' does not exists.";
                    logger.Log(LogFactory.CreateErrorMessage(msg));
                }
            }
            return(result);
        }
示例#4
0
        private bool CheckInitialSettings()
        {
            //Saving pdf files to
            bool result1 = true;

            if (!Settings.CreatePdfFilesToFirstSheetDirectory)
            {
                if (string.IsNullOrWhiteSpace(Settings.DirectoryPathForPdfs))
                {
                    result1 = false;
                    string msg = $"Path for all files can not be empty.";
                    logger.Log(LogFactory.CreateErrorMessage(msg));
                }
                else if (!System.IO.Directory.Exists(Settings.DirectoryPathForPdfs))
                {
                    result1 = false;
                    string msg = $"Path '{Settings.DirectoryPathForPdfs}' for all files does not exists.";
                    logger.Log(LogFactory.CreateErrorMessage(msg));
                }
            }

            //Combination file
            bool result2 = true;

            if (Settings.CreateCombinationFile)
            {
                if (string.IsNullOrWhiteSpace(Settings.CombinationFilePath))
                {
                    result2 = false;
                    string msg = $"Path for combination file can not be empty.";
                    logger.Log(LogFactory.CreateErrorMessage(msg));
                }
                else if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(Settings.CombinationFilePath)))
                {
                    result2 = false;
                    string msg = $"Directory '{System.IO.Path.GetDirectoryName(Settings.CombinationFilePath)}' for combination file does not exists.";
                    logger.Log(LogFactory.CreateErrorMessage(msg));
                }
            }

            return(result1 & result2);
        }