Пример #1
0
        public TypeMapper(List <string> typeDatabasePaths, UnicodeMapper unicodeMapper)
        {
            TypeDatabase       = new TypeDatabase();
            this.unicodeMapper = unicodeMapper;

            // We check 'SwiftyOptions' for errors so each 'typeDatabasePath' at this point should be a valid directory.
            foreach (var typeDatabasePath in typeDatabasePaths)
            {
                if (Directory.Exists(typeDatabasePath))
                {
                    foreach (string fileName in Directory.GetFiles(typeDatabasePath))
                    {
                        AddTypeDatabase(fileName);
                    }
                }
                else if (File.Exists(typeDatabasePath))
                {
                    AddTypeDatabase(typeDatabasePath);
                }
            }

            specMapper         = new TypeSpecToSLType(this, false);
            overrideSpecMapper = new TypeSpecToSLType(this, true);
            swiftTypeMapper    = new SwiftTypeToSLType(this);
        }
        public bool Merge(TypeDatabase other, ErrorHandling errors)
        {
            var initialErrorCount = errors.ErrorCount;

            foreach (var mod in other.modules.Values)
            {
                foreach (var entity in mod.Values)
                {
                    AddEntity(entity, errors);
                }
            }
            return(initialErrorCount != errors.ErrorCount);
        }