Exemplo n.º 1
0
        public static NamedDefinitionDictionary <ObjectFileDefinition> Load(string basePath,
                                                                            HashedDefinitionDictionary <ClassDefinition>
                                                                            classDefs)
        {
            var raws  = LoaderHelper.Load <Raw.ObjectFileDefinition>(GetObjectFilePaths(basePath));
            var defs  = new List <ObjectFileDefinition>();
            var names = new List <string>();

            foreach (var raw in raws)
            {
                if (raw.Aliases.Any(alias => names.Contains(alias) == true))
                {
                    throw new LoadException(string.Format("duplicate binary object file '{0}'", raw.Name));
                }

                defs.Add(LoadObjectFileDefinition(raw, classDefs));
                names.AddRange(raw.Aliases);
            }
            return(new NamedDefinitionDictionary <ObjectFileDefinition>(defs));
        }
Exemplo n.º 2
0
        public static HashedDefinitionDictionary <ClassDefinition> Load(string basePath)
        {
            var raws = LoaderHelper.Load <Raw.ClassDefinition>(GetClassDefinitionPaths(basePath));

            var pairs = new Dictionary <Raw.ClassDefinition, ClassDefinition>();

            foreach (var raw in raws)
            {
                if (pairs.Any(d => d.Value.Name == raw.Name) == true)
                {
                    throw new LoadException(string.Format("duplicate class '{0}'",
                                                          raw.Name));
                }
                pairs.Add(raw, GetClass(raw));
            }

            var defs = new HashedDefinitionDictionary <ClassDefinition>(pairs.Values);

            foreach (var pair in pairs)
            {
                LoadClass(pair.Value, pair.Key, defs);
            }
            return(defs);
        }