Beispiel #1
0
        public FileInfo GetFile(string name)
        {
            var fileRef = ShortCode.TryParse(name, out var c)
                ? _index.GetFile(c)
                : _index.GetFileByName(c);

            return(new FileInfo(Path.Combine(_uploadService.RootPath.FullName, fileRef.Location)));
        }
Beispiel #2
0
            public object ReadYaml(IParser parser, Type type)
            {
                var value = ((Scalar)parser.Current).Value;

                parser.MoveNext();
                return(ShortCode.TryParse(value, out var c)
                    ? c
                    : null);
            }
Beispiel #3
0
        public ImageReference Handle(ImageRequest message)
        {
            var imageRef = ShortCode.TryParse(message.Id, out var c)
                ? Index.GetImage(c)
                : Index.GetImageByName(message.Id);

            imageRef.SetLocation(ImageRoot);
            if (message.DetectContentType)
            {
                imageRef.ContentType = MimeGuesser.GuessMimeType(imageRef.FileLocation);
            }

            return(imageRef);
        }