Ejemplo n.º 1
0
        /// <summary>
        /// Affiche la fenetre d'ajout d'insultes
        /// </summary>
        private void btAjouter_MouseClick(object sender, MouseEventArgs e)
        {
            ajouterInsultes = new FormAjout();
            DialogResult diag = ajouterInsultes.ShowDialog();

            if (diag == DialogResult.OK)
            {
                string   sMot          = File.ReadAllText(insultesPath);
                string[] mots          = sMot.Split(',');
                string   ajoutMot      = ajouterInsultes.getMots();
                string[] splitAjoutMot = ajoutMot.Split(',');
                string   trimedWord;
                bool     inList;
                foreach (string motAAjouter in splitAjoutMot)
                {
                    trimedWord = motAAjouter.TrimStart(' ').TrimEnd(' ');
                    mots       = sMot.Split(',');
                    inList     = false;
                    foreach (string mot in mots)
                    {
                        if (trimedWord.Equals(mot))
                        {
                            inList = true;
                        }
                    }
                    if (!inList)
                    {
                        sMot += "," + trimedWord;
                    }
                }
                File.WriteAllText(insultesPath, sMot);
                MotBanniUpdate();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialisation du windows form
        /// </summary>
        private void Form1_Load(object sender, EventArgs e)
        {
            int i = 0;

            insultesPath     = "Insultes.txt";
            messagePerioPath = "MessagesPerio.txt";
            MotBanniUpdate();
            MessagePeriodiqueUpdate();
            ajouterInsultes           = new FormAjout();
            ajouterMessagesPeriodique = new FormAjoutPerio();
            ajouterVoteValues         = new FormAjoutVoteValues();
            connexionBT.FlatStyle     = FlatStyle.Flat;
            connexionBT.FlatAppearance.BorderColor = Color.Red;
            pauseBT.FlatStyle = FlatStyle.Flat;
            pauseBT.FlatAppearance.BorderColor = Color.Red;
        }