Example #1
0
        private void btnAfficher_Click(object sender, EventArgs e)
        {
            if (!affichageTempsReel)
            {
                Replay                  = new EventsReplay();
                timerAffichage          = new System.Windows.Forms.Timer();
                timerAffichage.Interval = 1000;
                timerAffichage.Tick    += timerAffichage_Tick;
                timerAffichage.Start();

                Robots.MainRobot.Historique.NouveauLog += Replay.AjouterEvent;

                btnCharger.Enabled = false;
                btnAfficher.Text   = "Arrêter l'affichage";
                btnAfficher.Image  = Properties.Resources.Pause16;
                affichageTempsReel = true;
            }
            else
            {
                timerAffichage.Stop();

                Robots.MainRobot.Historique.NouveauLog -= Replay.AjouterEvent;

                btnCharger.Enabled = true;
                btnAfficher.Text   = "Afficher temps réel";
                btnAfficher.Image  = Properties.Resources.Play16;
                affichageTempsReel = false;
            }
        }
Example #2
0
        public void ChargerLog(String fichier)
        {
            EventsReplay replayTemp = new EventsReplay();

            replayTemp.Charger(fichier);

            foreach (HistoLigne t in replayTemp.Events)
            {
                Replay.Events.Add(t);
            }
        }
Example #3
0
        public PanelLogsEvents()
        {
            InitializeComponent();

            dataGridViewLog.Columns.Add("Id", "Id");
            dataGridViewLog.Columns[0].Width = 50;
            dataGridViewLog.Columns.Add("Heure", "Heure");
            dataGridViewLog.Columns[1].Width = 80;
            dataGridViewLog.Columns.Add("Robot", "Robot");
            dataGridViewLog.Columns[2].Width = 80;
            dataGridViewLog.Columns.Add("Type", "Type");
            dataGridViewLog.Columns[3].Width = 80;
            dataGridViewLog.Columns.Add("Message", "Message");
            dataGridViewLog.Columns[4].Width = 520;

            couleurRobot = new Dictionary<IDRobot, Color>();
            couleurRobot.Add(IDRobot.GrosRobot, Color.LightBlue);

            couleurTypeLog = new Dictionary<TypeLog, Color>();
            couleurTypeLog.Add(TypeLog.Action, Color.Lavender);
            couleurTypeLog.Add(TypeLog.PathFinding, Color.Khaki);
            couleurTypeLog.Add(TypeLog.Strat, Color.IndianRed);

            dicRobotsAutorises = new Dictionary<IDRobot, bool>();
            dicTypesAutorises = new Dictionary<TypeLog, bool>();

            // L'ajout de champs déclenche le SetCheck event qui ajoute les éléments automatiquement dans le dictionnaire
            foreach (TypeLog type in Enum.GetValues(typeof(TypeLog)))
            {
                checkedListBoxEvents.Items.Add(type.ToString(), true);
            }
            foreach (IDRobot robot in Enum.GetValues(typeof(IDRobot)))
            {
                checkedListBoxRobots.Items.Add(robot.ToString(), true);
            }
            Replay = new EventsReplay();
        }
Example #4
0
        public PageLogsEvents()
        {
            InitializeComponent();

            dataGridViewLog.Columns.Add("Id", "Id");
            dataGridViewLog.Columns[0].Width = 50;
            dataGridViewLog.Columns.Add("Heure", "Heure");
            dataGridViewLog.Columns[1].Width = 80;
            dataGridViewLog.Columns.Add("Robot", "Robot");
            dataGridViewLog.Columns[2].Width = 80;
            dataGridViewLog.Columns.Add("Type", "Type");
            dataGridViewLog.Columns[3].Width = 80;
            dataGridViewLog.Columns.Add("Message", "Message");
            dataGridViewLog.Columns[4].Width = 520;

            couleurRobot = new Dictionary <IDRobot, Color>();
            couleurRobot.Add(IDRobot.GrosRobot, Color.LightBlue);

            couleurTypeLog = new Dictionary <TypeLog, Color>();
            couleurTypeLog.Add(TypeLog.Action, Color.Lavender);
            couleurTypeLog.Add(TypeLog.PathFinding, Color.Khaki);
            couleurTypeLog.Add(TypeLog.Strat, Color.IndianRed);

            dicRobotsAutorises = new Dictionary <IDRobot, bool>();
            dicTypesAutorises  = new Dictionary <TypeLog, bool>();

            // L'ajout de champs déclenche le SetCheck event qui ajoute les éléments automatiquement dans le dictionnaire
            foreach (TypeLog type in Enum.GetValues(typeof(TypeLog)))
            {
                checkedListBoxEvents.Items.Add(type.ToString(), true);
            }
            foreach (IDRobot robot in Enum.GetValues(typeof(IDRobot)))
            {
                checkedListBoxRobots.Items.Add(robot.ToString(), true);
            }
            Replay = new EventsReplay();
        }
Example #5
0
        private void btnAfficher_Click(object sender, EventArgs e)
        {
            if (!affichageTempsReel)
            {
                Replay = new EventsReplay();
                timerAffichage = new System.Windows.Forms.Timer();
                timerAffichage.Interval = 1000;
                timerAffichage.Tick += timerAffichage_Tick;
                timerAffichage.Start();

                Robots.GrosRobot.Historique.NouveauLog += Replay.AjouterEvent;

                btnCharger.Enabled = false;
                btnAfficher.Text = "Arrêter l'affichage";
                affichageTempsReel = true;
            }
            else
            {
                timerAffichage.Stop();

                Robots.GrosRobot.Historique.NouveauLog -= Replay.AjouterEvent;

                btnCharger.Enabled = true;
                btnAfficher.Text = "Afficher temps réel";
                affichageTempsReel = false;
            }
        }
Example #6
0
 public void Clear()
 {
     Replay = new EventsReplay();
 }
Example #7
0
        public void ChargerLog(String fichier)
        {
            EventsReplay replayTemp = new EventsReplay();
            replayTemp.Charger(fichier);

            foreach (HistoLigne t in replayTemp.Events)
                Replay.Events.Add(t);
        }
Example #8
0
 public void Clear()
 {
     Replay = new EventsReplay();
 }
Example #9
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            plusVieux = DateTime.Now;

            int currentLog = 0;

            List <String> dossiers = (List <String>)Directory.EnumerateDirectories(Config.PathData + @"\Logs\").ToList <String>();

            nbLogs = dossiers.Count;

            dossiers.Sort(OrdreAlphabetiqueInverse);

            foreach (String dossier in dossiers)
            {
                if (dossier.Contains(Execution.LaunchStartString))
                {
                    continue;
                }

                if (Execution.Shutdown)
                {
                    return;
                }

                currentLog++;
                String   dossier1 = Path.GetFileName(dossier);
                DateTime date;

                int nbElements = 0;

                try
                {
                    String[] tab = dossier1.Split(new char[5] {
                        '.', ' ', 'h', 'm', 's'
                    });
                    date = new DateTime(Convert.ToInt16(tab[0]), Convert.ToInt16(tab[1]), Convert.ToInt16(tab[2]), Convert.ToInt16(tab[3]), Convert.ToInt16(tab[4]), Convert.ToInt16(tab[5]));

                    if (date < plusVieux)
                    {
                        plusVieux = date;
                    }

                    long taille = FolderSize(dossier);

                    Object[] datas = new Object[Enum.GetValues(typeof(Columns)).Length];

                    datas[(int)Columns.Date]   = date;
                    datas[(int)Columns.Taille] = new TailleDossier(taille);
                    //TODO2018 ca marche plus ça avec les nouveaux fichiers
                    foreach (String fichier in Directory.EnumerateFiles(dossier))
                    {
                        if (Path.GetFileName(fichier) == "ActionsGros.elog")
                        {
                            EventsReplay r = new EventsReplay();
                            if (r.Charger(fichier))
                            {
                                datas[(int)Columns.Events] = r.Events.Count;
                                nbElements += r.Events.Count;
                            }
                            else
                            {
                                datas[(int)Columns.Events] = -1;
                            }
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionGB.tlog")
                        {
                            FramesLog r = new FramesLog();
                            r.Import(fichier);
                            if (r.Import(fichier))
                            {
                                datas[(int)Columns.TramesGB] = r.Frames.Count;
                                nbElements += r.Frames.Count;
                            }
                            else
                            {
                                datas[(int)Columns.TramesGB] = -1;
                            }
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionMove.tlog")
                        {
                            FramesLog r = new FramesLog();
                            r.Import(fichier);
                            if (r.Import(fichier))
                            {
                                datas[(int)Columns.TramesMove] = r.Frames.Count;
                                nbElements += r.Frames.Count;
                            }
                            else
                            {
                                datas[(int)Columns.TramesMove] = -1;
                            }
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionIO.tlog")
                        {
                            FramesLog r = new FramesLog();
                            r.Import(fichier);
                            if (r.Import(fichier))
                            {
                                datas[(int)Columns.TramesIO] = r.Frames.Count;
                                nbElements += r.Frames.Count;
                            }
                            else
                            {
                                datas[(int)Columns.TramesIO] = -1;
                            }
                        }
                    }

                    // S'il y a moins de 10 éléments dans ce log, on le supprime
                    if (nbElements < 10)
                    {
                        Directory.Delete(dossier, true);
                    }
                    else
                    {
                        dataSet.Tables[0].Rows.Add(datas);
                    }
                }
                catch (Exception)
                {
                }

                worker.ReportProgress((int)(currentLog * 100 / nbLogs));
            }

            if (Directory.Exists(Config.PathData + "/Archives/"))
            {
                foreach (String dossier in Directory.EnumerateDirectories(Config.PathData + "/Archives/"))
                {
                    if (Execution.Shutdown)
                    {
                        return;
                    }

                    currentLog++;
                    String   dossier1 = Path.GetFileName(dossier);
                    DateTime date;

                    try
                    {
                        String[] tab = dossier1.Split(new char[5] {
                            '.', ' ', 'h', 'm', 's'
                        });
                        date = new DateTime(Convert.ToInt16(tab[0]), Convert.ToInt16(tab[1]), Convert.ToInt16(tab[2]), Convert.ToInt16(tab[3]), Convert.ToInt16(tab[4]), Convert.ToInt16(tab[5]));

                        if (date < plusVieux)
                        {
                            plusVieux = date;
                        }

                        long taille = FolderSize(dossier);

                        Object[] datas = new Object[Enum.GetValues(typeof(Columns)).Length + 1];

                        datas[(int)Columns.Date + 1]   = date;
                        datas[(int)Columns.Taille + 1] = new TailleDossier(taille);

                        foreach (String fichier in Directory.EnumerateFiles(dossier))
                        {
                            if (Path.GetFileName(fichier) == "ActionsGros.elog")
                            {
                                EventsReplay r = new EventsReplay();
                                if (r.Charger(fichier))
                                {
                                    datas[(int)Columns.Events + 1] = r.Events.Count;
                                }
                                else
                                {
                                    datas[(int)Columns.Events + 1] = -1;
                                }
                            }
                            else if (Path.GetFileName(fichier) == "ConnexionGB.tlog")
                            {
                                FramesLog r = new FramesLog();
                                r.Import(fichier);
                                if (r.Import(fichier))
                                {
                                    datas[(int)Columns.TramesGB + 1] = r.Frames.Count;
                                }
                                else
                                {
                                    datas[(int)Columns.TramesGB + 1] = -1;
                                }
                            }
                            else if (Path.GetFileName(fichier) == "ConnexionMove.tlog")
                            {
                                FramesLog r = new FramesLog();
                                r.Import(fichier);
                                if (r.Import(fichier))
                                {
                                    datas[(int)Columns.TramesMove + 1] = r.Frames.Count;
                                }
                                else
                                {
                                    datas[(int)Columns.TramesMove + 1] = -1;
                                }
                            }
                            else if (Path.GetFileName(fichier) == "ConnexionIO.tlog")
                            {
                                FramesLog r = new FramesLog();
                                r.Import(fichier);
                                if (r.Import(fichier))
                                {
                                    datas[(int)Columns.TramesIO + 1] = r.Frames.Count;
                                }
                                else
                                {
                                    datas[(int)Columns.TramesIO + 1] = -1;
                                }
                            }
                            else if (Path.GetFileName(fichier) == "Archivage")
                            {
                                StreamReader reader = new StreamReader(fichier);
                                datas[0] = reader.ReadLine();
                                reader.Close();
                            }
                        }

                        dataSetArchivage.Tables[0].Rows.Add(datas);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Example #10
0
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            plusVieux = DateTime.Now;

            int currentLog = 0;

            List<String> dossiers = (List<String>)Directory.EnumerateDirectories(Config.PathData + "/Logs/").ToList<String>();
            nbLogs = dossiers.Count;

            dossiers.Sort(OrdreAlphabetiqueInverse);

            foreach (String dossier in dossiers)
            {
                if (Config.Shutdown)
                    return;

                currentLog++;
                String dossier1 = Path.GetFileName(dossier);
                DateTime date;

                int nbElements = 0;

                try
                {
                    String[] tab = dossier1.Split(new char[5] { '.', ' ', 'h', 'm', 's' });
                    date = new DateTime(Convert.ToInt16(tab[0]), Convert.ToInt16(tab[1]), Convert.ToInt16(tab[2]), Convert.ToInt16(tab[3]), Convert.ToInt16(tab[4]), Convert.ToInt16(tab[5]));

                    if (date < plusVieux)
                        plusVieux = date;

                    long taille = FolderSize(dossier);

                    Object[] datas = new Object[7];

                    datas[0] = date;
                    datas[1] = new TailleDossier(taille);

                    foreach (String fichier in Directory.EnumerateFiles(dossier))
                    {
                        if (Path.GetFileName(fichier) == "ActionsGros.elog")
                        {
                            EventsReplay r = new EventsReplay();
                            if (r.Charger(fichier))
                            {
                                datas[5] = r.Events.Count;
                                nbElements += r.Events.Count;
                            }
                            else
                                datas[5] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ActionsPetit.elog")
                        {
                            EventsReplay r = new EventsReplay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                            {
                                datas[6] = r.Events.Count;
                                nbElements += r.Events.Count;
                            }
                            else
                                datas[6] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionPi.tlog")
                        {
                            Replay r = new Replay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                            {
                                datas[3] = r.Trames.Count;
                                nbElements += r.Trames.Count;
                            }
                            else
                                datas[3] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionMove.tlog")
                        {
                            Replay r = new Replay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                            {
                                datas[2] = r.Trames.Count;
                                nbElements += r.Trames.Count;
                            }
                            else
                                datas[2] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionMiwi.tlog")
                        {
                            Replay r = new Replay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                            {
                                datas[4] = r.Trames.Count;
                                nbElements += r.Trames.Count;
                            }
                            else
                                datas[4] = -1;
                        }
                    }

                    // Si il n'y a aucune trame ni aucun evenement dans le dossier, on le supprime
                    if (nbElements == 0)
                        Directory.Delete(dossier);
                    else
                        dataSet.Tables[0].Rows.Add(datas);
                }
                catch (Exception)
                {
                }

                worker.ReportProgress((int)(currentLog * 100 / nbLogs));
            }

            foreach (String dossier in Directory.EnumerateDirectories(Config.PathData + "/Archives/"))
            {
                if (Config.Shutdown)
                    return;

                currentLog++;
                String dossier1 = Path.GetFileName(dossier);
                DateTime date;

                try
                {
                    String[] tab = dossier1.Split(new char[5] { '.', ' ', 'h', 'm', 's' });
                    date = new DateTime(Convert.ToInt16(tab[0]), Convert.ToInt16(tab[1]), Convert.ToInt16(tab[2]), Convert.ToInt16(tab[3]), Convert.ToInt16(tab[4]), Convert.ToInt16(tab[5]));

                    if (date < plusVieux)
                        plusVieux = date;

                    long taille = FolderSize(dossier);

                    Object[] datas = new Object[8];

                    datas[1] = date;
                    datas[2] = new TailleDossier(taille);

                    foreach (String fichier in Directory.EnumerateFiles(dossier))
                    {
                        if (Path.GetFileName(fichier) == "ActionsGros.elog")
                        {
                            EventsReplay r = new EventsReplay();
                            if (r.Charger(fichier))
                                datas[6] = r.Events.Count;
                            else
                                datas[6] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ActionsPetit.elog")
                        {
                            EventsReplay r = new EventsReplay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                                datas[7] = r.Events.Count;
                            else
                                datas[7] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionPi.tlog")
                        {
                            Replay r = new Replay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                                datas[4] = r.Trames.Count;
                            else
                                datas[4] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionMove.tlog")
                        {
                            Replay r = new Replay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                                datas[3] = r.Trames.Count;
                            else
                                datas[3] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "ConnexionMiwi.tlog")
                        {
                            Replay r = new Replay();
                            r.Charger(fichier);
                            if (r.Charger(fichier))
                                datas[5] = r.Trames.Count;
                            else
                                datas[5] = -1;
                        }
                        else if (Path.GetFileName(fichier) == "Archivage")
                        {
                            StreamReader reader = new StreamReader(fichier);
                            datas[0] = reader.ReadLine();
                            reader.Close();
                        }
                    }

                    dataSetArchivage.Tables[0].Rows.Add(datas);
                }
                catch (Exception)
                {
                }
            }
        }