private void pictureBox37_Click(object sender, EventArgs e) { if (listBox_ListingProfil.SelectedItem == null || (GOSLauncherCore.fenetrePrincipale.listBox_ListingProfil.SelectedItem as ComboboxItem).Value.ToString() == "" ) { var infoBox = MessageBox.Show("ERREUR INTERNE. Vous devez selectionner un profil à copier.", "Erreur copie profil", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string nomProfilOriginal= (GOSLauncherCore.fenetrePrincipale.listBox_ListingProfil.SelectedItem as ComboboxItem).Value.ToString(); GOSLauncherCore.nomProfilRename = "Copie de " + nomProfilOriginal; Form renameForm = new renameProfil(); renameForm.ShowDialog(); if (renameForm.DialogResult == DialogResult.Cancel || renameForm.DialogResult == DialogResult.Abort) { var infoBox = MessageBox.Show("Operation abandonnée", "Erreur copie profil", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { File.Copy(GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + nomProfilOriginal + ".profil.xml", GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + GOSLauncherCore.nomProfilRename + ".profil.xml"); } catch { var infoBox = MessageBox.Show("Le profil n a pas été copié. Le nom existe surement deja", "Erreur copie profil", MessageBoxButtons.OK, MessageBoxIcon.Error); } string profilactif = (GOSLauncherCore.fenetrePrincipale.comboBox4.SelectedItem as ComboboxItem).Text.ToString(); Interface.initialiseListeProfil(); int compteur = 0; foreach (ComboboxItem profil in GOSLauncherCore.fenetrePrincipale.comboBox4.Items) { if (profil.Text.ToString() == profilactif) { GOSLauncherCore.fenetrePrincipale.comboBox4.SelectedIndex = compteur; }; compteur++; } } } }
private void pictureBox31_Click(object sender, EventArgs e) { if (listBox_ListingProfil.SelectedItem == null || (GOSLauncherCore.fenetrePrincipale.listBox_ListingProfil.SelectedItem as ComboboxItem).Value.ToString() == "" || (GOSLauncherCore.fenetrePrincipale.listBox_ListingProfil.SelectedItem as ComboboxItem).Value.ToString() == "defaut" || (GOSLauncherCore.fenetrePrincipale.listBox_ListingProfil.SelectedItem as ComboboxItem).Text.ToString() == (GOSLauncherCore.fenetrePrincipale.comboBox4.SelectedItem as ComboboxItem).Text.ToString()) { var infoBox = MessageBox.Show("Impossible de renommer ce profil si il est celui par defaut ou celui actif.", "Erreur renommage profil", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { GOSLauncherCore.nomProfilRename=(GOSLauncherCore.fenetrePrincipale.listBox_ListingProfil.SelectedItem as ComboboxItem).Value.ToString(); string nomProfilOriginal = GOSLauncherCore.nomProfilRename; Form renameForm = new renameProfil(); renameForm.ShowDialog(); if (nomProfilOriginal == GOSLauncherCore.nomProfilRename) { var infoBox = MessageBox.Show("Le nom de profil n a pas été modifié", "Erreur renommage profil", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { File.Copy(GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + nomProfilOriginal + ".profil.xml", GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + GOSLauncherCore.nomProfilRename + ".profil.xml"); File.Delete(GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + nomProfilOriginal + ".profil.xml"); File.Copy(GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + nomProfilOriginal + ".profilServeur.xml", GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + GOSLauncherCore.nomProfilRename + ".profilServeur.xml"); File.Delete(GOSLauncherCore.cheminARMA3 + @"\userconfig\GOS-LauncherA3\" + nomProfilOriginal + ".profilServeur.xml"); } catch { } string profilactif = (GOSLauncherCore.fenetrePrincipale.comboBox4.SelectedItem as ComboboxItem).Text.ToString(); Interface.initialiseListeProfil(); int compteur = 0; foreach (ComboboxItem profil in GOSLauncherCore.fenetrePrincipale.comboBox4.Items) { if (profil.Text.ToString() == profilactif) { GOSLauncherCore.fenetrePrincipale.comboBox4.SelectedIndex = compteur; }; compteur++; } } } }