Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var videoPath         = exampleFileSelector.SelectedFile;
            var fileInfo          = new FileInfo(videoPath);
            var thumbnailCacheKey = new FileCacheKey(new FileCacheSourceKey(fileInfo.Name, fileInfo.Length, fileInfo.LastWriteTimeUtc), "jpg");
            var cacheItem         = ThumbnailCache.GetOrAdd(
                thumbnailCacheKey,
                thumbnailStream => GetAndSaveThumbnail(videoPath, thumbnailStream)
                );

            ThumbnailUrl = ExamplesConfiguration.GetDownloadUrl(
                Hosting.ResolvePhysicalPath(ThumbnailCachePath.Append(cacheItem.RelativeName)),
                thumbnailCacheKey.FullValue
                );

            VideoInfo = GetVideoInfo(videoPath);
        }
 private static string GetDownloadLink(FileInfo fileInfo)
 {
     return(string.Format(
                "<a href=\"{0}\">Download</a>",
                ExamplesConfiguration.GetDownloadUrl(fileInfo.FullName, fileInfo.LastWriteTimeUtc.Ticks.ToString())));
 }