本文整理汇总了C#中ISettingsProvider.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ISettingsProvider.Get方法的具体用法?C# ISettingsProvider.Get怎么用?C# ISettingsProvider.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISettingsProvider
的用法示例。
在下文中一共展示了ISettingsProvider.Get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TagConverter
public TagConverter(ISettingsProvider settingsProvider)
{
using (var reader = new StreamReader(settingsProvider.Get<string>(SettingsKeys.TagMappingFile)))
{
normalizedTags = reader
.ReadAllLines()
.Where(x => !string.IsNullOrWhiteSpace(x))
.Select(ParseTagDescription)
.ToDictionary(x => x.Name, x => x.RawTags);
rawTagsMapping = normalizedTags
.SelectMany(normalizedTag => normalizedTag.Value.Select(rawTag => new { Normalized = normalizedTag.Key, Raw = rawTag }))
.ToDictionary(x => x.Raw, x => x.Normalized);
}
using (var reader = new StreamReader(settingsProvider.Get<string>(SettingsKeys.CorrectionsFile)))
{
correctionsByProblemUrl = reader
.ReadAllLines()
.Where(x => !string.IsNullOrWhiteSpace(x))
.SelectMany(ParseCorrections)
.GroupBy(x => x.ProblemUrl)
.ToDictionary(x => x.Key, x => x.ToArray());
}
}
示例2: Server
public Server(ISettingsProvider settingsProvider)
{
SettingsProvider = settingsProvider;
var port = SettingsProvider.Get<int>("server.port");
MinecraftServer = new MinecraftServer(new IPEndPoint(IPAddress.Any, port));
MinecraftServer.Settings.MotD = SettingsProvider.Get<string>("server.motd");
MinecraftServer.Settings.OnlineMode = SettingsProvider.Get<bool>("server.onlinemode");
MinecraftServer.ChatMessage += MinecraftServerOnChatMessage;
MinecraftServer.PlayerLoggedIn += MinecraftServerOnPlayerLoggedIn;
MinecraftServer.PlayerLoggedOut += MinecraftServerOnPlayerLoggedOut;
MinecraftServer.TabComplete += MinecraftServer_TabComplete;
}
示例3: StopWordsFilter
public StopWordsFilter(ISettingsProvider settingsProvider)
{
var stopwordsFile = settingsProvider.Get<string>(SettingsKeys.StopwordsFile);
using (var reader = new StreamReader(stopwordsFile))
{
stopwords = new HashSet<string>(reader.ReadAllLines());
}
}
示例4: Server
public Server(ISettingsProvider settingsProvider)
{
SettingsProvider = settingsProvider;
// Touch TerrainGeneration to load it into app domain
FlatlandGenerator.DefaultGeneratorOptions.ToString();
var generator = Level.GetGenerator(SettingsProvider.Get<string>("level.type"));
if (generator == null)
generator = new FlatlandGenerator();
Level level;
if (Directory.Exists(SettingsProvider.Get<string>("level.name")))
level = Level.LoadFrom(SettingsProvider.Get<string>("level.name"));
else
{
level = new Level(generator, SettingsProvider.Get<string>("level.name"));
level.AddWorld("overworld");
level.SaveTo(SettingsProvider.Get<string>("level.name"));
}
MinecraftServer = new MinecraftServer(level);
MinecraftServer.Settings.MotD = SettingsProvider.Get<string>("server.motd");
MinecraftServer.Settings.OnlineMode = SettingsProvider.Get<bool>("server.onlinemode");
MinecraftServer.ChatMessage += MinecraftServerOnChatMessage;
MinecraftServer.PlayerLoggedIn += MinecraftServerOnPlayerLoggedIn;
MinecraftServer.PlayerLoggedOut += MinecraftServerOnPlayerLoggedOut;
//MinecraftServer.TabComplete += MinecraftServer_TabComplete;
}
示例5: Server
public Server(ISettingsProvider settingsProvider)
{
SettingsProvider = settingsProvider;
var port = SettingsProvider.Get<int>("Server.Port");
MinecraftServer = new MinecraftServer(new IPEndPoint(IPAddress.Any, port));
MinecraftServer.ChatMessage += MinecraftServerOnChatMessage;
MinecraftServer.PlayerLoggedIn += MinecraftServerOnPlayerLoggedIn;
MinecraftServer.PlayerLoggedOut += MinecraftServerOnPlayerLoggedOut;
}
示例6: RandomProvider
public RandomProvider(ISettingsProvider settingsProvider)
{
random = new Random(settingsProvider.Get<int>(SettingsKeys.RandomSeed));
}