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")); } } }
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); } } }
/* 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)); }
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); } } }