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


C# ISettingsProvider.Get方法代码示例

本文整理汇总了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());
            }
        }
开发者ID:BurlakovNick,项目名称:AcmProblemClassifier,代码行数:25,代码来源:TagConverter.cs

示例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;
 }
开发者ID:NiLSPACE,项目名称:PartyCraft,代码行数:12,代码来源:Server.cs

示例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());
     }
 }
开发者ID:BurlakovNick,项目名称:AcmProblemClassifier,代码行数:8,代码来源:StopWordsFilter.cs

示例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;
 }
开发者ID:SirCmpwn,项目名称:PartyCraft,代码行数:25,代码来源:Server.cs

示例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;
 }
开发者ID:pdelvo,项目名称:PartyCraft,代码行数:9,代码来源:Server.cs

示例6: RandomProvider

 public RandomProvider(ISettingsProvider settingsProvider)
 {
     random = new Random(settingsProvider.Get<int>(SettingsKeys.RandomSeed));
 }
开发者ID:BurlakovNick,项目名称:AcmProblemClassifier,代码行数:4,代码来源:RandomProvider.cs


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