void SaveToCache(string cacheFileName, DateTime lastWriteTime, LoadedAssembly asm)
 {
     if (cacheFileName == null)
     {
         return;
     }
     LoggingService.Debug("Serializing to " + cacheFileName);
     try {
         Directory.CreateDirectory(DomPersistencePath);
         using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
             using (BinaryWriter writer = new BinaryWriterWith7BitEncodedInts(fs)) {
                 writer.Write(lastWriteTime.Ticks);
                 FastSerializer s = new FastSerializer();
                 s.Serialize(writer, asm);
             }
         }
     } catch (IOException ex) {
         LoggingService.Warn(ex);
         // Can happen if two SD instances are trying to access the file at the same time.
         // We'll just let one of them win, and instance that got the exception won't write to the cache at all.
         // Similarly, we also ignore the other kinds of IO exceptions.
     } catch (UnauthorizedAccessException ex) {
         LoggingService.Warn(ex);
     }
 }
 static void SaveToCache(string cacheFileName, IProjectContent pc)
 {
     try {
         Directory.CreateDirectory(Path.GetDirectoryName(cacheFileName));
         using (FileStream fs = new FileStream(cacheFileName, FileMode.Create, FileAccess.Write)) {
             using (BinaryWriter writer = new BinaryWriterWith7BitEncodedInts(fs)) {
                 writer.Write(cacheMagicNumber);
                 FastSerializer s = new FastSerializer();
                 s.Serialize(writer, pc);
             }
         }
     } catch (IOException ex) {
         LoggingService.Warn(ex);
         // Can happen if two SD instances are trying to access the file at the same time.
         // We'll just let one of them win, and the instance that got the exception won't write to the cache at all.
         // Similarly, we also ignore the other kinds of IO exceptions.
     } catch (UnauthorizedAccessException ex) {
         LoggingService.Warn(ex);
     }
 }