本文整理汇总了C#中GitUIPluginInterfaces.GitUIBaseEventArgs.IsValidGitWorkingDir方法的典型用法代码示例。如果您正苦于以下问题:C# GitUIBaseEventArgs.IsValidGitWorkingDir方法的具体用法?C# GitUIBaseEventArgs.IsValidGitWorkingDir怎么用?C# GitUIBaseEventArgs.IsValidGitWorkingDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GitUIPluginInterfaces.GitUIBaseEventArgs
的用法示例。
在下文中一共展示了GitUIBaseEventArgs.IsValidGitWorkingDir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(GitUIBaseEventArgs gitUiCommands)
{
if (!gitUiCommands.IsValidGitWorkingDir(gitUiCommands.GitWorkingDir))
{
MessageBox.Show("The current directory is not a valid git repository." + Environment.NewLine +
Environment.NewLine + "Gource can be only be started from a valid git repository.");
return;
}
var pathToGource = Settings.GetSetting("Path to \"gource\"");
if (!string.IsNullOrEmpty(pathToGource))
{
if (!File.Exists(pathToGource))
{
if (
MessageBox.Show(
"Cannot find \"gource\" in the configured path: " + pathToGource +
".\n\n.Do you want to reset the configured path?", "Gource", MessageBoxButtons.YesNo) ==
DialogResult.Yes)
{
Settings.SetSetting("Path to \"gource\"", "");
pathToGource = Settings.GetSetting("Path to \"gource\"");
}
}
}
if (string.IsNullOrEmpty(pathToGource))
{
if (
MessageBox.Show(
"There is no path to \"gource\" configured.\n\nDo you want to automaticly download \"gource\"?",
"Download", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
var gourceUrl = SearchForGourceUrl();
if (string.IsNullOrEmpty(gourceUrl))
{
MessageBox.Show(
"Cannot find \"gource\".\nPlease download \"gource\" and set the path in the plugins settings dialog.");
return;
}
var downloadDir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
var fileName = downloadDir + "\\gource.zip";
var downloadSize = DownloadFile(gourceUrl, fileName);
if (downloadSize > 0)
{
MessageBox.Show(downloadSize + " bytes downloaded.");
Directory.CreateDirectory(downloadDir + "\\gource");
UnZipFiles(fileName, downloadDir + "\\gource", true);
var newGourcePath = downloadDir + "\\gource\\gource.exe";
if (File.Exists(newGourcePath))
{
Settings.SetSetting("Path to \"gource\"", newGourcePath);
MessageBox.Show("\"gource\" has been downloaded and unzipped.");
pathToGource = newGourcePath;
}
}
else
{
MessageBox.Show(
"Downloading failed.\nPlease download \"gource\" and set the path in the plugins settings dialog.");
}
}
}
var gourceStart = new GourceStart(pathToGource, gitUiCommands.GitWorkingDir,
Settings.GetSetting("Arguments"));
gourceStart.ShowDialog();
Settings.SetSetting("Arguments", gourceStart.GourceArguments);
Settings.SetSetting("Path to \"gource\"", gourceStart.PathToGource);
}