//===================================================================== //===================================================================== private void ChargerProfils() { //----------------------------------------------- // ajouter le profil par defaut AjouterProfil( "Défaut", // Nom par défaut "", "", 255, // Opacité par défaut "", "", "", "" ); // Liste les profils string[] listeprofil = Directory.GetFiles(FOLDER_PROFILS, "*.ini"); foreach (string fileprofil in listeprofil) { // Instance un ini avec l'ini traité Ini fileprofilini = new Ini(); fileprofilini.SetFile(fileprofil); // Récupère l'oppacity (255 en cas de problème) string opacity = fileprofilini.ReadKey("Settings", "Opacity"); int opacityint = 255; try { opacityint = Convert.ToInt32(opacity); } catch { } // Récupère tout les autres parametres AjouterProfil( fileprofilini.ReadKey("Settings", "Name"), fileprofilini.ReadKey("Settings", "Wallpaper"), fileprofilini.ReadKey("Settings", "Description"), opacityint, fileprofilini.ReadKey("Settings", "CommandCmd"), fileprofilini.ReadKey("Settings", "CommandPS"), fileprofilini.ReadKey("Settings", "Directory"), fileprofil ); } // Defini l'ancien profil selectionner string lastprofil = IniConfig.ReadKey("Options", "LastProfilSelected"); foreach (Profil profil in ListeProfils) { // Cherche le profil par rapport à son fichier if (profil.FichierIni == lastprofil) { DefinirProfil(profil); } } // Defini le profil par defaut if (CurrentProfil == null) { DefinirProfil(ListeProfils[0]); } //----------------------------------------------- }
//===================================================================== //===================================================================== // Initalisation private void Menu_Load(object sender, EventArgs e) { //----------------------------------------------- // Verifi que ça soit windows 10 // Seule la nouvelle console de windows 10 peut être modifiée comme tel try { var reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion"); string productName = (string)reg.GetValue("ProductName"); if (!productName.Contains("Windows 10")) { Message_FataleError("Compatible uniquement avec Windows 10 et plus."); } } catch { Message_FataleError("Impossible de vérifier la version de Windows."); } //----------------------------------------------- //----------------------------------------------- // Force la nouvelle console try { var cle = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Console", true); cle.SetValue("ForceV2", 1); cle.Close(); } catch { Message_FataleError("Impossible d'accéder au registre pour activer la nouvelle console."); } //----------------------------------------------- //----------------------------------------------- // Verifi si admin if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator)) { this.Text += " (Administrateur)"; } //----------------------------------------------- //----------------------------------------------- // Créer les dossier de l'application if (!Directory.Exists(FOLDER_INSTALL)) { Directory.CreateDirectory(FOLDER_INSTALL); } if (!Directory.Exists(FOLDER_PROFILS)) { Directory.CreateDirectory(FOLDER_PROFILS); } //----------------------------------------------- //----------------------------------------------- // Charge les parametres preenregistrés IniConfig.SetFile(FILE_CONFIG); ChargerProfils(); ChargerRaccourci(); //Les shells ne peuvent pas depasser la taille de lecran principal this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); // Demarre deux fenetre par defaut AjouterInstancePS(); AjouterInstanceCmd(); TreeListeOnglets.ExpandAll(); //----------------------------------------------- }