public ChecksumCallback(
     long computedSize,
     long totalSize,
     ChecksumComputeProgress owner,
     long startMicroseconds
     )
 {
     computedSize_ = computedSize;
     totalSize_ = totalSize;
     startMicroseconds_ = startMicroseconds;
     owner_ = owner;
 }
 public ChecksumCallback(
     long computedSize,
     long totalSize,
     ChecksumComputeProgress owner,
     long startMicroseconds
     )
 {
     computedSize_      = computedSize;
     totalSize_         = totalSize;
     startMicroseconds_ = startMicroseconds;
     owner_             = owner;
 }
Exemple #3
0
        private void tsbComputeChecksum_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            if (currentNode_ == null)
            {
                MessageBox.Show("请先选择节点再执行效验和分析工具。");
                Cursor = Cursors.Arrow;
                return;
            }
            ChecksumOption cmpChecksumWnd = new ChecksumOption();

            cmpChecksumWnd.ShowDialog();

            if (!cmpChecksumWnd.IsOK)
            {
                Cursor = Cursors.Arrow;
                return;
            }

            //收集节点,
            List <PathNode> initNodeList = (currentNode_.Tag as PathNode).DescendantFiles;

            if (!(currentNode_.Tag as PathNode).IsDirectory)
            {
                initNodeList.Add(currentNode_.Tag as PathNode);
            }


            List <PathNode> filteredNodeList = new List <PathNode>();

            foreach (PathNode pathNode in initNodeList)
            {
                //忽略掉不满足条件的节点
                if (cmpChecksumWnd.ThresholdType == ThresholdType.Least)
                {
                    if (pathNode.Size < cmpChecksumWnd.Bound)
                    {
                        continue;
                    }
                }
                if (cmpChecksumWnd.ThresholdType == ThresholdType.Most)
                {
                    if (pathNode.Size > cmpChecksumWnd.Bound)
                    {
                        continue;
                    }
                }
                if (
                    !cmpChecksumWnd.IsUpdateExistChecksum &&
                    !string.IsNullOrEmpty(pathNode.Checksum)
                    )
                {
                    continue;
                }

                filteredNodeList.Add(pathNode);
            }

            //打开进度对话框
            ChecksumComputeProgress progWnd = new ChecksumComputeProgress(filteredNodeList);

            progWnd.ShowDialog();
            if (progWnd.IsOK)
            {
                MessageBox.Show("已完成效验和计算。");
            }
            else
            {
                MessageBox.Show("效验和计算中断。");
            }
            Cursor = Cursors.Arrow;
        }