Beispiel #1
0
        public void Flush()
        {
            if (!wasWritten)
            {
                return;
            }

            lock (lock_ibp_fs)
            {
                FSR.NET_Flush(fs);
                wasWritten = false;
            }
        }
Beispiel #2
0
        public void Dispose()
        {
            lock (lock_ibp_fs)
            {
                if (fs != null)
                {
                    FSR.NET_Flush(fs);


                    fs.Dispose();
                    fs = null;
                }
            }
        }
Beispiel #3
0
        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.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 = 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.Position = fs.Length;
                }
            }

            //return fs;
        }