本文整理汇总了C#中Config.GetSubsections方法的典型用法代码示例。如果您正苦于以下问题:C# Config.GetSubsections方法的具体用法?C# Config.GetSubsections怎么用?C# Config.GetSubsections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config.GetSubsections方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReplacements
private IDictionary<string, string> GetReplacements(Config config, string keyName
)
{
IDictionary<string, string> replacements = new Dictionary<string, string>();
foreach (string url in config.GetSubsections(KEY_URL))
{
foreach (string insteadOf in config.GetStringList(KEY_URL, url, keyName))
{
replacements.Put(insteadOf, url);
}
}
return replacements;
}
示例2: GetAllRemoteConfigs
/// <summary>
/// Parse all remote blocks in an existing configuration file, looking for
/// remotes configuration.
/// </summary>
/// <remarks>
/// Parse all remote blocks in an existing configuration file, looking for
/// remotes configuration.
/// </remarks>
/// <param name="rc">
/// the existing configuration to get the remote settings from.
/// The configuration must already be loaded into memory.
/// </param>
/// <returns>
/// all remotes configurations existing in provided repository
/// configuration. Returned configurations are ordered
/// lexicographically by names.
/// </returns>
/// <exception cref="Sharpen.URISyntaxException">one of the URIs within the remote's configuration is invalid.
/// </exception>
public static IList<NGit.Transport.RemoteConfig> GetAllRemoteConfigs(Config rc)
{
IList<string> names = new AList<string>(rc.GetSubsections(SECTION));
names.Sort();
IList<NGit.Transport.RemoteConfig> result = new AList<NGit.Transport.RemoteConfig
>(names.Count);
foreach (string name in names)
{
result.AddItem(new NGit.Transport.RemoteConfig(rc, name));
}
return result;
}