예제 #1
0
        // BaseClass hbclas = new BaseClass();
        //TheDarkOwlLogger.TheDarkOwlLogger hdBugger = new TheDarkOwlLogger.TheDarkOwlLogger();
        //static public ScrablerPluginCollection Loaded_ScrablerPlugins ;
        /// <summary>
        /// Iterate through all the child nodes
        ///	of the XMLNode that was passed in and create instances
        ///	of the specified Types by reading the attribite values of the nodes
        ///	we use a try/Catch here because some of the nodes
        ///	might contain an invalid reference to a ScrablerPlugin type
        ///	</summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section">The XML section we will iterate against</param>
        /// <returns></returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            ScrablerPluginCollection Loaded_ScrablerPlugins = new ScrablerPluginCollection();

            foreach (XmlNode node in section.ChildNodes)
            {
                try
                {
                    //Use the Activator class's 'CreateInstance' method
                    //to try and create an instance of the ScrablerPlugin by
                    //passing in the type name specified in the attribute value
                    object plugObject = Activator.CreateInstance(Type.GetType(node.Attributes["type"].Value));

                    //Cast this to an ScrablerPluginSDK interface and add to the collection
                    ScrablerPluginSDK ScrablerPlugin = (ScrablerPluginSDK)plugObject;
                    Loaded_ScrablerPlugins.Add(ScrablerPlugin);
                }
                catch (Exception e)
                {
                    //MessageBox.Show(e.ToString());
                    //hbclas.errorhandling(e);
                    //Catch any exceptions
                    //but continue iterating for more ScrablerPlugins
                    Program.Bugtracking(e);
                }
            }

            return(Loaded_ScrablerPlugins);
        }
예제 #2
0
        /// <summary>
        /// Creates a one-dimensional <see cref="T:System.Array">Array</see> instance containing the collection items.
        /// </summary>
        /// <returns>Array of type ScrablerPluginSDK</returns>
        public ScrablerPluginSDK[] ToArray()
        {
            ScrablerPluginSDK[] array = new ScrablerPluginSDK[this.Count];
            this.CopyTo(array, 0);

            return(array);
        }
예제 #3
0
        /// <summary>
        /// finds a plugin in the loaded plugins collection
        /// </summary>
        /// <param name="plugColl">collections whichs keeps the plugins</param>
        /// <param name="ScrablerPluginName">name of the plugin which you are looking for.</param>
        /// <returns>the plugin you are looking for</returns>
        public ScrablerPluginSDK FindAScrablerPlugin(ScrablerPluginCollection plugColl, string ScrablerPluginName)
        {
            try
            {
                ScrablerPluginSDK plugret = null;
                if ((plugColl != null) && (ScrablerPluginName != null))
                {
                    foreach (ScrablerPluginSDK ScrablerPlugin in plugColl)
                    {
                        if (ScrablerPlugin.Name == ScrablerPluginName)
                        {
                            plugret = ScrablerPlugin;
                        }
                    }
                }
                return(plugret);
            }

            catch (Exception e)
            {
                Program.Bugtracking(e);
                return(null);
            }
        }
예제 #4
0
 public void Remove(ScrablerPluginSDK value)
 {
     List.Remove(value);
 }
예제 #5
0
 public void Insert(int index, ScrablerPluginSDK value)
 {
     List.Insert(index, value);
 }
예제 #6
0
 /// <summary>
 /// Gets the index in the collection of the specified <see cref="ScrablerPluginCollection">ScrablerPluginCollection</see>, if it exists in the collection.
 /// </summary>
 /// <param name="value">The <see cref="ScrablerPluginCollection">ScrablerPluginCollection</see> to locate in the collection.</param>
 /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns>
 public int IndexOf(ScrablerPluginSDK value)
 {
     return(this.List.IndexOf(value));
 }
예제 #7
0
 /// <summary>
 /// Gets a value indicating whether the collection contains the specified <see cref="ScrablerPluginCollection">ScrablerPluginCollection</see>.
 /// </summary>
 /// <param name="value">The <see cref="ScrablerPluginCollection">ScrablerPluginCollection</see> to search for in the collection.</param>
 /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns>
 public bool Contains(ScrablerPluginSDK value)
 {
     return(this.List.Contains(value));
 }
예제 #8
0
 public int Add(ScrablerPluginSDK value)
 {
     return(this.List.Add(value));
 }