Menu

[38707f]: / FormNewRepoStep2.cs  Maximize  Restore  History

Download this file

94 lines (83 with data), 3.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.IO;
using System.Windows.Forms;
namespace GitForce
{
public partial class FormNewRepoStep2 : Form
{
/// <summary>
/// Destination directory to create a new repo
/// </summary>
public string Destination
{
get { return ClassUtils.GetCombinedPath(textBoxRepoPath.Text.Trim(), textBoxProjectName.Text.Trim()); }
set { textBoxRepoPath.Text = value; }
}
/// <summary>
/// Project name
/// </summary>
public string ProjectName
{
get { return textBoxProjectName.Text.Trim(); }
set { textBoxProjectName.Text = value; }
}
public string InitBranchName
{
get { return textBoxInitBranchName.Text.Trim(); }
set { textBoxInitBranchName.Text = value; }
}
/// <summary>
/// Optional extra parameters which can be set by the user
/// </summary>
public string Extra
{
get { return textBoxExtraArgs.Text.Trim(); }
}
public bool IsBare;
public bool CheckTargetDirEmpty;
public FormNewRepoStep2()
{
InitializeComponent();
ClassWinGeometry.Restore(this);
}
/// <summary>
/// Form is closing.
/// </summary>
private void FormNewRepoStep2FormClosing(object sender, FormClosingEventArgs e)
{
ClassWinGeometry.Save(this);
}
/// <summary>
/// Browse for the final path to the directory to init
/// </summary>
private void BtBrowseClick(object sender, EventArgs e)
{
folder.Description = @"Select a folder to host the new repository:";
if (folder.ShowDialog() == DialogResult.OK)
textBoxRepoPath.Text = folder.SelectedPath;
}
/// <summary>
/// Text changed in the destination path, validate it.
/// </summary>
private void TextBoxRepoPathTextChanged(object sender, EventArgs e)
{
// Target folder needs to be a valid directory, with or without files in it
ClassUtils.DirStatType type = ClassUtils.DirStat(textBoxRepoPath.Text);
btOK.Enabled = type == ClassUtils.DirStatType.Empty || type == ClassUtils.DirStatType.Nongit;
// Additional checks for clone operations (where CheckTargetDirEmpty is true)
if (CheckTargetDirEmpty)
{
// If the project name is specified, that complete path should not exist
if (textBoxProjectName.Text.Trim().Length > 0)
btOK.Enabled &= ClassUtils.DirStat(Destination) == ClassUtils.DirStatType.Invalid;
}
}
/// <summary>
/// Copy the bare checked state into a public variable that is exposed
/// </summary>
private void CheckBoxBareCheckedChanged(object sender, EventArgs e)
{
IsBare = checkBoxBare.Checked;
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.