public void Install(string pcName, string softType, string modelName)
        {
            if (Settings2.Default.scriptFolder == "")
            {
                MessageBox.Show("Необходимо указать папку для создания временных скриптов.");
                return;
            }
            //check for psExec extention
            if (Settings2.Default.psExec_Path == "")
            {
                OpenFileDialog open = new OpenFileDialog();
                open.Filter      = "EXE(*.exe) |*.exe";
                open.Title       = "Укажите размещение psExec";
                open.FilterIndex = 2;
                if (open.ShowDialog() == true)
                {
                    Settings2.Default.psExec_Path = open.FileName;
                    Settings2.Default.Save();
                }
            }
            if (password.Length < 1)
            {
                pass = new Password();
                if (pass.ShowDialog() == true)
                {
                    password = pass.Pass;
                }
            }

            XMLWorker.GetXML();
            Task.Run(() => InstallDrivers(pcName, modelName));
            Task.Run(() => InstallSoft(pcName, softType));

            if (Comps.isNew(pcName))
            {
                if (CreateSettings(pcName, FindPasswords(XMLWorker.GetSettings())))
                {
                    Task.Run(() => SetSettings(pcName));
                }
                if (XMLWorker.GetBiosScript(modelName) != "" && XMLWorker.GetBiosScript(modelName) != null)
                {
                    CreateBiosSettings(pcName, FindPasswords(XMLWorker.GetBiosScript(modelName)));
                    Task.Run(() => ResetBiosPassword(pcName, modelName));
                    Task.Run(() => BiosSettingsInstalling(pcName));
                    Task.Run(() => Thread.Sleep(120000));
                    Task.Run(() => SetBiosPassword(pcName, modelName));
                }
            }
            else
            {
                if (CreateSettings(pcName, FindPasswords(XMLWorker.GetSettings())))
                {
                    Task.Run(() => SetSettings(pcName));
                }
                Finish(this, EventArgs.Empty);
            }
        }
        public SettingsWindow()
        {
            InitializeComponent();

            XMLWorker.GetXML();
            foreach (string s in XMLWorker.GetProgramTypes())
            {
                SoftType.Items.Add(s);
            }
            PsText.Text              = XMLWorker.GetSettings();
            Path_PsExec.Text         = Settings2.Default.psExec_Path;
            ScriptFolder.Text        = Settings2.Default.scriptFolder;
            DataBase.CreateNewModel += UpdateModelsList;
            SetModels();
        }
 private bool CreateSettings(string pcName, string settings)
 {
     if (XMLWorker.GetSettings() != "")
     {
         string   psPath = $@"{Settings2.Default.scriptFolder}\{pcName}_Settings.ps1";
         FileInfo psFile = new FileInfo(psPath);//same for PS script
         if (psFile.Exists)
         {
             psFile.Delete();
         }
         File.AppendAllText(psPath, settings);
         allPath.Add(psPath);
         return(true);
     }
     else
     {
         return(false);
     }
 }