C#: Fix indexer name corruption if length was not 4 characters
This commit is contained in:
@@ -438,9 +438,10 @@ namespace Il2CppInspector.Outputs
|
|||||||
|
|
||||||
// Indexer
|
// Indexer
|
||||||
else {
|
else {
|
||||||
// Replace "Item" with "this" - preserves explicit interface implementations
|
// Replace indexer name (usually "Item" but not always) with "this" - preserves explicit interface implementations
|
||||||
sb.Append(prop.CSharpName[..^4] + "this");
|
if (prop.CSharpName.IndexOf('.') != -1)
|
||||||
sb.Append("[" + string.Join(", ", primary.DeclaredParameters.SkipLast(getAccess >= setAccess ? 0 : 1)
|
sb.Append(prop.CSharpName.Substring(0, prop.CSharpName.IndexOf('.') + 1));
|
||||||
|
sb.Append("this[" + string.Join(", ", primary.DeclaredParameters.SkipLast(getAccess >= setAccess ? 0 : 1)
|
||||||
.Select(p => p.GetParameterString(scope, !SuppressMetadata, MustCompile))) + "] { ");
|
.Select(p => p.GetParameterString(scope, !SuppressMetadata, MustCompile))) + "] { ");
|
||||||
getBody = " => default;";
|
getBody = " => default;";
|
||||||
setBody = " {}";
|
setBody = " {}";
|
||||||
|
|||||||
Reference in New Issue
Block a user