示例#1
0
        private void getReferences()
        {
            string FilePath = txtFileA.Text;

            fileA = new xTextFile(FilePath);
            string Contents = fileA.Processor.GetAllText(FilePath);

            var words       = new Dictionary <string, int>(StringComparer.CurrentCultureIgnoreCase);
            var wordPattern = new Regex(txtRegexp.Text);

            fileA.wordsCount = wordPattern.Matches(Contents).Count;

            // Check if exists

            int progress = 0;

            references = new HashSet <string>();
            foreach (Match match in wordPattern.Matches(Contents))
            {
                progress++;
                int currentCount = 0;
                words.TryGetValue(match.Value, out currentCount);
                currentCount++;
                words[match.Value] = currentCount;
                references.Add(Replacer(match.Value.ToLower()));
            }
            fileA.uniqueWordsCount = references.Count();
        }
示例#2
0
        public FrmOutput(List <xWord> words, xTextFile fileA, xTextFile fileB)
        {
            InitializeComponent();

            lblFileB.Text             += fileB.fileName;
            lblFileBWordsC.Text       += fileB.wordsCount.ToString();
            lblFileBUniqueWordsC.Text += fileB.uniqueWordsCount.ToString();

            lblFileA.Text             += fileA.fileName;
            lblFileAWordsC.Text       += fileA.wordsCount.ToString();
            lblFileAUniqueWordsC.Text += fileA.uniqueWordsCount.ToString();


            olvOutput.AlternateRowBackColor = Color.AliceBlue;
            olvOutput.SetObjects(words);
            olvOutput.Sort(olvColumn1, SortOrder.Ascending);
        }