예제 #1
0
 private static bool TryLoadCachedMetadata(IEnumerable <string> cacheFilePaths, byte[] checkSum, out List <PluginInfo> pluginInfos)
 {
     cacheFilePaths = cacheFilePaths.Where(File.Exists).ToList();
     if (cacheFilePaths.Any())
     {
         try
         {
             var pluginInfoCache = PluginInfoCache.Read(cacheFilePaths.First());
             if (pluginInfoCache.CheckSum.SequenceEqual(checkSum))
             {
                 pluginInfos = pluginInfoCache.Plugins;
                 return(true);
             }
         }
         catch (Exception)
         {
             // not a big deal, it just means the cache isn't accessible right now
             // (maybe another app domain or process is writing to it?)
             // and we need to build meta-data from the binaries
             Platform.Log(LogLevel.Debug, "Failed to read plugin metadata cache.");
         }
     }
     pluginInfos = null;
     return(false);
 }
예제 #2
0
 private void SaveCachedMetadata(List <PluginInfo> pluginInfos, byte[] checkSum)
 {
     try
     {
         var pluginInfoCache = new PluginInfoCache(pluginInfos, checkSum);
         pluginInfoCache.Write(_primaryCacheFile);
     }
     catch (Exception)
     {
         // not a big deal, it just means the cache won't be updated this time around
         Platform.Log(LogLevel.Debug, "Failed to write plugin metadata cache.");
     }
 }