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))); }
public object ReadYaml(IParser parser, Type type) { var value = ((Scalar)parser.Current).Value; parser.MoveNext(); return(ShortCode.TryParse(value, out var c) ? c : null); }
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); }