Skip to content

Commit deda3c5

Browse files
committed
Modified sorting code to allow for layered sorting
Finalized everything Perfect read write xml and binary Sorting for everything that needs it
1 parent f095ca1 commit deda3c5

225 files changed

Lines changed: 910 additions & 391 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ESPSharp/DataTypes/GeneratedCode/AlternateTexture.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,16 @@ public object Clone()
9999

100100
public int CompareTo(AlternateTexture other)
101101
{
102-
return Index.CompareTo(other.Index);
103-
}
102+
int result = 0;
103+
104+
if (result == 0 && Name != null && other.Name != null)
105+
result = Name.CompareTo(other.Name);
106+
107+
if (result == 0 && Index != null && other.Index != null)
108+
result = Index.CompareTo(other.Index);
109+
110+
return result;
111+
}
104112

105113
public static bool operator >(AlternateTexture objA, AlternateTexture objB)
106114
{

ESPSharp/DataTypes/GeneratedCode/AlternateTexture.tt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<#
22
ClassTemplate template = new ClassTemplate();
33
template.ClassName = "AlternateTexture";
4-
//template.implementReadData = false;
5-
//template.implementWriteData = false;
64

75
ClassField tempField;
86

@@ -12,6 +10,7 @@
1210
"Name",
1311
"Name"
1412
);
13+
tempField.sortIndex = 0;
1514
tempField.implementReadData = false;
1615
tempField.implementWriteData = false;
1716
template.Fields.Add(tempField);
@@ -30,6 +29,7 @@
3029
"Index",
3130
"Index"
3231
);
32+
tempField.sortIndex = 1;
3333
template.hashKey = tempField;
3434
template.Fields.Add(tempField);
3535
#>

ESPSharp/DataTypes/GeneratedCode/Color.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ public object Clone()
109109

110110
public int CompareTo(Color other)
111111
{
112-
return Red.CompareTo(other.Red);
113-
}
112+
int result = 0;
113+
114+
return result;
115+
}
114116

115117
public static bool operator >(Color objA, Color objB)
116118
{

ESPSharp/DataTypes/GeneratedCode/DataTypeTemplate.t4

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,15 @@ namespace ESPSharp.DataTypes
9595
<# if(template.isComparable) { #>
9696
public int CompareTo(<#= template.ClassName #> other)
9797
{
98-
<# WriteCompareHashKeyCommand(template); #>
99-
}
98+
int result = 0;
99+
<# foreach (var field in template.Fields.Where(f => f.sortIndex >= 0).OrderBy(o => o.sortIndex)) { #>
100+
101+
if (result == 0 && <#= field.Name#> != null && other.<#= field.Name#> != null)
102+
<# WriteCompareCommand(field); #>
103+
<# } #>
104+
105+
return result;
106+
}
100107

101108
public static bool operator >(<#= template.ClassName #> objA, <#= template.ClassName #> objB)
102109
{

ESPSharp/DataTypes/GeneratedCode/DateStamp.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ public object Clone()
8585

8686
public int CompareTo(DateStamp other)
8787
{
88-
return MonthsSince2001.CompareTo(other.MonthsSince2001);
89-
}
88+
int result = 0;
89+
90+
return result;
91+
}
9092

9193
public static bool operator >(DateStamp objA, DateStamp objB)
9294
{

ESPSharp/DataTypes/GeneratedCode/FormID.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,13 @@ public object Clone()
7171

7272
public int CompareTo(FormID other)
7373
{
74-
return RawValue.CompareTo(other.RawValue);
75-
}
74+
int result = 0;
75+
76+
if (result == 0 && RawValue != null && other.RawValue != null)
77+
result = RawValue.CompareTo(other.RawValue);
78+
79+
return result;
80+
}
7681

7782
public static bool operator >(FormID objA, FormID objB)
7883
{

ESPSharp/DataTypes/GeneratedCode/FormID.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
tempField.implementReadXML = false;
1414
tempField.implementWriteXML = false;
1515
template.hashKey = tempField;
16+
tempField.sortIndex = 0;
1617
tempField.isReadOnly = true;
1718
template.Fields.Add(tempField);
1819
#>

ESPSharp/DataTypes/GeneratedCode/IMADTimeColor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ public object Clone()
121121

122122
public int CompareTo(IMADTimeColor other)
123123
{
124-
return Time.CompareTo(other.Time);
125-
}
124+
int result = 0;
125+
126+
return result;
127+
}
126128

127129
public static bool operator >(IMADTimeColor objA, IMADTimeColor objB)
128130
{

ESPSharp/DataTypes/GeneratedCode/IMADTimeValue.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ public object Clone()
8585

8686
public int CompareTo(IMADTimeValue other)
8787
{
88-
return Time.CompareTo(other.Time);
89-
}
88+
int result = 0;
89+
90+
return result;
91+
}
9092

9193
public static bool operator >(IMADTimeValue objA, IMADTimeValue objB)
9294
{

ESPSharp/DataTypes/GeneratedCode/NavMeshDoor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ public object Clone()
100100

101101
public int CompareTo(NavMeshDoor other)
102102
{
103-
return Door.CompareTo(other.Door);
104-
}
103+
int result = 0;
104+
105+
return result;
106+
}
105107

106108
public static bool operator >(NavMeshDoor objA, NavMeshDoor objB)
107109
{

0 commit comments

Comments
 (0)