public static void OptionsRead()
{
XmlDocument reader = new XmlDocument();
reader.Load("options.xml");
if (File.Exists("options.xml") == false)
File.Create("options.xml");
#region Пути к установкам
//пути к установкам BB
foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/PathToFolderWhereToInstall/edition[@title='BB']"))
{
OptionsForm.form.tbPathBB_mysql.Text = el.SelectSingleNode("mysql") != null ? el.SelectSingleNode("mysql").InnerText : "";
}
#endregion
#region Урлы установок
//BB
foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/URLS/edition[@title='BB']"))
{
OptionsForm.form.tbURL_BB_mysql.Text = el.SelectSingleNode("mysql") != null ? el.SelectSingleNode("mysql").InnerText : "";
}
#endregion
//строки подключения к базам
OptionsForm.form.tbConString_mysql.Text = reader.GetValue("/Options/ConnectionString/mysql");
OptionsForm.form.tbConString_mysql_port.Text = reader.GetValue("/Options/ConnectionString/mysql_port");
//путь к firefox.exe и профилю
OptionsForm.form.tbPathToFfExe.Text = reader.GetValue("/Options/firefox_options/pathToFirefoxExe");
OptionsForm.form.tbPathToFfProfile.Text = reader.GetValue("/Options/firefox_options/pathToFirefoxProfile");
#region пользователи
foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/users/user[@profile='Admin']"))
{
OptionsForm.form.tb_usr_Admin_Name.Text = el.SelectSingleNode("Name").InnerText != "" ? el.SelectSingleNode("Name").InnerText : "";
OptionsForm.form.tb_usr_Admin_LastName.Text = el.SelectSingleNode("LastName").InnerText != "" ? el.SelectSingleNode("LastName").InnerText : "";
OptionsForm.form.tb_usr_Admin_Email.Text = el.SelectSingleNode("Email").InnerText != "" ? el.SelectSingleNode("Email").InnerText : "";
OptionsForm.form.tb_usr_Admin_Login.Text = el.SelectSingleNode("Login").InnerText != "" ? el.SelectSingleNode("Login").InnerText : "admin";
OptionsForm.form.tb_usr_Admin_Password.Text = el.SelectSingleNode("Password").InnerText != "" ? el.SelectSingleNode("Password").InnerText : "111111";
OptionsForm.form.tb_usr_Admin_Ava.Text = el.SelectSingleNode("Avatar").InnerText != "" ? el.SelectSingleNode("Avatar").InnerText : "";
}
foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/users/user[@profile='Intra1']"))
{
OptionsForm.form.tb_usr_Intra1_Name.Text = el.SelectSingleNode("Name").InnerText != "" ? el.SelectSingleNode("Name").InnerText : "Семен";
OptionsForm.form.tb_usr_Intra1_LastName.Text = el.SelectSingleNode("LastName").InnerText != "" ? el.SelectSingleNode("LastName").InnerText : "Синичкин";
OptionsForm.form.tb_usr_Intra1_Email.Text = el.SelectSingleNode("Email").InnerText != "" ? el.SelectSingleNode("Email").InnerText : "";
OptionsForm.form.tb_usr_Intra1_Login.Text = el.SelectSingleNode("Login").InnerText != "" ? el.SelectSingleNode("Login").InnerText : "semen";
OptionsForm.form.tb_usr_Intra1_Password.Text = el.SelectSingleNode("Password").InnerText != "" ? el.SelectSingleNode("Password").InnerText : "111111";
OptionsForm.form.tb_usr_Intra1_Ava.Text = el.SelectSingleNode("Avatar").InnerText != "" ? el.SelectSingleNode("Avatar").InnerText : "avatar_semen.jpg";
}
foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/users/user[@profile='Intra2']"))
{
OptionsForm.form.tb_usr_Intra2_Name.Text = el.SelectSingleNode("Name").InnerText != "" ? el.SelectSingleNode("Name").InnerText : "Иван";
OptionsForm.form.tb_usr_Intra2_LastName.Text = el.SelectSingleNode("LastName").InnerText != "" ? el.SelectSingleNode("LastName").InnerText : "Иванов";
OptionsForm.form.tb_usr_Intra2_Email.Text = el.SelectSingleNode("Email").InnerText != "" ? el.SelectSingleNode("Email").InnerText : "";
OptionsForm.form.tb_usr_Intra2_Login.Text = el.SelectSingleNode("Login").InnerText != "" ? el.SelectSingleNode("Login").InnerText : "ivan";
OptionsForm.form.tb_usr_Intra2_Password.Text = el.SelectSingleNode("Password").InnerText != "" ? el.SelectSingleNode("Password").InnerText : "111111";
OptionsForm.form.tb_usr_Intra2_Ava.Text = el.SelectSingleNode("Avatar").InnerText != "" ? el.SelectSingleNode("Avatar").InnerText : "avatar_ivan.jpg";
}
#endregion
//последний проверенный урл
MainForm.form.tbCheckUrlsUrlToCheck.Text = reader.GetValue("/Options/CheckUrls_options/url");
MainForm.form.tbCheckUrlsLogin.Text = reader.GetValue("/Options/CheckUrls_options/login");
MainForm.form.tbCheckUrlsPass.Text = reader.GetValue("/Options/CheckUrls_options/password");
}