예제 #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);
                }
            }
        }
예제 #2
0
파일: ProjectService.cs 프로젝트: rmunn/cog
 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);
     }
 }