本文整理汇总了C#中Rule.Prop方法的典型用法代码示例。如果您正苦于以下问题:C# Rule.Prop方法的具体用法?C# Rule.Prop怎么用?C# Rule.Prop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rule
的用法示例。
在下文中一共展示了Rule.Prop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseSharedLibRule
private void ParseSharedLibRule(Rule sharedlib)
{
if (sharedlib != null)
{
var policies = from p in sharedlib.Properties
where p.Name == "policy-file"
select p;
_package.SharedLibs = _package.SharedLibs ?? new SharedLib();
foreach (var p in policies)
{
_package.SharedLibs.AddToPropertyListAndRuleProp("MajorMinorsToReplace", p, p.Values);
}
if (ValidVal(sharedlib.Prop("global")))
{
_package.SharedLibs.SetPropertyAndRuleProp("GlobalEntry", sharedlib.Prop("global"));
}
}
}
示例2: ParseIdentityRule
private IEnumerable<Exception> ParseIdentityRule(Rule identityProps, string password)
{
X509Certificate2 signingCert = null;
string valueOfCertInput = null;
if (ValidVal(identityProps.Prop("certificate")))
valueOfCertInput = identityProps.Prop("certificate").LValue;
var certStoreInfo = CertificateStoreInfo.GetCertStoreInfo(valueOfCertInput, password);
var continueParsing = true;
if (certStoreInfo.CertificateFile == null)
{
yield return NumberedEndUserException.Create(122);
continueParsing = false;
}
if (certStoreInfo.CertificateFile == null)
{
yield return NumberedEndUserException.Create(122);
continueParsing = false;
}
if (certStoreInfo.PasswordIsNull)
{
yield return NumberedEndUserException.Create(123);
continueParsing = false;
}
if (continueParsing)
{
var pfxStore = certStoreInfo.CertStore;
if (pfxStore == null)
{
yield return NumberedEndUserException.Create(124, _package.CertificateFile);
}
else
{
var codeSigningCert = pfxStore.FindCodeSigningCert();
if (codeSigningCert == null)
yield return NumberedEndUserException.Create(125, certStoreInfo.CertificateFile);
else
{
if (codeSigningCert.GetPktAsString() == null)
{
yield return NumberedEndUserException.Create(125, certStoreInfo.CertificateFile);
}
if (codeSigningCert.NotAfter < DateTime.Now)
{
yield return NumberedEndUserException.Create(156, _package.CertificateFile);
}
var nameParts = codeSigningCert.GetSubjectNameParts();
if (!nameParts.ContainsKey("CN"))
{
yield return NumberedEndUserException.Create(127, _package.CertificateFile);
}
if (ValidVal(identityProps.Prop("email")) && identityProps.Prop("email").LValue == "auto")
{
if (nameParts.ContainsKey("E"))
{
_package.PubEmail = nameParts["E"];
}
else
{
yield return NumberedEndUserException.Create(128, _package.CertificateFile);
}
}
}
}
}
if (ValidVal(identityProps.Prop("email")) && identityProps.Prop("email").LValue != "auto")
{
var email = identityProps.Prop("email").LValue;
if (!Validator.IsEmailValid(email))
{
yield return NumberedEndUserPropertyException.Create(identityProps.Prop("email"), 129, email);
}
else
{
_package.PubEmail = email;
}
}
if (ValidVal(identityProps.Prop("website")))
{
var website = identityProps.Prop("website").LValue;
if (Validator.IsUrlValid(website))
{
_package.PubWebsiteUrl = _package.CreateUrl(website, "pub_website");
}
else
{
yield return NumberedEndUserPropertyException.Create(identityProps.Prop("website"), 155, website);
}
}
//.........这里部分代码省略.........
示例3: ParseExeFileRules
/*
private void ParseExeFileRules(IEnumerable<Rule> exeFiles)
{
foreach (var e in exeFiles)
{
var exe = new ExeDescription { ExeFile = e.Parameter.FixFilepathSlashes() };
var bin = e.Prop("global-bin");
if (ValidVal(bin))
{
exe.SetPropertyAndRuleProp("GlobalBinEntry", bin);
}
var startMenu = e.Prop("start-menu");
if (ValidVal(startMenu))
{
exe.SetPropertyAndRuleProp("StartMenu", startMenu);
}
_package.Apps = _package.Apps ?? new App();
_package.Apps.PrimaryExes.Add(exe);
if (e == _possibleFirstBinRule)
{
_package.FirstBinFile = _package.FirstBinFile ?? exe;
}
}
}*/
/*
private void ParseAppRule(Rule appRule)
{
if (appRule != null)
{
var includes = from p in appRule.Properties
where p.Name == "include"
select p;
_package.Apps = _package.Apps ?? new App();
foreach (var i in includes)
{
_package.Apps.AddInclude(i);
}
var excludes = from p in appRule.Properties
where p.Name == "exclude"
select p;
foreach (var e in excludes)
{
_package.Apps.AddExclude(e);
}
var globalBin = appRule.Prop("global-bin");
if (ValidVal(globalBin))
{
_package.Apps.SetPropertyAndRuleProp("GlobalBinEntry", globalBin);
}
}
}*/
private IEnumerable<Exception> ParsePackageRule(Rule packageProps)
{
return Enumerable.Empty<Exception>().Concat(ParseIcon(packageProps.Prop("icon")))
.Concat(ParseDescription(packageProps.Prop("description")))
.Concat(ParseDescription(packageProps.Prop("short-desc"), true))
.Concat(ParseLicense(packageProps))
.Concat(ParseDisplayName(packageProps.Prop("display-name")))
.Concat(ParsePublishDate(packageProps.Prop("publish-date")))
.Concat(ParseFeed(packageProps.Prop("feed-location")))
.Concat(ParseLocation(packageProps.Prop("orig-location")))
.Concat(ParseBugTracker(packageProps.Prop("bug-tracker")))
.Concat(ParseAuthorVersion(packageProps.Prop("author-version")))
.Concat(ParseBindingMinMax(packageProps));
}
示例4: ParseBasicIncludeExclude
private void ParseBasicIncludeExclude(Rule input)
{
if (input != null) {
var includes = from p in input.Properties
where p.Name == "include"
select p;
BasicIncludeAndExclude iAndE = null;
switch (input.Name)
{
case "headers":
_package.DeveloperLibs = _package.DeveloperLibs ?? new DeveloperLib();
iAndE = _package.DeveloperLibs.Headers;
break;
case "staticlibs":
_package.DeveloperLibs = _package.DeveloperLibs ?? new DeveloperLib();
iAndE = _package.DeveloperLibs.StaticLibs;
break;
case "importlibs":
_package.DeveloperLibs = _package.DeveloperLibs ?? new DeveloperLib();
iAndE = _package.DeveloperLibs.ImportLibs;
break;
default:
return;
}
foreach (var i in includes) {
iAndE.AddInclude(i);
}
var excludes = from p in input.Properties
where p.Name == "exclude"
select p;
foreach (var e in excludes) {
iAndE.AddExclude(e);
}
var global = input.Prop("global");
if (ValidVal(global))
{
iAndE.SetPropertyAndRuleProp("GlobalLinkEntry", global);
}
}
}