当前位置: 首页>>代码示例>>C#>>正文


C# GitUIBaseEventArgs.IsValidGitWorkingDir方法代码示例

本文整理汇总了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);
        }
开发者ID:rschoening,项目名称:gitextensions,代码行数:74,代码来源:Gource.cs


注:本文中的GitUIPluginInterfaces.GitUIBaseEventArgs.IsValidGitWorkingDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。