1
0
mirror of https://github.com/lidgren/lidgren-network-gen3.git synced 2026-05-14 14:16:30 +09:00

major update; gen 3.5

This commit is contained in:
lidgren
2010-10-19 17:45:55 +00:00
parent baaa5926f8
commit 609bc1afe2
167 changed files with 4065 additions and 9640 deletions

View File

@@ -41,7 +41,7 @@ namespace Lidgren.Network
Type tp = target.GetType();
FieldInfo[] fields = tp.GetFields(flags);
SortMembersList(fields);
NetUtility.SortMembersList(fields);
foreach (FieldInfo fi in fields)
{
@@ -81,7 +81,7 @@ namespace Lidgren.Network
Type tp = target.GetType();
PropertyInfo[] fields = tp.GetProperties(flags);
SortMembersList(fields);
NetUtility.SortMembersList(fields);
foreach (PropertyInfo fi in fields)
{
object value;
@@ -99,44 +99,5 @@ namespace Lidgren.Network
}
}
}
// shell sort
internal static void SortMembersList(MemberInfo[] list)
{
int h;
int j;
MemberInfo tmp;
h = 1;
while (h * 3 + 1 <= list.Length)
h = 3 * h + 1;
while (h > 0)
{
for (int i = h - 1; i < list.Length; i++)
{
tmp = list[i];
j = i;
while (true)
{
if (j >= h)
{
if (string.Compare(list[j - h].Name, tmp.Name, StringComparison.InvariantCulture) > 0)
{
list[j] = list[j - h];
j -= h;
}
else
break;
}
else
break;
}
list[j] = tmp;
}
h /= 3;
}
}
}
}