コード例 #1
0
 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)
                         {
                         }
                     }
                 });
             }
         }
     }
 }
コード例 #2
0
        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)
                {
                }
            }
        }