コード例 #1
0
        /// <summary>
        /// Called when a file is copied during an error index move operation.
        /// This will only get called if the move is to a different drive.
        /// </summary>
        /// <param name="sender">The error index.</param>
        /// <param name="e">Information about the file.</param>
        private void errorIndexMoveCallback(Object sender, ErrorIndexMoveEventArgs e)
        {
            m_FileCount++;

            // Only report the start of a file copy for now.
            if (e.IsCopyStarted == false)
            {
                return;
            }

            TimeSpan timeSinceLastProgressReport = DateTime.Now - m_LastProgressSentTime;

            String fileExtension = Path.GetExtension(e.FileName);


            // Always report the copying of the database files because these may take some time and the user should see
            // that those file copies are in progress.
            bool alwaysSendReport = false;

            if (!String.IsNullOrEmpty(fileExtension))
            {
                String normalizedExtension = fileExtension.ToUpperInvariant();
                if ((normalizedExtension == ".MDF") || (normalizedExtension == ".LDF"))
                {
                    alwaysSendReport = true;
                }
            }

            if ((timeSinceLastProgressReport.TotalSeconds >= m_TaskParameters.IntervalBetweenProgressReportsInSeconds) ||
                alwaysSendReport)
            {
                m_LastProgressSentTime = DateTime.Now;
                reportProgress(e.FileName, e.FileCount, e.IsCopyStarted);
            }
        }
コード例 #2
0
 private void errorIndexMoveCallback(Object sender, ErrorIndexMoveEventArgs e)
 {
     m_MoveFileCount++;
 }