/// <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 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(); } }