Ejemplo n.º 1
0
        private PartModule FindModule(Part part, PartModule parentModule, string moduleName)
        {
            PartModule matchedModule = null;

            foreach (PartModule module in part.Modules)
            {
                if (module == parentModule)
                {
                    continue;
                }

                if (!IsMatch(module, moduleName))
                {
                    continue;
                }

                if (matchedModule.IsNotNull())
                {
                    throw new Exception("Found more than one matching module");
                }

                matchedModule = module;
            }

            if (matchedModule.IsNull())
            {
                throw new Exception("Could not find matching module");
            }

            return(matchedModule);
        }