public SLItem(string sName, long lSize, string sPath, FileInfo fi) { m_sName = sName; m_lSize = lSize; m_sPath = sPath; m_fi = fi; m_di = null; m_atmc = null; }
/* N M A T C H P L A T M */ /*---------------------------------------------------------------------------- %%Function: NMatchPlatm %%Qualified: SList.SLItem.NMatchPlatm %%Contact: rlittle try to match the two platms. Return the confidence (0-100%) (confidence is the number of matched words / the number of words in platm1) ----------------------------------------------------------------------------*/ public int NMatch(ATMC atmc) { int i1 = this.Count - 1, i2 = atmc.Count - 1; int cMatch = 0; if (i1 < 0 || i2 < 0) return cMatch; while (i1 >= 0 && i2 >= 0) { // find the first titleword while (i2 >= 0 && atmc[i2].Atmt != ATMT.TitleWord) i2--; if (i2 < 0) break; while (i1 >= 0 && this[i1].Atmt != ATMT.TitleWord) i1--; if (i1 < 0) break; if (!this[i1].FMatch(atmc[i2])) break; cMatch++; i1--; i2--; } return (cMatch * 100) / this.CountWords; }
public SLItem(string sName, long lSize, string sPath, DirectoryInfo di) { m_sName = sName; m_lSize = lSize; m_sPath = sPath; m_di = di; m_fi = null; m_atmc = null; }
private void EH_SmartMatchClick(object sender, System.EventArgs e) { ATMC atmc = new ATMC(m_ebRegEx.Text); string sMatch = String.Format("Matches for '{0}':\n\n", m_ebRegEx.Text); int i, iMac; int cMatch = 0; for (i = 0, iMac = m_lv.Items.Count; i < iMac; i++) { SLItem sli = (SLItem)(m_lv.Items[i].Tag); if (sli.m_atmc == null) sli.m_atmc = new ATMC(sli.m_sName); int nMatch = 0; nMatch = sli.m_atmc.NMatch(atmc); if (nMatch > 65) { sMatch += String.Format("{0:d3}% : '{1}'\n", nMatch, Path.GetFullPath(Path.Combine(sli.m_sPath, sli.m_sName)), m_ebRegEx.Text); cMatch++; } } if (cMatch == 0 || MessageBox.Show(sMatch, "Matches", MessageBoxButtons.OKCancel) == DialogResult.Cancel) sCancelled += String.Format("{0}\n", m_ebRegEx.Text); }