コード例 #1
0
ファイル: ProjectService.cs プロジェクト: FieldDB/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);
                }
            }
        }
コード例 #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);
     }
 }