static void RegisterFileHandlers()
{
string pattern = string.Format("({0})", string.Join("|", fileTypes.Select(x => x.Key).ToArray()));
RouteAttribute downloadRoute = new RouteAttribute(string.Format(@"^/download/(.*\.{0})$", pattern));
RouteAttribute fileRoute = new RouteAttribute(string.Format(@"^/(.*\.{0})$", pattern));
bool needs_www = fileRoot.Contains("://");
downloadRoute.m_runOnMainThread = needs_www;
fileRoute.m_runOnMainThread = needs_www;
FileHandlerDelegate callback = FileHandler;
if (needs_www)
callback = WWWFileHandler;
downloadRoute.m_callback = delegate(RequestContext context) { callback(context, true); };
fileRoute.m_callback = delegate(RequestContext context) { callback(context, false); };
registeredRoutes.Add(downloadRoute);
registeredRoutes.Add(fileRoute);
}