-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetailViewController.swift
More file actions
74 lines (63 loc) · 2.24 KB
/
Copy pathDetailViewController.swift
File metadata and controls
74 lines (63 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// DetailViewController.swift
// SearchSploit GUI
//
// Created by Anaelle Saint-Jalm on 17/03/2018.
// Copyright © 2018 Home. All rights reserved.
//
import Cocoa
class DetailViewController: NSViewController {
@IBOutlet weak var titleField: NSTextField!
@IBOutlet weak var idField: NSTextField!
@IBOutlet weak var platformField: NSTextField!
@IBOutlet weak var typeField: NSTextField!
@IBOutlet weak var authorField: NSTextField!
@IBOutlet weak var dateField: NSTextField!
//@IBOutlet weak var pathControl: NSPathControl!
@IBOutlet weak var pathField: NSTextField!
@IBOutlet weak var urlField: NSTextField!
@IBOutlet weak var labelTB: NSTextField!
@IBOutlet weak var openButtonTB: NSButton!
@IBOutlet weak var browserButtonTB: NSButton!
var exploit: SearchSploit.Exploit?
override func viewWillAppear() {
prepareView()
}
override func viewWillDisappear() {
openButtonTB.isEnabled = false
browserButtonTB.isEnabled = false
}
override func viewDidLoad() {
super.viewDidLoad()
}
func prepareView() {
guard exploit != nil else {
self.dismiss(self)
return
}
titleField.stringValue = exploit?.title ?? ""
idField.stringValue = exploit?.id ?? ""
platformField.stringValue = exploit?.platform ?? ""
typeField.stringValue = exploit?.type ?? ""
authorField.stringValue = exploit?.author ?? ""
dateField.stringValue = exploit?.date ?? ""
//pathControl.stringValue = exploit?.path ?? ""
pathField.stringValue = exploit?.path ?? ""
urlField.stringValue = exploit?.url ?? ""
labelTB.stringValue = exploit?.title ?? "Error"
openButtonTB.isEnabled = true
browserButtonTB.isEnabled = true
}
@IBAction func openFile(_ sender: Any) {
guard exploit != nil else {
return
}
NSWorkspace().openFile((exploit?.path)!)
}
@IBAction func showBrowser(_ sender: Any) {
guard exploit != nil else {
return
}
NSWorkspace().open(URL(string: (exploit?.url)!)!)
}
}