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


C# SiteExtensions.SiteExtensionInfo类代码示例

本文整理汇总了C#中Kudu.Contracts.SiteExtensions.SiteExtensionInfo的典型用法代码示例。如果您正苦于以下问题:C# SiteExtensionInfo类的具体用法?C# SiteExtensionInfo怎么用?C# SiteExtensionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SiteExtensionInfo类属于Kudu.Contracts.SiteExtensions命名空间,在下文中一共展示了SiteExtensionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InstallExtension

        public SiteExtensionInfo InstallExtension(string id, SiteExtensionInfo requestInfo)
        {
            if (requestInfo == null)
            {
                requestInfo = new SiteExtensionInfo();
            }

            SiteExtensionInfo extension;

            try
            {
                extension = _manager.InstallExtension(id, requestInfo.Version, requestInfo.FeedUrl);
            }
            catch (WebException e)
            {
                // This can happen for example if a bad feed URL is passed
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Site extension download failure", e));
            }
            catch (Exception e)
            {
                // This can happen for example if the exception package is corrupted
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Site extension install exception. The package might be invalid.", e));
            }

            if (extension == null)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Could not find " + id));
            }

            return extension;
        }
开发者ID:xt0rted,项目名称:kudu,代码行数:31,代码来源:SiteExtensionController.cs

示例2: InstallExtension

 public SiteExtensionInfo InstallExtension(SiteExtensionInfo info)
 {
     SiteExtensionInfo extension = _manager.InstallExtension(info);
     if (extension == null)
     {
         throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, info.ToString()));
     }
     return extension;
 }
开发者ID:hanwesh,项目名称:kudu,代码行数:9,代码来源:SiteExtensionController.cs

示例3: InstallExtension

        public async Task<HttpResponseMessage> InstallExtension(string id, SiteExtensionInfo requestInfo)
        {
            var startTime = DateTime.UtcNow;
            if (requestInfo == null)
            {
                requestInfo = new SiteExtensionInfo();
            }

            SiteExtensionInfo result;

            try
            {
                result = await _manager.InstallExtension(id, requestInfo.Version, requestInfo.FeedUrl);
            }
            catch (WebException e)
            {
                // This can happen for example if a bad feed URL is passed
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Site extension download failure", e));
            }
            catch (Exception e)
            {
                // This can happen for example if the exception package is corrupted
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Site extension install exception. The package might be invalid.", e));
            }

            if (result == null)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Could not find " + id));
            }

            // TODO: xiaowu, when update to real csm async, should return "Accepted" instead of "OK"
            var responseMessage = Request.CreateResponse(HttpStatusCode.OK, ArmUtils.AddEnvelopeOnArmRequest<SiteExtensionInfo>(result, Request));

            if (result != null  // result not null indicate instalation success, when move to async operation, will relying on provisionState instead
                && result.InstalledDateTime.HasValue
                && result.InstalledDateTime.Value > startTime
                && ArmUtils.IsArmRequest(Request))
            {
                // Populate this header if 
                //      Request is from ARM
                //      Installation action is performed
                responseMessage.Headers.Add("X-MS-SITE-OPERATION", Constants.SiteOperationRestart);
            }

            return responseMessage;
        }
开发者ID:HenrikFrystykNielsen,项目名称:kudu,代码行数:46,代码来源:SiteExtensionController.cs

示例4: SiteExtensionInfo

 public SiteExtensionInfo(SiteExtensionInfo info)
 {
     Id = info.Id;
     Title = info.Title;
     Type = info.Type;
     Summary = info.Summary;
     Description = info.Description;
     Version = info.Version;
     ExtensionUrl = info.ExtensionUrl;
     ProjectUrl = info.ProjectUrl;
     IconUrl = info.IconUrl;
     LicenseUrl = info.LicenseUrl;
     Authors = info.Authors;
     PublishedDateTime = info.PublishedDateTime;
     IsLatestVersion = info.IsLatestVersion;
     DownloadCount = info.DownloadCount;
     LocalIsLatestVersion = info.LocalIsLatestVersion;
     LocalPath = info.LocalPath;
     InstalledDateTime = info.InstalledDateTime;
 }
开发者ID:kleberimeusp,项目名称:kudu,代码行数:20,代码来源:SiteExtensionInfo.cs

示例5: ConvertLocalPackageToSiteExtensionInfo

        private async Task<SiteExtensionInfo> ConvertLocalPackageToSiteExtensionInfo(UIPackageMetadata package, bool checkLatest, ITracer tracer = null)
        {
            if (package == null)
            {
                return null;
            }

            var info = new SiteExtensionInfo(package);
            if (IsInstalledToWebRoot(info.Id))
            {
                info.Type = SiteExtensionInfo.SiteExtensionType.WebRoot;
            }

            SetLocalInfo(info);
            await TryCheckLocalPackageLatestVersionFromRemote(info, checkLatest, tracer);
            return info;
        }
开发者ID:NorimaConsulting,项目名称:kudu,代码行数:17,代码来源:SiteExtensionManager.cs

示例6: ConvertRemotePackageToSiteExtensionInfo

        public SiteExtensionInfo ConvertRemotePackageToSiteExtensionInfo(IPackage package)
        {
            var info = new SiteExtensionInfo(package);

            IPackage localPackage = _localRepository.FindPackage(info.Id);
            if (localPackage != null)
            {
                UpdateLocalInfo(info);
                // Assume input package (from remote) is always the latest version.
                info.LocalIsLatestVersion = package.Version == localPackage.Version;
            }

            return info;
        }
开发者ID:jeddawson,项目名称:kudu,代码行数:14,代码来源:SiteExtensionManager.cs

示例7: CheckRemotePackageLatestVersion

        private async Task<SiteExtensionInfo> CheckRemotePackageLatestVersion(SiteExtensionInfo info, string feedUrl)
        {
            info.FeedUrl = feedUrl;
            UIPackageMetadata localPackage = await _localRepository.GetLatestPackageById(info.Id);

            if (localPackage != null)
            {
                SetLocalInfo(info);
                // Assume input package (from remote) is always the latest version.
                info.LocalIsLatestVersion = NuGetVersion.Parse(info.Version).Equals(localPackage.Identity.Version);
            }

            return info;
        }
开发者ID:NorimaConsulting,项目名称:kudu,代码行数:14,代码来源:SiteExtensionManager.cs

示例8: ConvertLocalPackageToSiteExtensionInfo

        private SiteExtensionInfo ConvertLocalPackageToSiteExtensionInfo(IPackage package, bool checkLatest)
        {
            if (package == null)
            {
                return null;
            }

            var info = new SiteExtensionInfo(package);

            SetLocalInfo(info);

            if (checkLatest)
            {
                // FindPackage gets back the latest version.
                IPackage latestPackage = GetRemoteRepository(info.FeedUrl).FindPackage(info.Id);
                if (latestPackage != null)
                {
                    info.LocalIsLatestVersion = package.Version == latestPackage.Version;
                    info.DownloadCount = latestPackage.DownloadCount;
                    info.PublishedDateTime = latestPackage.Published;
                }
            }

            return info;
        }
开发者ID:xt0rted,项目名称:kudu,代码行数:25,代码来源:SiteExtensionManager.cs

示例9: SetPreInstalledExtensionInfo

        private static void SetPreInstalledExtensionInfo(SiteExtensionInfo info)
        {
            string directory = GetPreInstalledDirectory(info.Id);

            if (FileSystemHelpers.DirectoryExists(directory))
            {
                if (info.Type == SiteExtensionInfo.SiteExtensionType.PreInstalledMonaco)
                {
                    info.Version = GetPreInstalledLatestVersion(directory);
                }
                else if (info.Type == SiteExtensionInfo.SiteExtensionType.PreInstalledEnabled)
                {
                    info.Version = typeof(SiteExtensionManager).Assembly.GetName().Version.ToString();
                }

                info.PublishedDateTime = FileSystemHelpers.GetLastWriteTimeUtc(directory);
            }
            else
            {
                info.Version = null;
                info.PublishedDateTime = null;
            }

            info.LocalIsLatestVersion = true;
        }
开发者ID:xt0rted,项目名称:kudu,代码行数:25,代码来源:SiteExtensionManager.cs

示例10: EnablePreInstalledExtension

        private SiteExtensionInfo EnablePreInstalledExtension(SiteExtensionInfo info)
        {
            string id = info.Id;
            string installationDirectory = GetInstallationDirectory(id);

            try
            {
                if (FileSystemHelpers.DirectoryExists(installationDirectory))
                {
                    FileSystemHelpers.DeleteDirectorySafe(installationDirectory);
                }

                if (ExtensionRequiresApplicationHost(info))
                {
                    if (info.Type == SiteExtensionInfo.SiteExtensionType.PreInstalledMonaco)
                    {
                        GenerateApplicationHostXdt(installationDirectory,
                            _preInstalledExtensionDictionary[id].ExtensionUrl, isPreInstalled: true);
                    }
                }
                else
                {
                    FileSystemHelpers.CreateDirectory(installationDirectory);
                }
            }
            catch (Exception ex)
            {
                ITracer tracer = _traceFactory.GetTracer();
                tracer.TraceError(ex);
                FileSystemHelpers.DeleteDirectorySafe(installationDirectory);
                return null;
            }

            return GetPreInstalledExtension(id);
        }
开发者ID:xt0rted,项目名称:kudu,代码行数:35,代码来源:SiteExtensionManager.cs

示例11: GetUrlFromApplicationHost

        private static string GetUrlFromApplicationHost(SiteExtensionInfo info)
        {
            try
            {
                var appHostDoc = new XmlDocument();
                appHostDoc.Load(Path.Combine(info.LocalPath, _applicationHostFile));

                // Get the 'path' property of the first 'application' element, which is the relative url.
                XmlNode pathPropertyNode = appHostDoc.SelectSingleNode("//application[@path]/@path");

                return pathPropertyNode.Value;
            }
            catch (SystemException)
            {
                return null;
            }
        }
开发者ID:xt0rted,项目名称:kudu,代码行数:17,代码来源:SiteExtensionManager.cs

示例12: FillSiteExtensionInfo

 public void FillSiteExtensionInfo(SiteExtensionInfo info, string defaultProvisionState = null)
 {
     info.ProvisioningState = ProvisioningState ?? defaultProvisionState;
     info.Comment = Comment;
 }
开发者ID:NorimaConsulting,项目名称:kudu,代码行数:5,代码来源:SiteExtensionStatus.cs

示例13: ReadSiteExtensionInfo

 public void ReadSiteExtensionInfo(SiteExtensionInfo info)
 {
     ProvisioningState = info.ProvisioningState;
     Comment = info.Comment;
 }
开发者ID:NorimaConsulting,项目名称:kudu,代码行数:5,代码来源:SiteExtensionStatus.cs

示例14: ExtensionRequiresApplicationHost

 private static bool ExtensionRequiresApplicationHost(SiteExtensionInfo info)
 {
     string appSettingName = info.Id.ToUpper(CultureInfo.CurrentCulture) + "_EXTENSION_VERSION";
     return ConfigurationManager.AppSettings[appSettingName] != "beta";
 }
开发者ID:projectkudu,项目名称:kudu,代码行数:5,代码来源:SiteExtensionManager.cs

示例15: InstallExtension

 public async Task<SiteExtensionInfo> InstallExtension(SiteExtensionInfo info)
 {
     return await Client.PostJsonAsync<SiteExtensionInfo, SiteExtensionInfo>(String.Empty, info);
 }
开发者ID:hanwesh,项目名称:kudu,代码行数:4,代码来源:RemoteSiteExtensionManager.cs


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