public static string GetCoursewareResourcePath(BL.Coursewares cw) { string fileFullPath = Path.Combine(cw.CoursewareFilePath, cw.CoursewareFileName).Replace("\\", "/"); string fileRelPath = fileFullPath.Substring(fileFullPath.ToLower().IndexOf("clientbin") - 1); return(fileRelPath); }
public static CoursewareType GetCoursewarePath(BL.Coursewares cw, out string imagePath, out string filePath, out bool haveMediaText) { string fileFullPath = Path.Combine(cw.CoursewareFilePath, cw.CoursewareFileName).Replace("\\", "/"); string fileRelPath = fileRelPath = fileFullPath.Substring(fileFullPath.ToLower().IndexOf("clientbin") - 1); imagePath = string.Empty; filePath = string.Empty; haveMediaText = false; switch ((CoursewareType)cw.CoursewareType) { case CoursewareType.PPT: case CoursewareType.PDF: imagePath = fileRelPath.Split('.')[0] + "/Images.xml"; break; case CoursewareType.Media: filePath = fileRelPath.ToLower().Replace("/clientbin/", ""); break; case CoursewareType.MediaAddText: filePath = fileRelPath.ToLower().Replace("/clientbin/", ""); break; case CoursewareType.Flash: case CoursewareType.Resource: filePath = fileRelPath; break; } if (File.Exists(fileFullPath.Replace(cw.CoursewareFileName, "mediaText.xml"))) { haveMediaText = true; } return((CoursewareType)cw.CoursewareType); }