Exemple #1
0
        /// <summary>
        /// Gets all registered parsers in core folder and addins (optional) folders.
        /// </summary>
        /// <returns>List of registered parsers.</returns>
        private static IEnumerable <ISequenceParser> GetSequenceParsers()
        {
            var registeredParsers = new List <ISequenceParser>();
            var implementations   = BioRegistrationService.LocateRegisteredParts <ISequenceParser>();

            foreach (var impl in implementations)
            {
                try
                {
                    ISequenceParser parser = Activator.CreateInstance(impl) as ISequenceParser;
                    if (parser != null)
                    {
                        registeredParsers.Add(parser);
                    }
                }
                catch
                {
                    // Cannot create - no default ctor?
                }
            }
            return(registeredParsers);
        }
        /// <summary>
        /// Gets all registered alphabets in core folder and addins (optional) folders.
        /// </summary>
        /// <returns>List of registered alphabets.</returns>
        private static IEnumerable <IAlphabet> GetAlphabets()
        {
            var implementations     = BioRegistrationService.LocateRegisteredParts <IAlphabet>();
            var registeredAlphabets = new List <IAlphabet>();

            foreach (var impl in implementations)
            {
                try
                {
                    IAlphabet alpha = Activator.CreateInstance(impl) as IAlphabet;
                    if (alpha != null)
                    {
                        registeredAlphabets.Add(alpha);
                    }
                }
                catch
                {
                    // Cannot create - no default ctor?
                }
            }

            return(registeredAlphabets);
        }