/// <summary> /// Check out the files from Backup/Restored SVN repository for particular date, here we had used commandprompt command to do so /// Input: User details username, password, backup/restored date and Backup/Restored svn server url /// Output: Checking out the files from Backup/Restored SVN repository /// </summary> public void mtdChkBack() { try { System.Diagnostics.Process chkBackup = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startChkBackup = new System.Diagnostics.ProcessStartInfo(); startChkBackup.CreateNoWindow = true; startChkBackup.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startChkBackup.FileName = "cmd.exe"; startChkBackup.Arguments = "/C svn co " + BackupURL.Trim() + " \"" + LocalDrive.Trim() + "\\svn-compare\\Backup\" --username " + UserName.Trim() + " --password " + Password.Trim(); chkBackup.StartInfo = startChkBackup; chkBackup.StartInfo.RedirectStandardOutput = true; chkBackup.StartInfo.UseShellExecute = false; chkBackup.Start(); StringBuilder chkb = new StringBuilder(); while (!chkBackup.HasExited) { chkb.Append(chkBackup.StandardOutput.ReadToEnd()); } ChkBackCmd = "\n" + startChkBackup.Arguments.Replace(" --password " + Password, " --password *******"); ChkBack = "\n" + chkb.ToString().Trim(); backVersion = FindVersion(ChkBack).ToString().Split(' ').Last().Replace(".", ""); totalBackFile = TotalFiles(ChkBack).ToString(); startChkBackup = null; chkBackup = null; } catch (Exception chkback) { Error = chkback.Message.ToString(); } }
/// <summary> /// Check whether the user and Backup/Restored server URL enter is valid or not /// Input: User given data Username, password and Backup/Restored Server URL /// Output: Check the given compination of username, password and URL are correct or not /// </summary> /// <returns></returns> public bool CheckLoginBack() { //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 \"" + BackupURL.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 Backup Repository URL is invalid.", "Invalid Input!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } else { return(true); } } catch (Exception loginback) { return(false); } }