From 5b6a19a0c47e01c1c90c70712b8785cf93cec8b1 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Fri, 4 Nov 2016 16:42:15 +0200 Subject: [PATCH] Handled more possible names for type maps when generating the mapped class itself. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CSharp/CSharpSources.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 796db19d..be923f42 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -434,11 +434,17 @@ namespace CppSharp.Generators.CSharp GenerateClassTemplateSpecializationInternal(nestedTemplate); System.Type typeMap = null; - if (Context.TypeMaps.TypeMaps.ContainsKey(@class.Name)) + string key = string.Empty; + foreach (var name in new[] { @class.OriginalName, @class.QualifiedOriginalName }) { - typeMap = Context.TypeMaps.TypeMaps[@class.Name]; - // disable the type map for the mapped class itself so that operator params are not mapped - Context.TypeMaps.TypeMaps.Remove(@class.Name); + if (Context.TypeMaps.TypeMaps.ContainsKey(name)) + { + key = name; + typeMap = Context.TypeMaps.TypeMaps[key]; + // disable the type map for the mapped class itself so that operator params are not mapped + Context.TypeMaps.TypeMaps.Remove(key); + break; + } } PushBlock(CSharpBlockKind.Class); @@ -503,7 +509,7 @@ namespace CppSharp.Generators.CSharp PopBlock(NewLineKind.BeforeNextBlock); if (typeMap != null) - Context.TypeMaps.TypeMaps.Add(@class.Name, typeMap); + Context.TypeMaps.TypeMaps.Add(key, typeMap); } private void GenerateInterface(Class @class)