本文整理汇总了C#中GitCommands.Repository.Repository类的典型用法代码示例。如果您正苦于以下问题:C# Repository类的具体用法?C# Repository怎么用?C# Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于GitCommands.Repository命名空间,在下文中一共展示了Repository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecentRepoInfo
public RecentRepoInfo(Repository aRepo, bool aMostRecent)
{
Repo = aRepo;
MostRecent = aMostRecent;
try
{
DirInfo = new DirectoryInfo(Repo.Path);
}
catch (SystemException)
{
DirInfo = null;
Caption = Repo.Path;
}
if (Repo.Title != null)
ShortName = Repo.Title;
else if (DirInfo != null)
ShortName = DirInfo.Name;
if (DirInfo != null)
DirInfo = DirInfo.Parent;
DirName = DirInfo == null ? "" : DirInfo.FullName;
}
示例2: Assign
public void Assign(Repository source)
{
Path = source.Path;
Title = source.Title;
Description = source.Description;
RepositoryType = source.RepositoryType;
}
示例3: AddMostRecentRepository
public void AddMostRecentRepository(string repo)
{
repo = repo.Trim();
if (string.IsNullOrEmpty(repo))
return;
repo = repo.Replace('/', '\\');
if (!repo.EndsWith("\\") &&
!repo.StartsWith("http", StringComparison.CurrentCultureIgnoreCase) &&
!repo.StartsWith("git", StringComparison.CurrentCultureIgnoreCase) &&
!repo.StartsWith("ssh", StringComparison.CurrentCultureIgnoreCase))
repo += "\\";
foreach (var recentRepository in Repositories)
{
if (!recentRepository.Path.Equals(repo, StringComparison.CurrentCultureIgnoreCase))
continue;
Repositories.Remove(recentRepository);
break;
}
var repository = new Repository(repo, null, null) {RepositoryType = RepositoryType.History};
Repositories.Insert(0, repository);
if (Repositories.Count > 30)
{
Repositories.RemoveAt(30);
}
}
示例4: DashboardItem
public DashboardItem(Repository repository)
: this()
{
if (repository == null)
return;
Bitmap icon = GetRepositoryIcon(repository);
if (AppSettings.DashboardShowCurrentBranch)
{
_branchNameLoader = new AsyncLoader();
_branchNameLoader.Load(() =>
{
if (!GitCommands.GitModule.IsBareRepository(repository.Path))
{
return GitModule.GetSelectedBranchFast(repository.Path);
}
return string.Empty;
},
UpdateBranchName);
}
Initialize(icon, repository.Path, repository.Title, repository.Description);
}
示例5: Assign
public void Assign(Repository source)
{
if (source == null)
return;
Path = source.Path;
Title = source.Title;
Description = source.Description;
RepositoryType = source.RepositoryType;
}
示例6: DashboardItem
public DashboardItem(Repository repository)
: this()
{
if (repository == null)
return;
Bitmap icon = GetRepositoryIcon(repository);
var branchName = GitCommands.GitCommandHelpers.GetSelectedBranch(repository.Path);
Initialize(icon, repository.Path, repository.Title, repository.Description, branchName);
AutoSizeMode = AutoSizeMode.GrowAndShrink;
}
示例7: GetRepositoryIcon
private static Bitmap GetRepositoryIcon(Repository repository)
{
switch (repository.RepositoryType)
{
case RepositoryType.Repository:
return Resources._14;
case RepositoryType.RssFeed:
return Resources.rss.ToBitmap();
case RepositoryType.History:
return Resources.history.ToBitmap();
default:
throw new ArgumentException("Repository type is not supported.", "repository");
}
}
示例8: DashboardItem
public DashboardItem(Repository repository)
: this()
{
if (repository == null)
return;
Bitmap icon = GetRepositoryIcon(repository);
string branchName = string.Empty;
if (GitCommands.Settings.DashboardShowCurrentBranch)
{
if (!GitCommands.GitCommandHelpers.IsBareRepository(repository.Path))
branchName = GitCommands.GitCommandHelpers.GetSelectedBranchFast(repository.Path);
}
Initialize(icon, repository.Path, repository.Title, repository.Description, branchName);
}
示例9: DashboardItem
public DashboardItem(Repository repository)
{
InitializeComponent(); Translate();
if (repository == null)
return;
Bitmap icon = null;
if (repository.RepositoryType == RepositoryType.RssFeed)
icon = Resources.rss.ToBitmap();
if (repository.RepositoryType == RepositoryType.Repository)
icon = Resources._14;
if (repository.RepositoryType == RepositoryType.History)
icon = Resources.history.ToBitmap();
Initialize(icon, repository.Path, repository.Title, repository.Description);
this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
}
示例10: AddMostRecentRepository
public void AddMostRecentRepository(string repo)
{
if (string.IsNullOrEmpty(repo))
return;
repo = repo.Trim();
if (string.IsNullOrEmpty(repo))
return;
repo = repo.Replace(Settings.PathSeparatorWrong, Settings.PathSeparator);
if (!repo.EndsWith(Settings.PathSeparator.ToString()) &&
!repo.StartsWith("http", StringComparison.CurrentCultureIgnoreCase) &&
!repo.StartsWith("git", StringComparison.CurrentCultureIgnoreCase) &&
!repo.StartsWith("ssh", StringComparison.CurrentCultureIgnoreCase))
repo += Settings.PathSeparator.ToString();
Repository.RepositoryAnchor anchor = Repository.RepositoryAnchor.None;
foreach (var recentRepository in Repositories)
{
if (!recentRepository.Path.Equals(repo, StringComparison.CurrentCultureIgnoreCase))
continue;
anchor = recentRepository.Anchor;
Repositories.Remove(recentRepository);
break;
}
var repository = new Repository(repo, null, null) {
RepositoryType = RepositoryType.History,
Anchor = anchor
};
Repositories.Insert(0, repository);
if (Repositories.Count > 30)
{
Repositories.RemoveAt(30);
}
}
示例11: AddMostRecentRepository
public void AddMostRecentRepository(string repo)
{
if (string.IsNullOrEmpty(repo))
return;
repo = repo.Trim();
if (string.IsNullOrEmpty(repo))
return;
if (!Repository.PathIsUrl(repo))
{
repo = repo.ToNativePath().EnsureTrailingPathSeparator();
}
Repository.RepositoryAnchor anchor = Repository.RepositoryAnchor.None;
foreach (var recentRepository in Repositories)
{
if (!recentRepository.Path.Equals(repo, StringComparison.CurrentCultureIgnoreCase))
continue;
anchor = recentRepository.Anchor;
Repositories.Remove(recentRepository);
break;
}
var repository = new Repository(repo, null, null) {
RepositoryType = RepositoryType.History,
Anchor = anchor
};
Repositories.Insert(0, repository);
while (MaxCount > 0 && Repositories.Count > MaxCount)
{
Repositories.RemoveAt(MaxCount);
}
}
示例12: repositoryRemoved
private void repositoryRemoved(Repository repository)
{
if (RepositoryRemoved != null)
RepositoryRemoved(repository);
}
示例13: contextMenu_Opening
void contextMenu_Opening(object sender, EventArgs e)
{
repository = (Repository)(((ContextMenuStrip)sender).SourceControl.Tag);
}
示例14: RemoveRepository
public void RemoveRepository(Repository repository)
{
Repositories.Remove(repository);
}
示例15: HandleFeedTag
private void HandleFeedTag(XmlNode rssDoc, int r)
{
// <feed> tag found
var nodeFeed = rssDoc.ChildNodes[r];
//loop through all entries
for (var i = 0; i < nodeFeed.ChildNodes.Count; i++)
{
var nodeItem = nodeFeed.ChildNodes[i];
if (nodeItem.Name != "entry")
continue;
// Create a new row in the ListView containing information from inside the nodes
var repository = new Repository();
var title = nodeItem["title"];
if (title != null)
repository.Title = title.InnerText.Trim();
//repository.Description = nodeItem["content"].InnerText.Trim();
var link = nodeItem["link"];
if (link != null)
repository.Path = link.Attributes["href"].Value;
repository.RepositoryType = RepositoryType.RssFeed;
Repositories.Add(repository);
}
}