Esempio n. 1
0
        private void SaveComparisonCache()
        {
            string cacheFileName = Path.Combine(Path.GetTempPath(), Path.GetFileName(_settingsService.LastProject) + ".cache");

            if (AreAllVarietiesCompared)
            {
                using (FileStream fs = File.Create(cacheFileName))
                {
                    Serializer.SerializeWithLengthPrefix(fs, CacheVersion, PrefixStyle.Base128, 1);
                    Serializer.SerializeWithLengthPrefix(fs, CalcProjectHash(), PrefixStyle.Base128, 1);
                    foreach (VarietyPair vp in _project.VarietyPairs)
                    {
                        var surrogate = new VarietyPairSurrogate(vp);
                        Serializer.SerializeWithLengthPrefix(fs, surrogate, PrefixStyle.Base128, 1);
                    }
                }
            }
            else
            {
                if (File.Exists(cacheFileName))
                {
                    File.Delete(cacheFileName);
                }
            }
        }
Esempio n. 2
0
 private void SaveComparisonCache()
 {
     string cacheFileName = Path.Combine(Path.GetTempPath(), Path.GetFileName(_settingsService.LastProject) + ".cache");
     if (AreAllVarietiesCompared)
     {
         using (FileStream fs = File.Create(cacheFileName))
         {
             Serializer.SerializeWithLengthPrefix(fs, CacheVersion, PrefixStyle.Base128, 1);
             Serializer.SerializeWithLengthPrefix(fs, CalcProjectHash(), PrefixStyle.Base128, 1);
             foreach (VarietyPair vp in _project.VarietyPairs)
             {
                 var surrogate = new VarietyPairSurrogate(vp);
                 Serializer.SerializeWithLengthPrefix(fs, surrogate, PrefixStyle.Base128, 1);
             }
         }
     }
     else
     {
         if (File.Exists(cacheFileName))
             File.Delete(cacheFileName);
     }
 }