コード例 #1
0
ファイル: CliOptionsPage.cs プロジェクト: oqewok/gitter
 private void _txtmSysGitPath_TextChanged(object sender, EventArgs e)
 {
     if (_txtmSysGitPath.Text != _versionPath)
     {
         _versionPath = _txtmSysGitPath.Text;
         try
         {
             var path = _txtmSysGitPath.Text.Trim();
             path = Path.GetFullPath(path);
             var fileName = Path.GetFileName(path).ToLower();
             if ((fileName == "git.exe" || fileName == "git.cmd") && File.Exists(path))
             {
                 Version version = null;
                 try
                 {
                     version = GitProcess.CheckVersion(path);
                 }
                 catch (Exception exc)
                 {
                     if (exc.IsCritical())
                     {
                         throw;
                     }
                 }
                 if (version != null)
                 {
                     _lblVersion.Text = version.ToString();
                 }
                 else
                 {
                     _lblVersion.Text = Resources.StrlUnavailable.SurroundWith("<", ">");
                 }
             }
             else
             {
                 _lblVersion.Text = Resources.StrlUnavailable.SurroundWith("<", ">");
             }
         }
         catch (Exception exc)
         {
             if (exc.IsCritical())
             {
                 throw;
             }
             _lblVersion.Text = Resources.StrlUnavailable.SurroundWith("<", ">");
         }
     }
 }