public override bool Evaluate(ExtensionContext ctx) { if (!base.Evaluate(ctx)) { return(false); } if (!string.IsNullOrEmpty(addin)) { // Make sure the add-in that implements the condition is loaded addinEngine.LoadAddin(null, addin, true); addin = null; // Don't try again } ConditionType type = ctx.GetCondition(typeId); if (type == null) { var parts = string.Join(", ", Array.ConvertAll(node.Attributes, attr => attr.Name + "=" + attr.Value)); addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context. [" + parts + "]", node.ParentAddinDescription.AddinId, null, false); return(false); } try { return(type.Evaluate(node)); } catch (Exception ex) { addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", node.ParentAddinDescription.AddinId, ex, false); return(false); } }
Array GetChildObjectsInternal(Type arrayElementType, bool reuseCachedInstance) { ArrayList list = new ArrayList(ChildNodes.Count); for (int n = 0; n < ChildNodes.Count; n++) { InstanceExtensionNode node = ChildNodes [n] as InstanceExtensionNode; if (node == null) { addinEngine.ReportError("Error while getting object for node in path '" + Path + "'. Extension node is not a subclass of InstanceExtensionNode.", null, null, false); continue; } try { if (reuseCachedInstance) { list.Add(node.GetInstance(arrayElementType)); } else { list.Add(node.CreateInstance(arrayElementType)); } } catch (Exception ex) { addinEngine.ReportError("Error while getting object for node in path '" + Path + "'.", node.AddinId, ex, false); } } return(list.ToArray(arrayElementType)); }
RuntimeAddin[] GetDepAddins() { if (depAddins != null) { return(depAddins); } var plugList = new List <RuntimeAddin> (); string ns = ainfo.Description.Namespace; // Collect dependent ids foreach (Dependency dep in module.Dependencies) { AddinDependency pdep = dep as AddinDependency; if (pdep != null) { RuntimeAddin adn = addinEngine.GetAddin(Addin.GetFullId(ns, pdep.AddinId, pdep.Version)); if (adn != null) { plugList.Add(adn); } else { addinEngine.ReportError("Add-in dependency not loaded: " + pdep.FullAddinId, module.ParentAddinDescription.AddinId, null, false); } } } return(depAddins = plugList.ToArray()); }