Ejemplo n.º 1
0
        /// <summary>
        /// Routine to find duplicate entries in file map.
        /// </summary>
        /// <param name="matchPos"></param>
        public void PerformCrossMatch(int matchPos)
        {
            for (int scanPos = 0; scanPos < _fileMap.Count; scanPos++)
            {
                //Exculde same file from checking itself.
                if ((matchPos == scanPos) || (string.IsNullOrEmpty(_fileMap[scanPos].HashCode)))
                {
                    continue;
                }

                //Ignore already checked
                if ((_fileMap[scanPos].IsIgnore) || (_fileMap[matchPos].IsIgnore))
                {
                    continue;
                }

                if (_fileMap[matchPos].HashCode == _fileMap[scanPos].HashCode)
                {
                    if (OnMatchFound != null)
                    {
                        _fileMap[matchPos].IsIgnore = true;
                        OutputEventArgs eventArgsData = new OutputEventArgs
                        {
                            OutputData = new OutputDataStruct(_fileMap[matchPos].FileName, _fileMap[scanPos].FileName, (_threadId + 1))
                        };
                        OnMatchFound(this, eventArgsData);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Routine to push detected duplicate entries to parent form.
 /// </summary>
 /// <param name="sender">Object related to the parent.</param>
 /// <param name="e">Event arugments.</param>
 public void OnUpdateUi(object sender, OutputEventArgs e)
 {
     while (!FrmFileScaner.OutputList.TryAdd(e.OutputData))
     {
         Thread.Sleep(10);
     }
 }