本文整理汇总了C#中IPublishedContent.GetPropertyAsTrustLevel方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.GetPropertyAsTrustLevel方法的具体用法?C# IPublishedContent.GetPropertyAsTrustLevel怎么用?C# IPublishedContent.GetPropertyAsTrustLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPublishedContent
的用法示例。
在下文中一共展示了IPublishedContent.GetPropertyAsTrustLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetListing
/// <summary>
/// get listing
/// </summary>
/// <param name="content"></param>
/// <param name="optimized">if set performs less DB interactions to increase speed.</param>
/// <param name="projectKarma"></param>
/// <returns></returns>
public IListingItem GetListing(IPublishedContent content, bool optimized = false, int projectKarma = -1)
{
if (content != null)
{
var listingItem = new ListingItem.ListingItem(
p => GetProjectDownloadCount(p),
p => projectKarma < 0 ? GetProjectKarma(p) : projectKarma
);
listingItem.Id = content.Id;
listingItem.NiceUrl = library.NiceUrl(listingItem.Id);
listingItem.Name = content.Name;
listingItem.Description = content.GetPropertyValue<string>("description", "");
listingItem.CurrentVersion = content.GetPropertyValue<string>("version", "");
listingItem.CurrentReleaseFile = content.GetPropertyValue<string>("file", "");
listingItem.DefaultScreenshot = content.GetPropertyValue<string>("defaultScreenshotPath", "");
listingItem.DevelopmentStatus = content.GetPropertyValue<string>("status", "");
listingItem.ListingType = content.GetPropertyAsListingType("listingType");
listingItem.GACode = content.GetPropertyValue<string>("gaCode", "");
listingItem.CategoryId = content.GetPropertyValue<int>("category");
listingItem.Stable = content.GetPropertyValue<bool>("stable");
listingItem.Live = content.GetPropertyValue<bool>("projectLive");
listingItem.LicenseName = content.GetPropertyValue<string>("licenseName", "");
listingItem.LicenseUrl = content.GetPropertyValue<string>("licenseUrl", "");
listingItem.ProjectUrl = content.GetPropertyValue<string>("websiteUrl", "");
listingItem.SupportUrl = content.GetPropertyValue<string>("supportUrl", "");
listingItem.SourceCodeUrl = content.GetPropertyValue<string>("sourceUrl", "");
listingItem.DemonstrationUrl = content.GetPropertyValue<string>("demoUrl", "");
listingItem.OpenForCollab = content.GetPropertyValue<bool>("openForCollab", false);
listingItem.NotAPackage = content.GetPropertyValue<bool>("notAPackage", false);
listingItem.ProjectGuid = new Guid(content.GetPropertyValue<string>("packageGuid"));
listingItem.Approved = content.GetPropertyValue<bool>("approved", false);
listingItem.UmbracoVerionsSupported = content.GetPropertyValue<string>("compatibleVersions", "").Split(';');
listingItem.NETVersionsSupported = (content.GetPropertyValue<string>("dotNetVersion", "") != null) ? content.GetPropertyValue<string>("dotNetVersion", "").Split(';') : "".Split(';');
listingItem.TrustLevelSupported = content.GetPropertyAsTrustLevel("trustLevelSupported");
listingItem.TermsAgreementDate = content.GetPropertyValue<DateTime>("termsAgreementDate");
listingItem.CreateDate = content.CreateDate;
listingItem.VendorId = content.GetPropertyValue<int>("owner");
listingItem.Logo = content.GetPropertyValue<string>("logo", "");
listingItem.LicenseKey = content.GetPropertyValue<string>("licenseKey", "");
//this section was created to speed up loading operations and cut down on the number of database interactions
if (optimized == false)
{
listingItem.DocumentationFile = GetMediaForProjectByType(content.Id, FileType.docs);
listingItem.ScreenShots = GetMediaForProjectByType(content.Id, FileType.screenshot);
listingItem.PackageFile = GetMediaForProjectByType(content.Id, FileType.package);
listingItem.HotFixes = GetMediaForProjectByType(content.Id, FileType.hotfix);
listingItem.SourceFile = GetMediaForProjectByType(content.Id, FileType.source);
}
return listingItem;
}
throw new NullReferenceException("Content is Null");
}