コード例 #1
0
 public LocationRepository(
     IDatabaseConnection databaseConnection,
     ILocationConverter converter,
     ILogger <LocationRepository> logger) :
     base(databaseConnection)
 {
     this.logger    = logger;
     this.converter = converter;
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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();
        }
コード例 #5
0
 public static SourceSpan ToSourceSpan(this IndexSpan span, ILocationConverter lc)
 => lc != null ? new SourceSpan(lc.IndexToLocation(span.Start), lc.IndexToLocation(span.End)) : default;
コード例 #6
0
 public static IndexSpan ToIndexSpan(this Range range, ILocationConverter lc)
 => IndexSpan.FromBounds(lc.LocationToIndex(range.start), lc.LocationToIndex(range.end));
コード例 #7
0
 public static IndexSpan ToIndexSpan(this SourceSpan span, ILocationConverter lc)
 => IndexSpan.FromBounds(lc.LocationToIndex(span.Start), lc.LocationToIndex(span.End));
コード例 #8
0
 public static int ToIndex(this SourceLocation location, ILocationConverter lc) => lc.LocationToIndex(location);
コード例 #9
0
 public static SourceSpan ToSourceSpan(this Range range, ILocationConverter lc = null)
 => new SourceSpan(range.start.ToSourceLocation(lc), range.end.ToSourceLocation(lc));
コード例 #10
0
        public LocationRepositoryTests()
        {
            this.logger = new Mock <ILogger <LocationRepository> >();

            this.converter = new LocationConverter();
        }
コード例 #11
0
 public ShotService(ILocationConverter locationConverter)
 {
     _locationConverter = locationConverter;
 }