-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSharedTypes.ps1
More file actions
65 lines (56 loc) · 1.69 KB
/
SharedTypes.ps1
File metadata and controls
65 lines (56 loc) · 1.69 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
<#
.SYNOPSIS
.DESCRIPTION
#>
Add-Type -TypeDefinition @"
using System.IO;
namespace NI
{
public enum ChangeType
{
Added,
Removed,
Modified,
Unclassified,
}
public class ChangedFile
{
public ChangedFile(string repositoryPath, string diffLine)
{
var parts = diffLine.Split('\t');
var code = parts[0];
this.Path = System.IO.Path.Combine(repositoryPath, parts[1]);
this.ChangeType = GetChangeTypeForCode(code);
}
public string Path { get; private set; }
public ChangeType ChangeType { get; private set; }
private ChangeType GetChangeTypeForCode(string code)
{
switch (code) {
case "A":
return ChangeType.Added;
case "D":
return ChangeType.Removed;
case "M":
return ChangeType.Modified;
default:
return ChangeType.Unclassified;
}
}
}
public class ImageDiff
{
public ImageDiff(string beforeImagePath, string afterImagePath)
{
this.BeforeImagePath = beforeImagePath;
this.AfterImagePath = afterImagePath;
this.BeforeImageName = Path.GetFileNameWithoutExtension(BeforeImagePath);
this.AfterImageName = Path.GetFileNameWithoutExtension(AfterImagePath);
}
public string BeforeImagePath { get; private set; }
public string AfterImagePath { get; private set; }
public string BeforeImageName { get; private set; }
public string AfterImageName { get; private set; }
}
}
"@