public void Clean(IList <string> rootDirectories) { if (this.IsCleaningOverdue()) { lock (CobaltStoreCleaner.syncObject) { if (this.IsCleaningOverdue()) { SimulatedWebRequestContext.ExecuteWithoutUserContext("WAC.CleanCobaltStore", delegate(RequestDetailsLogger logger) { WacUtilities.SetEventId(logger, "WAC.CleanCobaltStore"); foreach (string text in rootDirectories) { CobaltStoreCleaner.ValidatePath(text); try { this.CleanRootDirectory(text); } catch (DirectoryNotFoundException) { } } }); } } } }
private void CleanCobaltStoreDirectory(string cobaltStoreDirectory) { ExDateTime oldestFileTime = this.GetOldestFileTime(cobaltStoreDirectory); ExDateTime t = ExDateTime.UtcNow.Subtract(this.expirationTime); if (oldestFileTime < t) { CobaltStoreCleaner.ValidatePath(cobaltStoreDirectory); try { Directory.Delete(cobaltStoreDirectory, true); } catch (IOException) { } } }