BF2Statistics.Web.HttpServer.ClearRazorCache C# (CSharp) Method

ClearRazorCache() public static method

Removes all of the Razor Engine built temporary files from the AppData/Temp folder
public static ClearRazorCache ( ) : void
return void
        public static void ClearRazorCache()
        {
            // For safety
            if (IsRunning)
                throw new Exception("The Razor Cache cannot be cleared while the HttpServer is running.");

            try
            {
                // Get our [User]/AppData/Local/Temp folder Location
                string folderPath = Path.GetTempPath();

                // Clear dynamic cache files
                foreach (string dir in Directory.GetDirectories(folderPath, "RazorEngine_*"))
                    Directory.Delete(dir, true);
            }
            catch (Exception e)
            {
                Program.ErrorLog.Write("NOTICE: [HttpServer.ClearRazorCache] " + e.Message);
            }
        }
    }