Пример #1
0
        StrongBox <ModuleId> CreateCore(ModuleDef module)
        {
            if (factories == null)
            {
                var list = new List <IModuleIdFactory>(moduleIdFactoryProviders.Length);
                foreach (var provider in moduleIdFactoryProviders)
                {
                    var factory = provider.Value.Create();
                    if (factory != null)
                    {
                        list.Add(factory);
                    }
                }
                factories = list.ToArray();
            }

            foreach (var factory in factories)
            {
                var id = factory.Create(module);
                if (id != null)
                {
                    return(new StrongBox <ModuleId>(id.Value));
                }
            }

            return(new StrongBox <ModuleId>(ModuleId.CreateFromFile(module)));
        }