Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Aggregate()

override object System.Data.Common.DateTimeStorage.Aggregate ( int[] records,
AggregateType kind )
inlinevirtual

Reimplemented from System.Data.Common.DataStorage.

Definition at line 18 of file DateTimeStorage.cs.

19 {
20 bool flag = false;
21 try
22 {
23 switch (kind)
24 {
25 case AggregateType.Min:
26 {
27 DateTime dateTime2 = DateTime.MaxValue;
28 foreach (int num3 in records)
29 {
30 if (HasValue(num3))
31 {
32 dateTime2 = ((DateTime.Compare(_values[num3], dateTime2) < 0) ? _values[num3] : dateTime2);
33 flag = true;
34 }
35 }
36 if (flag)
37 {
38 return dateTime2;
39 }
40 return _nullValue;
41 }
42 case AggregateType.Max:
43 {
44 DateTime dateTime = DateTime.MinValue;
45 foreach (int num2 in records)
46 {
47 if (HasValue(num2))
48 {
49 dateTime = ((DateTime.Compare(_values[num2], dateTime) >= 0) ? _values[num2] : dateTime);
50 flag = true;
51 }
52 }
53 if (flag)
54 {
55 return dateTime;
56 }
57 return _nullValue;
58 }
59 case AggregateType.First:
60 if (records.Length != 0)
61 {
62 return _values[records[0]];
63 }
64 return null;
65 case AggregateType.Count:
66 {
67 int num = 0;
68 for (int i = 0; i < records.Length; i++)
69 {
70 if (HasValue(records[i]))
71 {
72 num++;
73 }
74 }
75 return num;
76 }
77 }
78 }
79 catch (OverflowException)
80 {
81 throw ExprException.Overflow(typeof(DateTime));
82 }
83 throw ExceptionBuilder.AggregateException(kind, _dataType);
84 }
bool HasValue(int recordNo)

References System.Data.Common.DataStorage._dataType, System.Data.Common.DataStorage._nullValue, System.Data.Common.DateTimeStorage._values, System.Data.ExceptionBuilder.AggregateException(), System.DateTime.Compare(), System.Xml.Dictionary, System.Data.Common.DataStorage.HasValue(), System.DateTime.MaxValue, System.DateTime.MinValue, and System.Data.ExprException.Overflow().