public void LoadFile(string physicalPathFile, DateTime modifiedSince) { FileInfo fi = new FileInfo(physicalPathFile); if (fi.Exists) { if (fi.LastWriteTime >= modifiedSince) { ContentType = ContentTypes.GetExtensionType(fi.Name); ContentStream = (Stream)(new FileStream(physicalPathFile, FileMode.Open, FileAccess.Read, FileShare.Read)); if (ContentType.StartsWith("text")) { // StreamReader reader = new StreamReader(streamContent); // auto detect by browser CharSet = ""; } } LastModified = HttpTime.RoundDate(fi.LastWriteTime); } else { throw new FileNotFoundException("File Not Found!", physicalPathFile); } }
public static DateTime RoundedNow() { return(HttpTime.RoundDate(DateTime.Now)); }