public Aleph ReadConfigAleph() { using (StreamReader streamReader = new StreamReader("ConfigConnect")) { aleph = new Aleph(); string text; while ((text = streamReader.ReadLine()) != null) { if (text.Contains("=")) { string text2 = text.Substring(0, text.IndexOf("=")); switch (text2.ToLower()) { case "urlaleph": aleph.UrlAleph = getField(text); break; case "library": aleph.Library = getField(text); break; case "updateflag": aleph.UpdateFlag = getField(text); break; } } } } return(aleph); }
private void UpdateConfigDatabase() { List <string> list = new List <string>(); using (StreamReader streamReader = new StreamReader("ConfigConnect")) { string item; while ((item = streamReader.ReadLine()) != null) { list.Add(item); } } using (StreamWriter streamWriter = new StreamWriter("ConfigConnect")) { aleph = new Aleph(); aleph.UrlAleph = txtUrl.Text; aleph.Library = txtLibrary.Text; aleph.UpdateFlag = txtFlag.Text; foreach (string item2 in list) { if (!item2.Contains("=")) { streamWriter.WriteLine(item2); } else { string text = item2.Substring(0, item2.IndexOf("=")); switch (text.ToLower()) { case "urlaleph": streamWriter.WriteLine("UrlAleph=" + aleph.UrlAleph); break; case "library": streamWriter.WriteLine("Library=" + aleph.Library); break; case "updateflag": streamWriter.WriteLine("UpdateFlag=" + aleph.UpdateFlag); break; default: streamWriter.WriteLine(item2); break; } } } } MessageBox.Show("Lưu thành công"); }
private bool TestConnecting() { bool result = false; try { Aleph aleph = new Aleph(); aleph.UrlAleph = txtUrl.Text; aleph.Library = txtLibrary.Text; aleph.UpdateFlag = txtFlag.Text; result = new CheckUrl().CheckUrlExist(aleph.UrlAleph); } catch (Exception ex) { lbStatus.ForeColor = Color.Red; lbStatus.Text = "Connection failed"; MessageBox.Show("Lỗi: " + ex.Message, "Thông báo!"); } return(result); }
public AlephUploadPatronAPI() { log4net.Config.BasicConfigurator.Configure(); log.Info(""); aleph = new ReadWriterConfig().ReadConfigAleph(); }
private bool ValidateExistUrl() { aleph = new ReadWriterConfig().ReadConfigAleph(); return(validateUrlAleph = new CheckUrl().CheckUrlExist(aleph.UrlAleph)); }