Skip to content

Commit

Permalink
reload modified default file.
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Jun 16, 2011
1 parent 6809223 commit f7ff20c
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -52,6 +52,7 @@ public void ProcessRequest(HttpContext context)
null);
}

private DateTime DefaultFileModified { get; set; }
private string DefaultFilePath { get; set; }
private byte[] DefaultFileContents { get; set; }

Expand All @@ -65,6 +66,7 @@ public void SetDefaultFile(string defaultFilePath)
{
this.DefaultFileContents = File.ReadAllBytes(defaultFilePath);
this.DefaultFilePath = defaultFilePath;
this.DefaultFileModified = File.GetLastWriteTime(defaultFilePath);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -114,6 +116,9 @@ public void ProcessRequest(IHttpRequest request, IHttpResponse response, string

if (fileName.EqualsIgnoreCase(this.DefaultFilePath))
{
if (fi.LastWriteTime > this.DefaultFileModified)
SetDefaultFile(this.DefaultFilePath); //reload

response.OutputStream.Write(this.DefaultFileContents, 0, this.DefaultFileContents.Length);
return;
}
Expand Down

0 comments on commit f7ff20c

Please sign in to comment.