Duplicate File Locator 1.0
Loading...
Searching...
No Matches
DuplicatedImage.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
7using Newtonsoft.Json;
8
9namespace ProofOfConcept
10{
11 public class DuplicatedImage
12 {
13 private string _hash;
14 private string _originalPath;
15 private List<string> _duplicateImages;
16
17 [JsonProperty("Hash")]
18 public string Hash
19 {
20 get { return _hash; }
21 private set { _hash = value; }
22 }
23
24 [JsonProperty("OriginalPath")]
25 public string OriginalPath
26 {
27 get { return _originalPath; }
28 set { _originalPath = value; }
29 }
30
31 [JsonProperty("DuplicateImages")]
32 public List<string> DuplicateImages
33 {
34 get { return _duplicateImages; }
35 }
36
38 {
39 _hash = string.Empty;
40 _originalPath = string.Empty;
41 _duplicateImages = new List<string>();
42 }
43
44 public DuplicatedImage(string hash) : this()
45 {
46 _hash = hash;
47 }
48
49 public DuplicatedImage(string hash, string duplicatePath) : this(hash)
50 {
51 DuplicateImages.Add(duplicatePath);
52 }
53
54 [JsonConstructor]
55 public DuplicatedImage(string hash, string originalPath, List<string> duplicateImages) : this(hash)
56 {
57 _originalPath = originalPath;
58 _duplicateImages = duplicateImages;
59 }
60
61 public void AddDuplicate(string path)
62 {
63 if (!_duplicateImages.Contains(path))
64 _duplicateImages.Add(path);
65 }
66
67 public override string ToString()
68 {
69 string output = "Hash : " + _hash + "\nOriginal : " + _originalPath + "\nDuplicates : \n";
70 foreach (string image in _duplicateImages)
71 {
72 output += "\t\t" + image + "\n";
73 }
74 return output;
75 }
76 }
77}
DuplicatedImage(string hash, string originalPath, List< string > duplicateImages)
DuplicatedImage(string hash, string duplicatePath)