-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathX9ImageField.cs
59 lines (53 loc) · 1.44 KB
/
X9ImageField.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
using CompAnalytics.Contracts;
using System;
using System.Runtime.Serialization;
namespace CompAnalytics.X9
{
[DataContract]
[Serializable]
public class X9ImageField : X9Field
{
byte[] Value { get; set; }
[DataMember]
public FileReference Image { get; set; }
public X9ImageField(X9FieldType fieldType) : base(fieldType) { }
public void SetImageBytes(byte[] val)
{
this.Value = (byte[])val.Clone();
}
public byte[] GetImageBytes()
{
return this.Value;
}
public bool Equals(X9ImageField that)
{
if (this.Value != null && that.Value != null)
{
if (this.Value.Length != that.Value.Length)
{
return false;
}
else
{
for (int i = 0; i < this.Value.Length; i++)
{
if (this.Value[i] != that.Value[i])
{
return false;
}
}
return true;
}
}
else
{
// Rubber stamp if we don't have access to the files
return true;
}
}
public override string ToString()
{
return $"{this.FieldType.Name}";
}
}
}