Beispiel #1
0
        /// <summary>
        /// Loads contributions from this plug-in
        /// </summary>
        internal protected virtual void loadContributions()
        {
            Debug.WriteLine("loading contributions from " + name);
            XmlElement root = doc.DocumentElement;

            Uri baseUri = new Uri(root.BaseURI);

            // load contributions
            foreach (XmlElement contrib in root.SelectNodes("contribution"))
            {
                try
                {
                    string type = contrib.Attributes["type"].Value;
                    if (type == "contribution")
                    {
                        continue;                               // ignore
                    }
                    IContributionFactory factory = PluginManager.GetContributionFactory(type);
                    Contribution         c       = factory.Load(this, contrib);
                    contributions.Add(c);
                    PluginManager.AddContribution(c);
                    c.init(this, baseUri);
                }
                catch (Exception e)
                {
                    throw new Exception("failed to load contribution " + contrib.Attributes["id"].Value, e);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        public Contribution Load(PluginDefinition owner, XmlElement e)
        {
            Contribution contrib = (Contribution)PluginUtil.loadObjectFromManifest(e);

            if (baseType.IsInstanceOfType(contrib))
            {
                return(contrib);
            }
            else
            {
                throw new Exception(string.Format(
                                        "{0} is incorrect for for this contribution (expected:{1})",
                                        contrib.GetType().FullName, baseType.FullName));
            }
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="contrib"></param>
 public static void AddContribution(Contribution contrib)
 {
     contributionMap.Add(contrib.Id, contrib);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="c_1st"></param>
 /// <param name="c_2nd"></param>
 /// <param name="e"></param>
 /// <returns></returns>
 public bool OnContribIDDuplicated(Contribution c_1st, Contribution c_2nd, Exception e)
 {
     return(false);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="c"></param>
 /// <param name="e"></param>
 /// <returns></returns>
 public bool OnContributionInitError(Contribution c, Exception e)
 {
     return(false);
 }