IConfigurationProvider CreateConfig() { var config = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers); config.SetupConverters(); CreateProfileMap(config); CreateDlcMap(config); CreateGameMap(config); config.Seal(); return config; }
static MappingEngine CreateMapper() { var mappingConfig = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers); mappingConfig.SetupConverters(); mappingConfig.CreateMap<Bundle, CustomCollection>() .ForMember(x => x.Name, opt => opt.MapFrom(src => src.GetFullName())) .ForMember(x => x.RequiredMods, opt => opt.MapFrom(src => src.GetRequiredClient())) .ForMember(x => x.OptionalMods, opt => opt.MapFrom(src => src.GetOptionalClient())); mappingConfig.CreateMap<CustomCollection, Bundle>() .ForMember(x => x.Name, opt => opt.ResolveUsing(src => PackageHelper.Packify(src.Name))) .ForMember(x => x.FullName, opt => opt.ResolveUsing(src => src.Name)) .ForMember(x => x.RequiredClients, opt => opt.ResolveUsing(src => src.RequiredMods)) .ForMember(x => x.OptionalClients, opt => opt.ResolveUsing(src => src.OptionalMods)); mappingConfig.Seal(); return new MappingEngine(mappingConfig); }
static MappingEngine GetMapper() { var mapConfig = new ConfigurationStore(new TypeMapFactory(), MapperRegistry.Mappers); mapConfig.SetupConverters(); mapConfig.CreateMap<ServerQueryResult, Server>() .Include<GamespyServerQueryResult, Server>() .Include<SourceServerQueryResult, Server>() .Include<SourceMasterServerQueryResult, Server>() .ForSourceMember(x => x.Settings, opt => opt.Ignore()) .ForMember(x => x.Ping, opt => opt.Ignore()); SetupGamespy(mapConfig); SetupSource(mapConfig); mapConfig.Seal(); return new MappingEngine(mapConfig); }