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


C# Provider.getName方法代码示例

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


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

示例1: loadProvider


//.........这里部分代码省略.........
                            {
                                string referencedVar = ((YamlScalarNode)node).Value.ToLower();
                                try
                                {
                                    filterCollection = variables[referencedVar].getFilters();
                                }
                                catch
                                {
                                    throw InvalidConfigurationException.fromFormat("{0}: Unknown variable {1} referenced!", variableName, referencedVar);
                                }
                            }
                            // a list of filters
                            else if (node is YamlSequenceNode)
                            {
                                filterCollection = FilterCollection.parseList((YamlSequenceNode)node, filters);
                            }
                            else
                            {
                                throw new InvalidConfigurationException("Invalid filter option specified!");
                            }

                            variables.Add(variableName, new Variable(variableName, type, filterCollection));
                        }
                    }
                    else
                    {
                        throw new InvalidConfigurationException("Invalid configration, aborting the configuration.");
                    }
                }
            }

            foreach (KeyValuePair<string, Variable.Type> entry in VARIABLE_TYPES)
            {
                if (!variables.ContainsKey(entry.Key))
                {
                    variables.Add(entry.Key, new Variable(entry.Key, entry.Value));
                }
            }

            node = (rootNodes.ContainsKey(Node.POST_FILTERS) ? rootNodes[Node.POST_FILTERS] : null);
            FilterCollection postFilters;
            if (node is YamlSequenceNode)
            {
                postFilters = FilterCollection.parseList((YamlSequenceNode)node, filters);
            }
            else
            {
                postFilters = new FilterCollection();
            }

            node = (rootNodes.ContainsKey(Node.VALIDATIONS) ? rootNodes[Node.VALIDATIONS] : null);
            ValidationCollection validations;
            if (node is YamlSequenceNode)
            {
                validations = ValidationCollection.parseList((YamlSequenceNode)node, validators);
            }
            else
            {
                validations = new ValidationCollection();
            }

            IDictionary<String, String> headers = new Dictionary<String, String>();
            node = (rootNodes.ContainsKey(Node.HEADERS) ? rootNodes[Node.HEADERS] : null);
            if (node is YamlMappingNode)
            {
                foreach (KeyValuePair<YamlNode, YamlNode> entry in (YamlMappingNode)node)
                {
                    if (entry.Key is YamlScalarNode && entry.Value is YamlScalarNode)
                    {
                        headers.Add(((YamlScalarNode)entry.Key).Value.Trim(), ((YamlScalarNode)entry.Value).Value);
                    }
                }
            }

            YamlMappingNode configNode;
            node = (rootNodes.ContainsKey(Node.CONFIG) ? rootNodes[Node.CONFIG] : null);
            if (node is YamlMappingNode)
            {
                configNode = (YamlMappingNode)node;
            }
            else
            {
                configNode = new YamlMappingNode();
            }

            LyricsLoader loader = loaderFactory.newLoader(configNode);

            Provider provider = new Provider(lyricsReloaded, name, quality, variables, postFilters, validations, headers, loader, rateLimit);
            logger.info("Provider loaded: " + provider.getName());

            lock (providerLock)
            {
                if (providers.ContainsKey(provider.getName()))
                {
                    logger.info("The provider {0} does already exist and will be replaced.", provider.getName());
                    providers.Remove(provider.getName());
                }
                providers.Add(provider.getName(), provider);
            }
        }
开发者ID:pschichtel,项目名称:LyricsReloaded,代码行数:101,代码来源:ProviderManager.cs


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