Skip to content

Commit c635e16

Browse files
committed
Add pause to the update script
1 parent 267ad8a commit c635e16

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

GitAutoUpdateGUI/FormMain.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ private void buttonUpdateVSProjects_Click(object sender, EventArgs e)
631631
}
632632

633633
// TODO check if git.exe is in the PATH of the PC
634+
//var gitBinary = textBoxGitBashBinariesPath.Text;
634635

635636
Logger.Add(textBoxLog, GetTranslatedString("Updating selected projects"));
636637
if (checkBoxCreateUpdateFile.Checked)
@@ -648,24 +649,34 @@ private void buttonUpdateVSProjects_Click(object sender, EventArgs e)
648649

649650
foreach (ListViewItem selectedProj in selectedProjects)
650651
{
651-
//var gitBinary = textBoxGitBashBinariesPath.Text;
652652
var projectName = selectedProj.Text;
653653
var solutionPath = selectedProj.SubItems[2];
654-
// cd solutionPath and git pull under DOS
655-
//Process.Start(textBoxGitBashBinariesPath.Text, selectedProject.Name);
656-
657-
// create a bat file with cd solutionPath and git pull
658-
659-
// or create an update.bat file and put all selected proj to be updated with git pull
660-
661654
AddGitPullToScript(updateScript, projectName);
655+
Logger.Add(textBoxLog, GetTranslatedString("Adding the selected project") + OneSpace + projectName);
656+
662657
}
663658

664-
//Process task = new Process();
665-
//task.StartInfo.UseShellExecute = true;
666-
//task.StartInfo.FileName = updateScript;
667-
//task.StartInfo.CreateNoWindow = false;
668-
//task.Start();
659+
AddPauseToFile(updateScript);
660+
Process task = new Process
661+
{
662+
StartInfo =
663+
{
664+
UseShellExecute = true,
665+
FileName = updateScript,
666+
CreateNoWindow = false
667+
}
668+
};
669+
670+
task.Start();
671+
}
672+
673+
private void AddPauseToFile(string fileName)
674+
{
675+
const bool append = true;
676+
StreamWriter sw = new StreamWriter(fileName, append);
677+
sw.WriteLine("REM " + GetTranslatedString("Press a key to exit"));
678+
sw.WriteLine("pause");
679+
sw.Close();
669680
}
670681

671682
private static void AddGitPullToScript(string fileName, string directoryName)
@@ -688,6 +699,7 @@ private void AddBeginningOfScript(string fileName)
688699
sw.WriteLine("REM created by Freddy Juhel on the 31st of July 2015");
689700
sw.WriteLine("REM If you have any error, check that GitBash is installed");
690701
sw.WriteLine("REM then add C:\\Program Files\\Git\\bin to the environment PATH variable and reboot you PC");
702+
sw.WriteLine("cd \\");
691703
sw.WriteLine("cd " + textBoxVSProjectPath.Text);
692704
sw.Close();
693705
}

GitAutoUpdateGUI/Translations.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,5 +314,15 @@
314314
<englishValue>Creating the update.bat script</englishValue>
315315
<frenchValue>Creation du script update.bat</frenchValue>
316316
</term>
317+
<term>
318+
<name>Adding the selected project</name>
319+
<englishValue>Adding the selected project</englishValue>
320+
<frenchValue>Ajout du projet sélectionné</frenchValue>
321+
</term>
322+
<term>
323+
<name>Press a key to exit</name>
324+
<englishValue>Press a key to exit</englishValue>
325+
<frenchValue>Appuyer sur une touche pour terminer</frenchValue>
326+
</term>
317327
</terms>
318328
</Document>

0 commit comments

Comments
 (0)