Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* CODE QUI FAIT FOIRER */
- private void readDataFromCSV()
- {
- try
- {
- using (StreamReader sr = new StreamReader(chemin_fichiers + fichier_courant))
- {
- double[,] tab_csv = new double[nbr_lignes, nbr_colonnes];
- int i = 0;
- string currentLine;
- while ((currentLine = sr.ReadLine()) != null)
- {
- int j = 0;
- string[] string_ligne = currentLine.Split(';');
- foreach (string valeur_s in string_ligne)
- {
- if (!String.IsNullOrEmpty(valeur_s))
- {
- tab_csv[i, j] = Convert.ToDouble(valeur_s);
- j++;
- }
- }
- i++;
- }
- Couche_Impression couche_csv = new Couche_Impression(tab_csv);
- couche_csv.rang = couches.Count + 1;
- couche_csv.nom_fichier = fichier_courant;
- couche_csv.getCadresStats(cadre_poudre, cadre_pieces);
- couches.Add(couche_csv);
- }
- }
- catch(IOException)
- {}
- }
- /* CODE QUI APPELLE LE CODE QUI FAIT FOIRER */
- private void loadData()
- {
- bool condition = true;
- DateTime date_recherche = date_job;
- int i = 0;
- Console.WriteLine("date debut: " + date_job);
- Console.ReadKey();
- do
- {
- // Je regarde si un fichier existe
- date_recherche = getNextCSVFile(date_recherche);
- Console.WriteLine("Nom fichier: " + fichier_courant);
- // SI ce fichier est le 1er je check les dimensions car tous les fichiers auront les memes
- if (i == 0)
- {
- getDimensionsFromCSV(fichier_courant);
- checkLimitsWithPoints();
- }
- Console.WriteLine("je vais lire le fichier dans readDataFromCSV()");
- Console.WriteLine("date: " + date_recherche);
- // Je lis le fichier csv
- readDataFromCSV();
- Console.WriteLine("je viens de lire !");
- // J'ajoute le nom du fichier dans la liste des fichiers lus
- fichiers_lus.Add(fichier_courant);
- // J'incrémente le compteur de fichiers lus
- parent.nbr_fichier_lus++;
- if (FormSirrisUI.READ_MODE.Equals(Tools.stringValueOf(FormSirrisUI.read_mode.REAL_TIME)))
- parent.nbr_fichiers_total++;
- // Je notifie le père pour qu'il puisse refresh ce nombre dans la Form
- notifyReadFile(fichier_courant);
- // Je passe au fichier suivant
- i++;
- if (FormSirrisUI.READ_MODE.Equals(Tools.stringValueOf(FormSirrisUI.read_mode.STATIC)))
- {
- if (i < nbr_fichiers_csv)
- condition = true;
- else
- condition = false;
- }
- } while (condition);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement