public FileSystemModel.Video GetVideoDetail() { if (Directory.Exists(FileSystemPath)) { if (EventIdParams.Length > 3) { eventName.InnerText = string.Format("{0} - {1}", EventIdParams[1], EventIdParams[3]); } FileSystemModel.Video video = new FileSystemModel.Video(); //popis string descPath = Path.Combine(FileSystemPath, GlobalConstants.fnVideoPopis); if (File.Exists(descPath)) { video.Popis = File.ReadAllText(descPath); } else { video.Popis = string.Empty; } VideoPopis.InnerText = video.Popis; //poster string local = Server.MapPath(Request.ApplicationPath); string posterPath = Path.Combine(FileSystemPath, GlobalConstants.fnVideoPoster); //video.Poster = string.Empty; //if (File.Exists(posterPath)) //{ // posterPath = posterPath.Replace(local, ""); // video.PathVideoPoster = posterPath; //} //videa string[] files = Directory.GetFiles(FileSystemPath); if (files != null && files.Length > 0) { video.MP4 = files.FirstOrDefault(p => Path.GetFileName(p).Equals(GlobalConstants.fnVideoMP4, StringComparison.CurrentCultureIgnoreCase))?.Replace(local, @"\"); video.OGV = files.FirstOrDefault(p => Path.GetFileName(p).Equals(GlobalConstants.fnVideoOGV, StringComparison.CurrentCultureIgnoreCase))?.Replace(local, @"\"); video.WEBM = files.FirstOrDefault(p => Path.GetFileName(p).Equals(GlobalConstants.fnVideoWEBM, StringComparison.CurrentCultureIgnoreCase))?.Replace(local, @"\"); video.Poster = files.FirstOrDefault(p => Path.GetFileName(p).Equals(GlobalConstants.fnVideoPoster, StringComparison.CurrentCultureIgnoreCase))?.Replace(local, @"\"); } return(video); } return(null); }
public List <FileSystemModel.Video> GetVideosForAkcie() { List <FileSystemModel.Video> lstRes = new List <FileSystemModel.Video>(); string pthVideo = Path.Combine(FileSystemPath, GlobalConstants.PthVideoRoot); if (!Directory.Exists(pthVideo)) { Response.Redirect(GlobalConstants.urlDefault, true); } string[] videoRoots = Directory.GetDirectories(pthVideo, "*", SearchOption.TopDirectoryOnly); if (videoRoots.Length == 0) { Response.Redirect(GlobalConstants.urlDefault, true); } foreach (string videoRoot in videoRoots) { FileSystemModel.Video video = new FileSystemModel.Video(); video.Nazov = Path.GetFileName(videoRoot); video.DetailURL = Page.Server.UrlEncode(string.Format("{0}/{1}/{2}", Request.QueryString["ID"], GlobalConstants.fnVideoDir, video.Nazov)); string descPath = Path.Combine(videoRoot, GlobalConstants.fnVideoPopisShort); if (File.Exists(descPath)) { video.Popis = File.ReadAllText(descPath); } else { video.Popis = string.Empty; } string posterPath = Path.Combine(videoRoot, GlobalConstants.fnVideoPoster); video.Poster = string.Empty; if (File.Exists(posterPath)) { string local = Server.MapPath(Request.ApplicationPath); posterPath = posterPath.Replace(local, ""); video.Poster = posterPath; } lstRes.Add(video); } return(lstRes); }