예제 #1
0
        /// <summary>
        /// Create Project from system known data
        /// </summary>
        /// <param name="inProject"></param>
        /// <param name="inAliasList"></param>
        /// <param name="inSystemNamespace"></param>
        public static void MapLanguageNames(ProjectInformation inProjectInfo, List <LanguageMappingObject> inLanguageMapping)
        {
            var tmpMappingByFullName = new Dictionary <string, List <LanguageMappingObject> >();

            foreach (var tmpMap in inLanguageMapping)
            {
                tmpMappingByFullName.Add(tmpMap.Source.Namespace + "." + tmpMap.Source.ClassName, tmpMap);
            }

            foreach (var tmpClass in inProjectInfo.ClassList)
            {
                if (tmpMappingByFullName.TryGetValue(tmpClass.Namespace + "." + tmpClass.Name, out var tmpMapList))
                {
                    //If there is a mapping for a spezific Class, we need to apply it
                    foreach (var tmpMap in tmpMapList)
                    {
                        if (tmpMap.Source.IsMethodeMapping())
                        {
                            //Apply all Methode renamings that need to be applied
                            foreach (var tmpMethode in tmpClass.MethodeList)
                            {
                                if (tmpMethode.Name == tmpMap.Source.MethodeName)
                                {
                                    tmpMethode.Name       = tmpMap.Target.MethodeName;
                                    tmpMethode.IsProperty = tmpMap.Target.MethodeAsProperty;
                                }
                            }
                        }
                        else if (tmpMap.Source.IsClassMapping())
                        {
                            tmpClass.Namespace      = tmpMap.Target.Namespace;
                            tmpClass.Type.Type.Name = tmpMap.Target.ClassName;
                            tmpClass.Type.Name      = tmpMap.Target.ClassName;
                            inProjectInfo.AddToDictionaryWithNewName(tmpClass);
                        }
                    }
                }
            }
        }