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

*AllFields now reads/writes members in alphabetical order

This commit is contained in:
lidgren
2010-05-09 08:36:39 +00:00
parent c1f8eff04b
commit 421a4675c9
3 changed files with 83 additions and 9 deletions

View File

@@ -537,7 +537,7 @@ namespace Lidgren.Network
}
/// <summary>
/// Writes all public and private declared instance fields of the object in declaration order using reflection
/// Writes all public and private declared instance fields of the object in alphabetical order using reflection
/// </summary>
public void WriteAllFields(object ob)
{
@@ -545,7 +545,7 @@ namespace Lidgren.Network
}
/// <summary>
/// Writes all fields with specified binding in declaration order using reflection
/// Writes all fields with specified binding in alphabetical order using reflection
/// </summary>
public void WriteAllFields(object ob, BindingFlags flags)
{
@@ -554,6 +554,8 @@ namespace Lidgren.Network
Type tp = ob.GetType();
FieldInfo[] fields = tp.GetFields(flags);
NetIncomingMessage.SortMembersList(fields);
foreach (FieldInfo fi in fields)
{
object value = fi.GetValue(ob);
@@ -568,7 +570,7 @@ namespace Lidgren.Network
}
/// <summary>
/// Writes all public and private declared instance properties of the object in declaration order using reflection
/// Writes all public and private declared instance properties of the object in alphabetical order using reflection
/// </summary>
public void WriteAllProperties(object ob)
{
@@ -576,7 +578,7 @@ namespace Lidgren.Network
}
/// <summary>
/// Writes all properties with specified binding in declaration order using reflection
/// Writes all properties with specified binding in alphabetical order using reflection
/// </summary>
public void WriteAllProperties(object ob, BindingFlags flags)
{
@@ -585,6 +587,8 @@ namespace Lidgren.Network
Type tp = ob.GetType();
PropertyInfo[] fields = tp.GetProperties(flags);
NetIncomingMessage.SortMembersList(fields);
foreach (PropertyInfo fi in fields)
{
MethodInfo getMethod = fi.GetGetMethod((flags & BindingFlags.NonPublic) == BindingFlags.NonPublic);