public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // string ligne, element; byte comp = 0; FonctionCLR Fonction = new FonctionCLR(); FonctionFichierBinaireCLR fichier = new FonctionFichierBinaireCLR("Classe.csv"); comboBox1.Items.Add(""); while (fichier.EndOfStream != true) { ligne = fichier.LireLigne(); Fonction.element(ligne, 0, out element, ' '); comboBox1.Items.Add(element); Fonction.element(ligne, 1, out correspondance[comp], ' '); comp++; } }
private void Recherche(string salle, string login, string nom, string date) { string ligne, element = "", classe = "", resultat = ""; FonctionCLR Fonction = new FonctionCLR(); byte res = 0, nb = 0; button1.Text = "Patientez SVP"; button1.Enabled = false; resultat = ""; salle = salle.ToUpper(); nom = nom.ToUpper(); login = login.ToUpper(); //MessageBox.Show(comboBox1.SelectedIndex.ToString()); if (comboBox1.SelectedIndex != 0 & comboBox1.SelectedIndex != -1) { classe = correspondance[comboBox1.SelectedIndex - 1]; //MessageBox.Show(classe); res++; } if (salle != "") { res++; } if (login != "") { res++; } if (nom != "") { res++; } if (date != "") { res++; } DirectoryInfo di = new DirectoryInfo("."); FileInfo[] rgFiles = di.GetFiles("*.txt"); foreach (FileInfo fi in rgFiles) { FonctionFichierBinaireCLR fichier = new FonctionFichierBinaireCLR(fi.Name); while (fichier.EndOfStream != true) { ligne = fichier.LireLigne(); nb = 0; if (salle != "") { Fonction.element(ligne, 0, out element, '-'); if (element == salle) { nb++; } } if (comboBox1.SelectedIndex != 0 & comboBox1.SelectedIndex != -1) { Fonction.element(ligne, 1, out element, ','); if (element == classe) { nb++; } } if (login != "") { Fonction.element(ligne, 2, out element, ','); if (element == login) { nb++; } } if (nom != "") { Fonction.element(ligne, 3, out element, ','); if (element.Contains(nom) == true) { nb++; } } if (date != "") { Fonction.element(ligne, 4, out element, ','); if (element.Contains(date) == true) { nb++; } } if (nb == res) { resultat += ligne; resultat += "\n"; } } fichier.Ferme(); } button1.Enabled = true; button1.Text = "Recherche"; richTextBox1.Text = resultat; }