Переглянути джерело

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

niehaoyu 11 місяців тому
батько
коміт
5857ff6af9

+ 29 - 22
PDF Office/PDF Master/Class/Batch/WindowController/KMBatchOperateLeftViewController.swift

@@ -693,32 +693,39 @@ class KMBatchOperateLeftViewController: NSViewController,NSTableViewDelegate,NST
             for i in 0..<allFilesArray.count {
                 let filePath: String = allFilesArray[i] as! String
                 
-                let document = CPDFDocument(url: URL(fileURLWithPath: filePath))
-                if let pdf = CPDFDocument(url: URL(fileURLWithPath: filePath)) {
-                    if !pdf.allowsPrinting || !pdf.allowsCopying {
-                        let alert = NSAlert()
-                        alert.alertStyle = .critical
-                        alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
-                        alert.runModal()
-                        continue
-                    } else if document?.isLocked ?? false {
-                        lockFilePathArr?.add(filePath)
-                    } else {
-                        let file = KMBatchOperateFile(filePath: filePath, type: self.type!)
-                        if !(self.files.contains(file) ) {
-                            insertArray.add(file)
+                if filePath.hasSuffix(".pdf") || filePath.hasSuffix(".PDF") {
+                    let document = CPDFDocument(url: URL(fileURLWithPath: filePath))
+                    if let pdf = CPDFDocument(url: URL(fileURLWithPath: filePath)) {
+                        if !pdf.allowsPrinting || !pdf.allowsCopying {
+                            let alert = NSAlert()
+                            alert.alertStyle = .critical
+                            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+                            alert.runModal()
+                            continue
+                        } else if document?.isLocked ?? false {
+                            lockFilePathArr?.add(filePath)
+                        } else {
+                            let file = KMBatchOperateFile(filePath: filePath, type: self.type!)
+                            if !(self.files.contains(file) ) {
+                                insertArray.add(file)
+                            }
                         }
                     }
+                } else {
+                    let file = KMBatchOperateFile(filePath: filePath, type: self.type!)
+                    if !(self.files.contains(file) ) {
+                        insertArray.add(file)
+                    }
+                }
+            }
+            if !(IAPProductsManager.default().isAvailableAllFunction)() {
+                if self.files.count < 1 {
+                    insertArray = [insertArray.first].compactMap { $0 } as! NSMutableArray
+                } else {
+                    KMPurchaseCompareWindowController.sharedInstance().showWindow(nil)
+                    return false
                 }
             }
-            //        if !(IAPProductsManager.defaultManager.isAvailableAllFunction) {
-//            if self.files.count < 1 {
-//                insertArray = [insertArray.first].compactMap { $0 } as! NSMutableArray
-//            } else {
-//                //                KMPurchaseCompareWindowController.sharedInstance.showWindow(nil)
-//                return false
-//            }
-            //        }
             for i in 0..<insertArray.count {
                 self.files.insert(insertArray[i] as! KMBatchOperateFile, at: row + i)
             }