public LocationRepository( IDatabaseConnection databaseConnection, ILocationConverter converter, ILogger <LocationRepository> logger) : base(databaseConnection) { this.logger = logger; this.converter = converter; }
public static SourceLocation ToSourceLocation(this Position position, ILocationConverter lc = null) { var location = new SourceLocation(position.line + 1, position.character + 1); if (lc == null) { return(location); } return(new SourceLocation(lc.LocationToIndex(location), location.Line, location.Column)); }
public MountainBriefResourceConverter(ILocationConverter locationConverter) { _locationConverter = locationConverter; var mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <Mountain, MountainBriefResource>() .ForMember(x => x.Location, opt => opt.Ignore()) .ForMember(x => x.Trails, opt => opt.Ignore()); }); _mapper = mapperConfig.CreateMapper(); }
public MountainResourceConverter(IMountainTrailResourceConverter mountainTrailResourceConverter, ILocationConverter locationConverter, IOptions <ResourcesOptions> config) { _mountainTrailResourceConverter = mountainTrailResourceConverter; _locationConverter = locationConverter; var mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <Mountain, MountainResource>() .ForMember(x => x.MountainImages, opt => opt.MapFrom(src => src.MountainImages.Select(y => ImageResource.ForMountain(config.Value.ImagesBaseAddress, y.ImageId.ToString(), y.FileExtensions)))) .ForMember(x => x.Location, opt => opt.Ignore()) .ForMember(x => x.Trails, opt => opt.Ignore()); }); _mapper = mapperConfig.CreateMapper(); }
public static SourceSpan ToSourceSpan(this IndexSpan span, ILocationConverter lc) => lc != null ? new SourceSpan(lc.IndexToLocation(span.Start), lc.IndexToLocation(span.End)) : default;
public static IndexSpan ToIndexSpan(this Range range, ILocationConverter lc) => IndexSpan.FromBounds(lc.LocationToIndex(range.start), lc.LocationToIndex(range.end));
public static IndexSpan ToIndexSpan(this SourceSpan span, ILocationConverter lc) => IndexSpan.FromBounds(lc.LocationToIndex(span.Start), lc.LocationToIndex(span.End));
public static int ToIndex(this SourceLocation location, ILocationConverter lc) => lc.LocationToIndex(location);
public static SourceSpan ToSourceSpan(this Range range, ILocationConverter lc = null) => new SourceSpan(range.start.ToSourceLocation(lc), range.end.ToSourceLocation(lc));
public LocationRepositoryTests() { this.logger = new Mock <ILogger <LocationRepository> >(); this.converter = new LocationConverter(); }
public ShotService(ILocationConverter locationConverter) { _locationConverter = locationConverter; }