bool HandleRoot(string path, HttpListenerRequest req, HttpListenerResponse res)
{
if (path.Equals("/index.html") ||
path.Equals("/enter-name.html"))
{
var uri = req.Url;
string url = uri.GetLeftPart(UriPartial.Authority) + m_gamePath + m_options.controllerFilename + uri.Query + uri.Fragment;
res.StatusCode = (int)HttpStatusCode.Redirect;
res.AddHeader("Location", url);
res.ContentType = "text/html";
res.WriteContent(System.Text.Encoding.UTF8.GetBytes("<script>window.location.href = decodeURIComponent(\"" + Uri.EscapeDataString(url) + "\");</script>"));
m_log.Info("redirect: " + url);
return true;
}
return false;
}