Exemplo n.º 1
0
    Dictionary <string, ClassDefinition> CombineDefinitions(Dictionary <string, ClassDefinition> k1Base, Dictionary <string, ClassDefinition> tslBase,
                                                            Dictionary <string, ClassDefinition> k1Saves, Dictionary <string, ClassDefinition> tslSaves)
    {
        Dictionary <string, ClassDefinition> defs = new Dictionary <string, ClassDefinition>();

        HashSet <string> baseTypes = new HashSet <string>();

        baseTypes.UnionWith(k1Base.Keys);
        baseTypes.UnionWith(tslBase.Keys);
        baseTypes.UnionWith(k1Saves.Keys);
        baseTypes.UnionWith(tslSaves.Keys);

        foreach (string defName in baseTypes)
        {
            ClassDefinition k1BaseDef  = k1Base.ContainsKey(defName) ? k1Base[defName] : null;
            ClassDefinition tslBaseDef = tslBase.ContainsKey(defName) ? tslBase[defName] : null;
            ClassDefinition k1SaveDef  = k1Saves.ContainsKey(defName) ? k1Saves[defName] : null;
            ClassDefinition tslSaveDef = tslSaves.ContainsKey(defName) ? tslSaves[defName] : null;

            ClassDefinition def = new ClassDefinition();
            def.CreateDefinition(k1BaseDef, tslBaseDef, k1SaveDef, tslSaveDef);

            defs[defName] = def;
        }

        return(defs);
    }