     
     @IBOutlet weak var noticeTextField: NSTextField!
     var open: NSOpenPanel!
+    let alert = NSAlert();
     
     override func viewDidLoad() {
         super.viewDidLoad()
+        
         typeSelection.removeAllItems()
         typeSelection.addItems(withTitles: ["加密", "解密"])
+        
         encryptionModeSelection.removeAllItems()
         encryptionModeSelection.addItem(withTitle: "ECB")
+        
         passwordTextField.placeholderString = "0000000000000000"
+        
         paddingTypeSelection.removeAllItems()
         paddingTypeSelection.addItem(withTitle: "PKCS5")
+        
         indicator.isHidden = true;
+        
+        alert.alertStyle = NSAlertStyle.warning;
+        alert.messageText = "错误！";
         
     }
     

        let outputFilePath = outputFilePathTextField.stringValue
        let hexKey = passwordTextField.stringValue
        
        if !FileManager.default.fileExists(atPath: inputFilePath) {
            
        }
        
        startButton.isEnabled = false

        }
    }
    
    func isDirectoryValid(key: String) -> Bool {
        let range = key.range(of: "/", options: String.CompareOptions.backwards, range: nil, locale: Locale.current)
        if range == nil {
            return false;
        }
        let directory = key.substring(to: (range?.lowerBound)!)
        return FileManager.default.fileExists(atPath: directory)
    }
    
    func isKeyValid(key: String) -> Bool {
        if (key.utf8.count != 16) {
            return false
        }
        for a:Character in key.characters {
            if (a < "a" || a > "f") && (a < "A" || a > "F") && (a < "0" || a > "9") {
                return false
            }
        }
        return true
    }
    
    func onTaskStart(encrypt: Bool) -> Void {
        noticeTextField.stringValue = encrypt ? "正在加密..." : "正在解密..."
