public static HtmlPostProcessContext Load(IPostProcessorHost host)
 {
     using (var stream = host?.LoadContextInfo())
     {
         if (stream == null || host?.IsIncremental == false)
         {
             var context = new HtmlPostProcessContext();
             context.PostProcessorHost = host;
             return(context);
         }
         using (var sr = new StreamReader(stream))
         {
             var context = JsonUtility.Deserialize <HtmlPostProcessContext>(sr);
             context.PostProcessorHost = host;
             var totalSrcFileSet = new HashSet <string>(host.SourceFileInfos.Select(s => s.SourceRelativePath));
             context.FileMapping = new OSPlatformSensitiveDictionary <string>(
                 context.FileMapping
                 .Where(p => totalSrcFileSet.Contains(p.Value))
                 .ToDictionary(p => p.Key, p => p.Value));
             context.Bookmarks = new OSPlatformSensitiveDictionary <HashSet <string> >(
                 context.Bookmarks
                 .Where(p => context.FileMapping.ContainsKey(p.Key))
                 .ToDictionary(p => p.Key, p => p.Value));
             return(context);
         }
     }
 }
 public HtmlPostProcessContext(IPostProcessorHost host)
 {
     PostProcessorHost = host;
 }