ReportError() private méthode

private ReportError ( string message, string addinId, Exception exception, bool fatal ) : void
message string
addinId string
exception System.Exception
fatal bool
Résultat void
Exemple #1
0
        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));
        }
Exemple #2
0
        public override bool Evaluate(ExtensionContext ctx)
        {
            if (!base.Evaluate(ctx))
            {
                return(false);
            }

            ConditionType type = ctx.GetCondition(typeId);

            if (type == null)
            {
                addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context.", null, null, false);
                return(false);
            }

            try
            {
                return(type.Evaluate(node));
            }
            catch (Exception ex)
            {
                addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", null, ex, false);
                return(false);
            }
        }
        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)
            {
                addinEngine.ReportError("Condition '" + typeId + "' not found in current extension context.", null, null, false);
                return(false);
            }

            try {
                return(type.Evaluate(node));
            }
            catch (Exception ex) {
                addinEngine.ReportError("Error while evaluating condition '" + typeId + "'", null, ex, false);
                return(false);
            }
        }
Exemple #4
0
        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);
            }
        }
Exemple #5
0
        RuntimeAddin[] GetDepAddins()
        {
            if (depAddins != null)
            {
                return(depAddins);
            }

            ArrayList plugList = new ArrayList();
            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 = (RuntimeAddin[])plugList.ToArray(typeof(RuntimeAddin)));
        }