Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
 public static DateTime RoundedNow()
 {
     return(HttpTime.RoundDate(DateTime.Now));
 }