当前位置: 首页>>代码示例>>C#>>正文


C# Site.GetProperty方法代码示例

本文整理汇总了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));
            }
        }
开发者ID:nicopeelen,项目名称:azure-sdk-tools,代码行数:48,代码来源:GithubClient.cs

示例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);
        }
开发者ID:shanmukrao,项目名称:azure-sdk-tools,代码行数:15,代码来源:NewAzureWebSite.cs

示例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);
        }
开发者ID:randorfer,项目名称:azure-powershell,代码行数:32,代码来源:NewAzureWebSite.cs


注:本文中的Site.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。