mirror of
https://github.com/LukeFZ/Il2CppInspectorRedux.git
synced 2026-01-03 00:59:40 +05:00
Model: UnmangledBaseName / CSharpSafeName refactoring (#70)
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Il2CppInspector.Reflection {
|
||||
public virtual string Name { get; protected set; }
|
||||
|
||||
// Name of the member with @ prepended if the name is a C# reserved keyword
|
||||
public string CSharpSafeName => Constants.Keywords.Contains(Name) ? "@" + Name : Name;
|
||||
public virtual string CSharpName => Constants.Keywords.Contains(Name) ? "@" + Name : Name;
|
||||
|
||||
// For top-level members in an assembly (ie. non-nested types)
|
||||
protected MemberInfo(Assembly asm) => Assembly = asm;
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Il2CppInspector.Reflection
|
||||
return image.ReadMappedBytes(VirtualAddress.Value.Start, (int) (VirtualAddress.Value.End - VirtualAddress.Value.Start));
|
||||
}
|
||||
|
||||
public string CSharpName =>
|
||||
public override string CSharpName =>
|
||||
// Operator overload or user-defined conversion operator
|
||||
OperatorMethodNames.ContainsKey(Name)? "operator " + OperatorMethodNames[Name]
|
||||
|
||||
|
||||
@@ -31,14 +31,14 @@ namespace Il2CppInspector.Reflection {
|
||||
|
||||
public override string Name { get; protected set; }
|
||||
|
||||
public string CSharpName {
|
||||
public override string CSharpName {
|
||||
get {
|
||||
// Explicit interface implementation
|
||||
if (DeclaringType.ImplementedInterfaces
|
||||
.FirstOrDefault(i => CSharpSafeName.IndexOf("." + i.CSharpName, StringComparison.Ordinal) != -1) is TypeInfo @interface)
|
||||
return CSharpSafeName.Substring(CSharpSafeName.IndexOf("." + @interface.CSharpName, StringComparison.Ordinal) + 1);
|
||||
.FirstOrDefault(i => Name.IndexOf("." + i.CSharpName, StringComparison.Ordinal) != -1) is TypeInfo @interface)
|
||||
return Name.Substring(Name.IndexOf("." + @interface.CSharpName, StringComparison.Ordinal) + 1);
|
||||
|
||||
// Regular method
|
||||
// Regular property
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,10 +298,10 @@ namespace Il2CppInspector.Reflection
|
||||
}
|
||||
|
||||
// Get rid of generic backticks
|
||||
public string UnmangledBaseName => unmangleName(base.Name);
|
||||
public string CSharpBaseName => unmangleName(base.Name);
|
||||
|
||||
// C# colloquial name of the type (if available)
|
||||
public string CSharpName {
|
||||
public override string CSharpName {
|
||||
get {
|
||||
if (HasElementType) {
|
||||
var n = ElementType.CSharpName;
|
||||
|
||||
Reference in New Issue
Block a user