private GERequirement ProcessRequirements(RequirementsType requirements) { if (requirements == null) { return(null); } List <GERequirement.GEActivationChecker> activationCheckers = new List <GERequirement.GEActivationChecker>(); foreach (RequirementsTypeIsActive aChecker in requirements.isActive) { activationCheckers.Add(new GERequirement.GEActivationChecker(elementManager, aChecker.refId, aChecker.value)); } List <GERequirement.GEPropertyChecker> propertyCheckers = new List <GERequirement.GEPropertyChecker>(); foreach (RequirementsTypePropertyCondition pChecker in requirements.propertyCondition) { PropertyConditionEnum condition = pChecker.condition; GERequirement.PropertyConditionType cType = GERequirement.PropertyConditionType.EQ; if (!condition.Equals(PropertyConditionEnum.eq)) { cType = condition.Equals(PropertyConditionEnum.lt) ? GERequirement.PropertyConditionType.LT : GERequirement.PropertyConditionType.GT; } propertyCheckers.Add(new GERequirement.GEPropertyChecker(elementManager, pChecker.refId, cType, pChecker.value)); } List <GERequirement.GEEquippedChecker> equippedCheckers = new List <GERequirement.GEEquippedChecker>(); foreach (RequirementsTypeIsEquipped aChecker in requirements.isEquipped) { equippedCheckers.Add(new GERequirement.GEEquippedChecker(elementManager, aChecker.refId, aChecker.value)); } GERequirement requirement = new GERequirement(null, activationCheckers, propertyCheckers, equippedCheckers); OnReferenceProcessing += delegate(object o, EventArgs e) { requirement.TextOnFail = elementManager.GetTextElement(requirements.textOnFail); }; return(requirement); }
/// <summary> /// Constructor /// </summary> /// <param name="name">The name of the package</param> /// <param name="version">The version of the package</param> /// <param name="url">The url to a descriptionpage</param> /// <param name="license">The license under which the package is released (preferably GPL ;))</param> /// <param name="licenseUrl">The url to a licensedescription</param> /// <param name="author">The original author of the package</param> /// <param name="authorUrl">The url to the Authors website</param> /// <param name="requirementsMajor">Umbraco version major</param> /// <param name="requirementsMinor">Umbraco version minor</param> /// <param name="requirementsPatch">Umbraco version patch</param> /// <param name="readme">The readme text</param> /// <param name="control">The name of the usercontrol used to configure the package after install</param> /// <param name="requirementsType"></param> /// <param name="iconUrl"></param> public Installer(string name, string version, string url, string license, string licenseUrl, string author, string authorUrl, int requirementsMajor, int requirementsMinor, int requirementsPatch, string readme, string control, RequirementsType requirementsType, string iconUrl) { ContainsBinaryFileErrors = false; ContainsTemplateConflicts = false; ContainsUnsecureFiles = false; ContainsMacroConflict = false; ContainsStyleSheeConflicts = false; this.Name = name; this.Version = version; this.Url = url; this.License = license; this.LicenseUrl = licenseUrl; this.RequirementsMajor = requirementsMajor; this.RequirementsMinor = requirementsMinor; this.RequirementsPatch = requirementsPatch; this.RequirementsType = requirementsType; this.Author = author; this.AuthorUrl = authorUrl; this.IconUrl = iconUrl; ReadMe = readme; this.Control = control; }
private static SystemRequirementses SystemRequirementses(List <HtmlNode> reqHtml, RequirementsType rType, SystemType sType) { var req = new SystemRequirementses { RequirementsType = rType, SystemType = sType }; foreach (var item in reqHtml) { var paramName = item.Descendants("strong").Select(x => x).FirstOrDefault()?.InnerText; if (string.IsNullOrEmpty(paramName)) { continue; } var value = Utils.RemoveSubString(Utils.StripHtml(item.InnerText), paramName) .Trim(); if (string.IsNullOrEmpty(paramName)) { continue; } switch (paramName) { case "OS:": req.Os = value; break; case "Processor:": req.Processor = value; break; ; case "Memory:": req.Memory = value; break; case "Graphics:": req.Graphics = value; break; case "DirectX:": req.DirectX = value; break; case "Storage:": req.Storage = value; break; } } return(req); }