Exemple #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
                    }
                    ContributionFactory factory = PluginManager.theInstance.getContributionFactory(type);
                    Contribution        c       = factory.load(this, contrib);
                    contributions.Add(c);
                    PluginManager.theInstance.addContribution(c);
                    c.init(this, baseUri);
                } catch (Exception e) {
                    throw new Exception("failed to load contribution " + contrib.Attributes["id"].Value, e);
                }
            }
        }
        public Contribution load(Plugin 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));
            }
        }
Exemple #3
0
 public bool OnContribIDDuplicated(Contribution c_1st, Contribution c_2nd, Exception e)
 {
     return(false);
 }
Exemple #4
0
 public void addContribution(Contribution contrib)
 {
     contributionMap.Add(contrib.id, contrib);
 }
Exemple #5
0
 public bool OnContributionInitError(Contribution c, Exception e)
 {
     return(false);
 }