Example #1
0
        public void SaveData()
        {
            using (IWriteTransaction trans = _app.GetFileStorage(Ioc).OpenWriteTransaction(Ioc, _app.GetBooleanPreference(PreferenceKey.UseFileTransactions)))
            {
                DatabaseFormat.Save(KpDatabase, trans.OpenFile());

                trans.CommitWrite();
            }
        }
 protected void UpdateRemoteFile(Stream cachedData, IOConnectionInfo ioc, bool useFileTransaction, string hash)
 {
     //try to write to remote:
     using (
         IWriteTransaction remoteTrans = _cachedStorage.OpenWriteTransaction(ioc, useFileTransaction))
     {
         Stream remoteStream = remoteTrans.OpenFile();
         cachedData.CopyTo(remoteStream);
         remoteStream.Close();
         remoteTrans.CommitWrite();
     }
     //success. Update base-version of cache:
     File.WriteAllText(BaseVersionFilePath(ioc), hash);
     File.WriteAllText(VersionFilePath(ioc), hash);
 }