-
Notifications
You must be signed in to change notification settings - Fork 281
/
Copy pathCompareResult.cs
106 lines (93 loc) · 2.65 KB
/
CompareResult.cs
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
using Microsoft.CST.AttackSurfaceAnalyzer.Types;
using Microsoft.CST.OAT;
using System.Collections.Generic;
namespace Microsoft.CST.AttackSurfaceAnalyzer.Objects
{
public class CompareResult
{
public CompareResult()
{
}
public ANALYSIS_RESULT_TYPE Analysis { get; set; }
public CollectObject? Base { get; set; }
public string? BaseRunId { get; set; }
public CHANGE_TYPE ChangeType
{
get
{
if (Base != null)
{
if (Compare != null)
{
return CHANGE_TYPE.MODIFIED;
}
else
{
return CHANGE_TYPE.DELETED;
}
}
else
{
if (Compare != null)
{
return CHANGE_TYPE.CREATED;
}
else
{
return CHANGE_TYPE.INVALID;
}
}
}
}
public CollectObject? Compare { get; set; }
public string? CompareRunId { get; set; }
public List<Diff> Diffs { get; set; } = new List<Diff>();
public string Identity
{
get
{
if (Base is CollectObject colObj)
{
return colObj.Identity;
}
else if (Compare is CollectObject colObj2)
{
return colObj2.Identity;
}
else
{
return string.Empty;
}
}
}
public RESULT_TYPE ResultType
{
get
{
if (Base is CollectObject colObj)
{
return colObj.ResultType;
}
else if (Compare is CollectObject colObj2)
{
return colObj2.ResultType;
}
else
{
return RESULT_TYPE.UNKNOWN;
}
}
}
public List<Rule> Rules { get; set; } = new List<Rule>();
public string AnalysesHash { get; set; } = string.Empty;
public bool ShouldSerializeDiffs()
{
return Diffs?.Count > 0;
}
public bool ShouldSerializeRules()
{
return Rules?.Count > 0;
}
}
}