1 |
using System; |
2 |
|
3 |
namespace Oni.Metadata |
4 |
{ |
5 |
internal class BinaryPartField : Field |
6 |
{ |
7 |
private string sizeFieldName; |
8 |
private int sizeMultiplier; |
9 |
private MetaType rawType; |
10 |
|
11 |
public BinaryPartField(MetaType offsetType, string name) |
12 |
: this(offsetType, name, null, 0) |
13 |
{ |
14 |
} |
15 |
|
16 |
public BinaryPartField(MetaType offsetType, string name, string sizeFieldName) |
17 |
: this(offsetType, name, sizeFieldName, 1) |
18 |
{ |
19 |
} |
20 |
|
21 |
public BinaryPartField(MetaType offsetType, string name, int size) |
22 |
: this(offsetType, name, null, size) |
23 |
{ |
24 |
} |
25 |
|
26 |
public BinaryPartField(MetaType offsetType, string name, int size, MetaType rawType) |
27 |
: this(offsetType, name, null, size, rawType) |
28 |
{ |
29 |
} |
30 |
|
31 |
public BinaryPartField(MetaType offsetType, string name, string sizeFieldName, int sizeMultiplier) |
32 |
: this(offsetType, name, sizeFieldName, sizeMultiplier, null) |
33 |
{ |
34 |
} |
35 |
|
36 |
public BinaryPartField(MetaType offsetType, string name, string sizeFieldName, int sizeMultiplier, MetaType rawType) |
37 |
: base(offsetType, name) |
38 |
{ |
39 |
if (offsetType != MetaType.RawOffset && offsetType != MetaType.SepOffset) |
40 |
throw new ArgumentException("Offset type can only be RawOffset or SepOffset", "offsetType"); |
41 |
|
42 |
this.sizeFieldName = sizeFieldName; |
43 |
this.sizeMultiplier = sizeMultiplier; |
44 |
this.rawType = rawType; |
45 |
} |
46 |
|
47 |
public string SizeFieldName => sizeFieldName; |
48 |
public int SizeMultiplier => sizeMultiplier; |
49 |
public MetaType RawType => rawType; |
50 |
} |
51 |
} |