|
|
@ -1359,23 +1359,31 @@ namespace CppSharp.Generators.CSharp |
|
|
|
private void GenerateNativeConstructor(Class @class) |
|
|
|
private void GenerateNativeConstructor(Class @class) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PushBlock(CSharpBlockKind.Method); |
|
|
|
PushBlock(CSharpBlockKind.Method); |
|
|
|
WriteLine("internal {0}({1}.Internal* native)", SafeIdentifier(@class.Name), |
|
|
|
string className = @class.Name; |
|
|
|
@class.Name); |
|
|
|
string safeIdentifier = SafeIdentifier(className); |
|
|
|
|
|
|
|
if (@class.Access == AccessSpecifier.Private && |
|
|
|
|
|
|
|
className.EndsWith("Internal")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
className = className.Substring(0, |
|
|
|
|
|
|
|
safeIdentifier.LastIndexOf("Internal", StringComparison.Ordinal)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
WriteLine("internal {0}({1}.Internal* native)", safeIdentifier, |
|
|
|
|
|
|
|
className); |
|
|
|
WriteLineIndent(": this(new global::System.IntPtr(native))"); |
|
|
|
WriteLineIndent(": this(new global::System.IntPtr(native))"); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteCloseBraceIndent(); |
|
|
|
WriteCloseBraceIndent(); |
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
|
|
|
|
|
|
|
|
PushBlock(CSharpBlockKind.Method); |
|
|
|
PushBlock(CSharpBlockKind.Method); |
|
|
|
WriteLine("internal {0}({1}.Internal native)", SafeIdentifier(@class.Name), |
|
|
|
WriteLine("internal {0}({1}.Internal native)", safeIdentifier, |
|
|
|
@class.Name); |
|
|
|
className); |
|
|
|
WriteLineIndent(": this(&native)"); |
|
|
|
WriteLineIndent(": this(&native)"); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteCloseBraceIndent(); |
|
|
|
WriteCloseBraceIndent(); |
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
|
|
|
|
|
|
|
|
PushBlock(CSharpBlockKind.Method); |
|
|
|
PushBlock(CSharpBlockKind.Method); |
|
|
|
WriteLine("internal {0}(global::System.IntPtr native){1}", SafeIdentifier(@class.Name), |
|
|
|
WriteLine("internal {0}(global::System.IntPtr native){1}", safeIdentifier, |
|
|
|
@class.IsValueType ? " : this()" : string.Empty); |
|
|
|
@class.IsValueType ? " : this()" : string.Empty); |
|
|
|
|
|
|
|
|
|
|
|
var hasBaseClass = @class.HasBaseClass && @class.BaseClass.IsRefType; |
|
|
|
var hasBaseClass = @class.HasBaseClass && @class.BaseClass.IsRefType; |
|
|
|