예제 #1
0
        private Settings GetSettings()
        {
            //Meno a heslo - pamatat si
            Properties.Settings.Default.UserName = tbUserName.Text;
            Properties.Settings.Default.Password = SecurityUtilities.EncryptString(tbPassword.Text);
            Properties.Settings.Default.Save();

            //Kontrola ak vložená URL adresa je validna
            if (!Utilities.IsUrlValid(tbURL.Text))
            {
                UpdateStatusText("Invalid URL! Make sure you start with http://");
                return(null);
            }

            string ReportDestinationFolder = Utilities.GetFolderSelection();

            if (ReportDestinationFolder == string.Empty || !System.IO.Directory.Exists(ReportDestinationFolder))
            {
                //Chyba neplatného adresára
                UpdateStatusText("Invalid Directory! Please try again and select a correct directory.");
                return(null);
            }

            string fname = DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_TestResult" + (fileCounter++);

            Settings Settings = new Settings(this);

            Settings.UserName = tbUserName.Text;
            Settings.Password = tbPassword.Text;
            Settings.Depth    = Convert.ToInt16(tbDepth.Text);
            Settings.URL      = tbURL.Text;
            Settings.ReportId = @"\TestResult.txt";
            Settings.ReportDestinationFolder = ReportDestinationFolder + @"\Report\" + fname;

            //Výstup do MainForm
            tbSavePath.Text = Settings.ReportDestinationFolder + Settings.ReportId;

            return(Settings);
        }