|
@@ -20,6 +20,7 @@ using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
+using static PDF_Office.Model.Dialog.ToolsDialogs.SaftyDialogs.DeleteSafetySettintgsModel;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
|
|
|
{
|
|
@@ -364,6 +365,11 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
|
|
|
continue;
|
|
|
}
|
|
|
string FileType = Path.GetExtension(mergeObject.FilePath).Trim().ToLower();
|
|
|
+ if (string.IsNullOrEmpty(FileType))
|
|
|
+ {
|
|
|
+ //获取不到文件类型
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if (FileType != ".pdf")
|
|
|
{
|
|
|
if (!Properties.Resources.imageex.Contains(FileType))
|
|
@@ -381,28 +387,25 @@ namespace PDF_Office.ViewModels.Dialog.ToolsDialogs
|
|
|
else
|
|
|
{
|
|
|
CPDFDocument doc = CPDFDocument.InitWithFilePath(mergeObject.FilePath);
|
|
|
- if (doc.IsLocked)
|
|
|
+ if (doc==null)
|
|
|
{
|
|
|
- DialogParameters value = new DialogParameters();
|
|
|
- value.Add(ParameterNames.PDFDocument, doc);
|
|
|
- dialogs.ShowDialog(DialogNames.VerifyPassWordDialog, value, e =>
|
|
|
- {
|
|
|
- if (e.Result != ButtonResult.OK)
|
|
|
- {
|
|
|
- result = false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- mergeObject.Password = e.Parameters.GetValue<string>(ParameterNames.PassWord);
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- if (!result)
|
|
|
+ //图片格式不支持
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ VerifyPasswordResult condition = SecurityHelper.VerifyPasswordByPasswordKind(doc, EnumPasswordKind.StatusPermissionsPassword, dialogs);
|
|
|
+ if (condition.IsDiscryptied)
|
|
|
+ {
|
|
|
+ if (condition.Password != null)
|
|
|
{
|
|
|
- doc.Release();
|
|
|
- continue;
|
|
|
+ mergeObject.Password = condition.Password;
|
|
|
+ doc.UnlockWithPassword(condition.Password);
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ doc.Release();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
mergeObject.DocName = doc.FileName;
|
|
|
mergeObject.DocPageCount = doc.PageCount.ToString() + "页";
|
|
|
mergeObject.SDKPageCount = doc.PageCount;
|