/// <summary> /// Loads the results cache at the given location. /// </summary> /// <param name="location">The location of the results cache to load.</param> /// <returns>Returns the results cache or null if there is no results cache at that location.</returns> public override XmlDocument LoadResultsCache(string location) { Param.RequireValidString(location, "location"); try { // Load the document if it exists and add it to the hashtable. string path = FileBasedEnvironment.GetResultsCachePath(location); if (File.Exists(path)) { XmlDocument resultsCache = new XmlDocument(); resultsCache.Load(path); return(resultsCache); } } catch (XmlException) { } catch (IOException) { } catch (SecurityException) { } catch (UnauthorizedAccessException) { } return(null); }
/// <summary> /// Saves the given results cache. /// </summary> /// <param name="location">The location to save the results cache under.</param> /// <param name="resultsCache">The results cache to save.</param> public override void SaveResultsCache(string location, XmlDocument resultsCache) { Param.RequireValidString(location, "location"); Param.RequireNotNull(resultsCache, "resultsCache"); try { string path = FileBasedEnvironment.GetResultsCachePath(location); try { if (File.Exists(path)) { File.SetAttributes(path, FileAttributes.Normal); File.Delete(path); } resultsCache.Save(path); } catch (ArgumentException) { } catch (IOException) { } catch (SecurityException) { } catch (UnauthorizedAccessException) { } try { if (File.Exists(path)) { File.SetAttributes(path, FileAttributes.Hidden); } } catch (ArgumentException) { } catch (IOException) { } catch (SecurityException) { } catch (UnauthorizedAccessException) { } } catch (XmlException) { } }