Beispiel #1
0
        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);
        }
Beispiel #2
0
        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");
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public AlephUploadPatronAPI()
 {
     log4net.Config.BasicConfigurator.Configure();
     log.Info("");
     aleph = new ReadWriterConfig().ReadConfigAleph();
 }
Beispiel #5
0
 private bool ValidateExistUrl()
 {
     aleph = new ReadWriterConfig().ReadConfigAleph();
     return(validateUrlAleph = new CheckUrl().CheckUrlExist(aleph.UrlAleph));
 }