本文整理汇总了C#中Site.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Site.GetProperty方法的具体用法?C# Site.GetProperty怎么用?C# Site.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site.GetProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOrUpdateHook
protected void CreateOrUpdateHook(string owner, string repository, Site website)
{
string baseUri = website.GetProperty("repositoryuri");
string publishingUsername = website.GetProperty("publishingusername");
string publishingPassword = website.GetProperty("publishingpassword");
UriBuilder newUri = new UriBuilder(baseUri);
newUri.UserName = publishingUsername;
newUri.Password = publishingPassword;
newUri.Path = "/deploy";
string deployUri = newUri.ToString();
List<GithubRepositoryHook> repositoryHooks = new List<GithubRepositoryHook>();
InvokeInGithubOperationContext(() => { repositoryHooks = Pscmdlet.GithubChannel.GetRepositoryHooks(owner, repository); });
var existingHook = repositoryHooks.FirstOrDefault(h => h.Name.Equals("web") && new Uri(h.Config.Url).Host.Equals(new Uri(deployUri).Host));
if (existingHook != null)
{
if (!existingHook.Config.Url.Equals(newUri.ToString(), StringComparison.InvariantCultureIgnoreCase))
{
existingHook.Config.Url = deployUri;
InvokeInGithubOperationContext(() => Pscmdlet.GithubChannel.UpdateRepositoryHook(owner, repository, existingHook.Id, existingHook));
InvokeInGithubOperationContext(() => Pscmdlet.GithubChannel.TestRepositoryHook(owner, repository, existingHook.Id));
}
else
{
throw new Exception(Resources.LinkAlreadyEstablished);
}
}
else
{
GithubRepositoryHook githubRepositoryHook = new GithubRepositoryHook()
{
Name = "web",
Active = true,
Events = new List<string> { "push" },
Config = new GithubRepositoryHookConfig
{
Url = deployUri,
InsecureSsl = "1",
ContentType = "form"
}
};
InvokeInGithubOperationContext(() => { githubRepositoryHook = Pscmdlet.GithubChannel.CreateRepositoryHook(owner, repository, githubRepositoryHook); });
InvokeInGithubOperationContext(() => Pscmdlet.GithubChannel.TestRepositoryHook(owner, repository, githubRepositoryHook.Id));
}
}
示例2: AddRemoteToLocalGitRepo
internal void AddRemoteToLocalGitRepo(Site website)
{
// Get remote repos
IList<string> remoteRepositories = GitClass.GetRemoteRepositories();
if (remoteRepositories.Any(repository => repository.Equals("azure")))
{
// Removing existing azure remote alias
GitClass.RemoveRemoteRepository("azure");
}
string repositoryUri = website.GetProperty("RepositoryUri");
string uri = GitClass.GetUri(repositoryUri, Name, PublishingUsername);
GitClass.AddRemoteRepository("azure", uri);
}
示例3: AddRemoteToLocalGitRepo
internal void AddRemoteToLocalGitRepo(Site website)
{
// Get remote repos
IList<string> remoteRepositories = GitClass.GetRemoteRepositories();
string repositoryUri = website.GetProperty("RepositoryUri");
string uri = GitClass.GetUri(
repositoryUri,
website.RepositorySiteName,
PublishingUsername);
string remoteName;
if (string.IsNullOrEmpty(Slot))
{
remoteName = "azure";
}
else
{
remoteName = "azure-" + Slot;
}
foreach (string name in remoteRepositories)
{
if (name.Equals(remoteName))
{
GitClass.RemoveRemoteRepository(remoteName);
break;
}
}
GitClass.AddRemoteRepository(remoteName, uri);
}