public void Flush() { if (!wasWritten) { return; } lock (lock_ibp_fs) { FSR.NET_Flush(fs); wasWritten = false; } }
public void Dispose() { lock (lock_ibp_fs) { if (fs != null) { FSR.NET_Flush(fs); fs.Dispose(); fs = null; } } }
private void GetFileStream() { DateTime dtBase = new DateTime(1980, 1, 1, 0, 0, 0, DateTimeKind.Utc); TimeSpan ts = DateTime.UtcNow.Subtract(dtBase); uint jj = (uint)(ts.TotalMinutes / (double)_IncrementalBackupFileIntervalMin); DateTime backupTime = dtBase.AddMinutes(jj * _IncrementalBackupFileIntervalMin); ulong bupTime = Convert.ToUInt64(backupTime.ToString("yyyyMMddHHmmss")); if (fs == null) { currentBackup = bupTime; string bupFileName = String.Format("dbreeze_ibp_{0}.ibp", bupTime); string fullBackupFileName = Path.Combine(this._backupFolderName, bupFileName); //fs = new FileStream(fullBackupFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None,_bufferSize,FileOptions.WriteThrough); //fs = new FileStream(fullBackupFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, _bufferSize,FileOptions.WriteThrough); fs = this.configuration.FSFactory.CreateType1(fullBackupFileName, _bufferSize); fs.Position = fs.Length; } else { //we got open file stream, checking if it is of correct time, otherwise creating new file if (currentBackup != bupTime) { FSR.NET_Flush(fs); fs.Dispose(); currentBackup = bupTime; string bupFileName = String.Format("dbreeze_ibp_{0}.ibp", bupTime); string fullBackupFileName = Path.Combine(this._backupFolderName, bupFileName); fs = this.configuration.FSFactory.CreateType1(fullBackupFileName, _bufferSize); //fs = new FileStream(fullBackupFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, _bufferSize, FileOptions.WriteThrough); fs.Position = fs.Length; } } //return fs; }