Explorar el Código

综合 - 在导入文件的时候建议自动过滤非PDF文档导入;

zhudongyong hace 1 año
padre
commit
37f6482cb7

BIN
KdanAutoTest/KdanAuto.xcodeproj/project.xcworkspace/xcuserdata/zhudongyong.xcuserdatad/UserInterfaceState.xcuserstate


+ 6 - 1
KdanAutoTest/KdanAuto/Class/Norrmal/AutoTestAdvanceSettingView.swift

@@ -269,7 +269,8 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
                 // 文件夹
                 let subpaths = try! FileManager.default.subpathsOfDirectory(atPath: path)
                 for subpath in subpaths {
-                    if NSString(string: subpath).contains(".DS_Store") {
+                    if (NSString(string: subpath).contains(".DS_Store") ||
+                        !NSArray(array: ["PDF", "pdf"]).contains(NSString(string: subpath).pathExtension)) {
                         continue
                     }
                     let nPath = NSString(string: path).appendingPathComponent(subpath)
@@ -282,6 +283,10 @@ class AutoTestAdvanceSettingView : NSView, NSTableViewDataSource, NSTableViewDel
                     createSymbolicLink(nPath, toDirectory: NSString(string: resultPath).deletingLastPathComponent)
                 }
             }else {
+                if  !NSArray(array: ["PDF", "pdf"]).contains(NSString(string: path).pathExtension) {
+                    return
+                }
+                
                 let resultPath = NSString(string: toDirectory).appendingPathComponent(NSString(string: path).lastPathComponent)
                 let directory = NSString(string: resultPath).deletingLastPathComponent
                 

+ 0 - 1
KdanAutoTest/KdanAuto/Class/Setting/SettingViewController.swift

@@ -87,7 +87,6 @@ class SettingViewController : NSViewController, NSTextFieldDelegate, NSWindowDel
             DataModel.shared.setDirectoryPath(path!);
             self.originPathTF.stringValue = path!;
         }
-        
     }
     
     @IBAction func sdkChangeAction(_ sender:NSButton) {

+ 26 - 0
KdanAutoTest/KdanAuto/ViewController.swift

@@ -88,6 +88,32 @@ class ViewController : NSViewController, SettingViewControllerDelegate, AutoTest
         DispatchQueue.main.async {
             self.view.window?.title = "KdanAuto:"+CPDFConvertKit.sharedInstance().versionString
         }
+        
+//        DispatchQueue.global().async {
+//            let path = "/Users/zhudongyong/Desktop/Report_image";
+//
+//            let items = FileManager.default.subpaths(atPath: path)
+//
+//            let semaphore = DispatchSemaphore(value: 20)
+//            for item in items! {
+//                if NSString(string: item as! String).contains("_CPU.png") {
+//                    let checkPath = path.appending("/\(item)")
+//                    let nName = NSString(string: item).replacingOccurrences(of: "_CPU", with: "_GPU")
+//                    let resultPath = path.appending("/\(nName)")
+//                    let index = items!.firstIndex(of: item);
+//                    let progress = 100 * Float(index!)/Float(items!.count)
+//
+//                    semaphore.wait()
+//                    DispatchQueue.global().async {
+//                        let degree = ImageProcess.compareJPEG(resultPath, checkPath: checkPath, processCover: false)
+//                        if (degree != 100) {
+//                            NSLog("[\(degree)][\(progress)]\(nName)");
+//                        }
+//                        semaphore.signal()
+//                    }
+//                }
+//            }
+//        }
     }
     
     override func awakeFromNib() {