当前位置: 首页>>代码示例>>C#>>正文


C# System.Collections.Specialized.StringCollection.RemoveAt方法代码示例

本文整理汇总了C#中System.Collections.Specialized.StringCollection.RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Specialized.StringCollection.RemoveAt方法的具体用法?C# System.Collections.Specialized.StringCollection.RemoveAt怎么用?C# System.Collections.Specialized.StringCollection.RemoveAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Specialized.StringCollection的用法示例。


在下文中一共展示了System.Collections.Specialized.StringCollection.RemoveAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadModules

                /// -----------------------------------------------------------------------------
                /// <summary>
                /// Will load all modules in given list
                /// </summary>
                /// <param name="ModFiles"></param>
                /// <remarks>
                /// Once a module is loaded it will be added the the Module list,
                /// and will then have ModLoad called and the filename property set
                /// </remarks>
                /// <history>
                /// 	[Caleb]	6/18/2005	Created
                /// </history>
                /// -----------------------------------------------------------------------------
                public void LoadModules(string[] ModFiles)
                {
                    System.Collections.Specialized.StringCollection ModuleFiles = new System.Collections.Specialized.StringCollection();
                    Assembly tObject;
                    //File tFile;
                    int tIndex;
                    short tCount = 0;
                    string tMod;
                    string tString;
                    System.Collections.Specialized.StringCollection tFound = new System.Collections.Specialized.StringCollection();
                    foreach (string xMod in ModFiles)
                    {
                        ModuleFiles.Add(xMod);
                    }
                    BlackLightModule tModule;
                    //Cycle through the modules untill they are all loaded or removed
                    while (ModuleFiles.Count > 0)
                    {
                        try
                        {
                            //Infinate loop check
                            if (tCount > 1000)
                            {
                                Base.Core.SendLogMessage("ModuleManagement", "LoadModules", BlackLight.Services.Error.Errors.DEBUG | BlackLight.Services.Error.Errors.WARNING, "It appears we have gotten into an infinate loop while loading modules, loading halted", "Most likely cause is two or more modules require each other and will never be able to load", "", "");
                                return;
                            }
                            tCount += Convert.ToInt16(1);

                            //Get the filename
                            tMod = ModuleFiles[0].ToString();

                            //Make sure it exists
                            if (File.Exists("modules/" + tMod))
                            {

                                //Use .NET to attempt to load the class inside the dll
                                tObject = @Assembly.LoadFrom("modules/" + tMod);

                                //Make sure everything is still hawt or remove the failed module
                                if (tObject == null)
                                {
                                    ModuleFiles.RemoveAt(0);
                                }

                                //Get a list of the classes the module contains
                                Type[] tList = tObject.GetTypes();
                                //Cycle through them all
                                foreach (Type tType in tList)
                                {

                                    //Make sure it uses our module base somewhere
                                    if (tType.IsSubclassOf(typeof(BlackLightModule)) == true)
                                    {
                                        //Alrighty it's a valid module now what?

                                        //Well lets check if its a special module, currently only datadrivers

                                        //Ooooo isn't this sexy
                                        tModule = ((BlackLightModule) tType.GetConstructor(new Type[] { typeof(ServicesDaemon) }).Invoke(new object[] {Base}));

                                        //Or not :'(
                                        if (tModule == null)
                                        {
                                            ModuleFiles.RemoveAt(0);
                                        }

                                        if (tType.IsSubclassOf(typeof(DB.DataDriver)) == true)
                                        {
                                            if (DataDriver == "")
                                            {
                                                DataDriver = tModule.Name;
                                            }
                                            else
                                            {
                                                Base.Core.SendLogMessage("ModuleManagement", "LoadModules", BlackLight.Services.Error.Errors.DEBUG | BlackLight.Services.Error.Errors.WARNING, "DataBase driver already loaded!", "File does not exist", "", "");
                                                ModuleFiles.RemoveAt(0);
                                            }
                                        }

                                        //Set the internal filename for the ModuleList Class
                                        tModule.FileName = tMod;

                                        //Clear the list of found modules for requirements
                                        tFound.Clear();

                                        //Malicious module coder?
                                        if (tModule.Requires.Count < 1000)
//.........这里部分代码省略.........
开发者ID:Mediator,项目名称:Blacklight-IRC-Services,代码行数:101,代码来源:Modules.cs


注:本文中的System.Collections.Specialized.StringCollection.RemoveAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。