BF2Statistics.Web.Bf2Stats.Controller.CacheFileExpired C# (CSharp) Method

CacheFileExpired() protected method

Returns whether or not the Cache file is expired
protected CacheFileExpired ( string CacheFileName, int CacheTime ) : bool
CacheFileName string The Cache file name
CacheTime int The expire time of the cache file in Minutes
return bool
        protected bool CacheFileExpired(string CacheFileName, int CacheTime)
        {
            // If cache is diabled, force the Controller to process
            if (!Program.Config.BF2S_CacheEnabled) return true;

            // Make sure we have loaded this file
            if (CacheFile == null)
                CacheFile = new FileInfo(Path.Combine(Program.RootPath, "Web", "Bf2Stats", "Cache", CacheFileName + ".html"));

            // Cant be expired if we dont exist, so we force the Controller to process
            if (!CacheFile.Exists) return true;

            // Compare dates
            return (DateTime.Now.CompareTo(CacheFile.LastWriteTime.AddMinutes(CacheTime)) > 0);
        }