Ejemplo n.º 1
0
        /// <summary>
        /// Check whether the user and Live server URL enter is valid or not
        /// Input: User given data Username, password and Live Server URL
        /// Output: Check the given compination of username, password and URL are correct or not
        /// </summary>
        /// <returns></returns>
        public bool CheckLoginLive()
        {
            //System.Threading.Thread.Sleep(1000);
            try
            {
                System.Diagnostics.Process          chkLog      = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startchkLog = new System.Diagnostics.ProcessStartInfo();
                startchkLog.CreateNoWindow = true;
                startchkLog.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                startchkLog.FileName       = "cmd.exe";
                startchkLog.Arguments      = "/C svn list \"" + LiveURL.Trim() + "\" --username " + UserName.Trim() + " --password " + Password.Trim();
                chkLog.StartInfo           = startchkLog;

                chkLog.StartInfo.RedirectStandardOutput = true;
                chkLog.StartInfo.RedirectStandardError  = true;
                chkLog.StartInfo.UseShellExecute        = false;
                chkLog.Start();

                StringBuilder ch = new StringBuilder();
                while (!chkLog.HasExited)
                {
                    ch.Append(chkLog.StandardOutput.ReadToEnd());
                    ch.Append(chkLog.StandardError.ReadToEnd());
                }

                String login = ch.ToString().Trim();
                chkLog.WaitForExit();

                chkLog      = null;
                startchkLog = null;

                if (login.Contains("E175013") || login.Contains("E155007") || login.Contains("E230001") || login.Contains("E175002") || login.Contains("E731004") || login.Contains("E120171") || login.Contains("E020024"))
                {
                    MessageBox.Show("User credentials or Live Repository URL is invalid.", "Invalid Input!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception login)
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check out the files from Live SVN repository for particular date, here we had used commandprompt command to do so
        /// Input: User details username, password, backup/restored date and live svn server url
        /// Output: Checking out the files from Live SVN repository
        /// </summary>
        public void mtdChkLive()
        {
            try
            {
                System.Diagnostics.Process          process   = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.CreateNoWindow = true;
                startInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.FileName       = "cmd.exe";
                startInfo.Arguments      = "/C svn co -r {\"" + BackupDate + " 23:59:59\"} " + LiveURL.Trim() + " \"" + LocalDrive.Trim() + "\\svn-compare\\checkout\" --username " + UserName.Trim() + " --password " + Password.Trim();
                process.StartInfo        = startInfo;

                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.UseShellExecute        = false;
                process.Start();


                StringBuilder proc = new StringBuilder();
                while (!process.HasExited)
                {
                    proc.Append(process.StandardOutput.ReadToEnd());
                }

                ChkLiveCmd = "\n" + startInfo.Arguments.Replace(" --password " + Password, " --password *******");
                ChkLive    = "\n" + proc.ToString().Trim();

                liveVersion   = FindVersion(ChkLive).ToString().Split(' ').Last().Replace(".", "");
                totalLiveFile = TotalFiles(ChkLive).ToString();

                startInfo = null;
                process   = null;
            }
            catch (Exception chklive)
            {
                Error = chklive.Message.ToString();
            }
        }