private async Task OpenStartupRepos()
        {
            LOG.Debug(nameof(OpenStartupRepos));

            foreach (String repo in Settings.Default.StartupRepos)
            {
                if (Git.IsInRepo(repo))
                {
                    await OpenLog(repo);
                }
            }
        }
Ejemplo n.º 2
0
 private void AddDefaultRepo_Click(object?sender, EventArgs e)
 {
     if (folderDialog.ShowDialog() == DialogResult.OK)
     {
         String path = folderDialog.SelectedPath;
         if (Git.IsInRepo(path))
         {
             StartupReposList.Items.Add(path);
         }
         else
         {
             MessageBox.Show("Directory is not a Git repo.", "Invalid Directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 3
0
 private void TabbedTortoiseGitForm_DragOver(object?sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         if (e.Data.GetData(DataFormats.FileDrop) is String[] files)
         {
             foreach (String file in files)
             {
                 if (Directory.Exists(file) && Git.IsInRepo(file))
                 {
                     e.Effect = DragDropEffects.Copy;
                 }
             }
         }
     }
 }
        private async Task FindRepo()
        {
            LOG.Debug(nameof(FindRepo));

            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                String path = folderDialog.SelectedPath;
                if (!Git.IsInRepo(path))
                {
                    LOG.Debug($"{nameof( FindRepo )} - Invalid repo: {path}");
                    MessageBox.Show("Directory is not a git repo!", "Invalid Directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    LOG.Debug($"{nameof( FindRepo )} - Opening repo: {path}");
                    await OpenLog(path);
                }
            }
        }
 private void Ok_Click(object?sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(this.FavoriteName))
     {
         MessageBox.Show("Favorite name cannot be empty.", "Invalid Favorite Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (!Directory.Exists(this.FavoriteRepo) &&
              !File.Exists(this.FavoriteRepo))
     {
         MessageBox.Show("Favorite repo location does not exist.", "Invalid Favorite Repo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (!Git.IsInRepo(this.FavoriteRepo))
     {
         MessageBox.Show("Favorite repo location is not a repo.", "Invalid Favorite Repo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
        private void AddFavoriteRepo(String path)
        {
            if (_favoriteRepos is null)
            {
                LOG.Error($"{nameof( AddFavoriteRepo )} - {nameof( _favoriteRepos )} has not been initialized");
                return;
            }

            if (!Git.IsInRepo(path))
            {
                LOG.Error($"{nameof( AddFavoriteRepo )} - Failed to add favorite repo: {path}");
                return;
            }

            using FavoriteRepoCreatorDialog dialog = FavoriteRepoCreatorDialog.FromRepo(path);
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                _favoriteRepos.Children.Add(dialog.ToFavoriteRepo());

                Settings.Default.FavoriteRepos = _favoriteRepos;
                Settings.Default.Save();
            }
        }