-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileTreeItem.swift
More file actions
66 lines (54 loc) · 1.17 KB
/
Copy pathFileTreeItem.swift
File metadata and controls
66 lines (54 loc) · 1.17 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
//
// FileTreeItem.swift
// DeDup
//
import Cocoa
class FileTreeItem: NSObject {
let name: String
let fullPath: String
let fileHash: String
private let _items = 1
private var _duplicates = 0
init(name: String, fileHash: String, fullPath:String)
{
self.name = name
self.fileHash = fileHash
self.fullPath = fullPath
}
}
extension FileTreeItem: DuplicatesHandling
{
var items: Int {
get {
return _items
}
}
var duplicates: Int {
get {
return _duplicates
}
}
func refreshDuplicates(hashes: [String: [String]], filter: String)
{
self._duplicates = 0
let files = hashes[self.fileHash]!
if (files.count > 1)
{
if filter.isEmpty
{
self._duplicates = 1
}
else
{
for file in files
{
if file.contains(filter)
{
self._duplicates = 1
break
}
}
}
}
}
}