-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some Features/Fixes #28
Conversation
Thank you for your contribution! For now I've noticed that you've used the Maybe I should write to contribution.md about which branches it's worth creating your own features from |
# Conflicts: # GeometryDashAPI/Serialization/TypeDescriptor.cs # GeometryDashAPI/Server/Dtos/Account.cs # GeometryDashAPI/Server/GameClient.cs
because TypeDescriptor can cast enums itself
foreach (var field in type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)) | ||
yield return field; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rollback this, because GetFields
doesn't return private fields from inherited classes
Also added test for this TypeDescriptorTests.PrivateFieldFromInheritedClass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, i see, i thought private field form base class can be found using GetFieds(NonPublic)
, my mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s ok, I thought too at first time xd
becuase GetFields doesn't return private fields from inherited classes
I've finished |
Yeah, tnx for your changes, now all looks great. i also changed linq expression by a usefull flag, should work faster |
Oh, great! You're right about performance, it's almost 2x faster!
class A
{
protected int X;
}
class B : A
{
protected int Y;
}
[MemoryDiagnoser]
public class GetFieldsBenchmarks
{
private Consumer c = new Consumer();
[Benchmark]
public void BindingFlag()
{
typeof(B).GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly).Consume(c);
}
[Benchmark]
public void Linq()
{
typeof(B).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(x => x.DeclaringType == typeof(B)).Consume(c);
}
} |
Released in v0.2.19 |
IReadOnlyCollection
instead ofIEnumerable
inLocalLevels
MultiTrigger
property forTouch
andSpawn
triggers (also idk aboutIgnoreField
, i think it can be deleted)GameModeratorType
for readability inAccount
classI also changed logic in typedescriptor,
GetPropertiesAndFields
, for old logic fields in inherited classes werent work properly, the logic in my pr works fine for that, but I still could be wrong