• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IConfig的典型用法代码示例。如果您正苦于以下问题:C# IConfig类的具体用法?C# IConfig怎么用?C# IConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IConfig类属于命名空间,在下文中一共展示了IConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Initialise

 public void Initialise(IConfigSource config)
 {
     try 
     {
         m_config = config.Configs["SimianGrid"];
        
         if (m_config != null)
         {
             m_simianURL = m_config.GetString("SimianServiceURL");
             if (String.IsNullOrEmpty(m_simianURL))
             {
                 // m_log.DebugFormat("[SimianGrid] service URL is not defined");
                 return;
             }
             
             InitialiseSimCap();
             SimulatorCapability = SimulatorCapability.Trim();
             m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
         }
     }
     catch (Exception e)
     {
         m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
         return;
     }
 }
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:26,代码来源:SimianGrid.cs


示例2: FindConfiguration

        protected void FindConfiguration(IConfig autoConfig)
        {
            if (autoConfig == null)
                return;

            string serverURL = autoConfig.GetString("RegistrationURI", "");
            OSDMap request = new OSDMap();
            if (serverURL == "")
            {
                //Get the urls from the config
                GetConfigFor("GridServerURI", request);
                request["RegistrationURI"] = request["GridServerURI"];
                GetConfigFor("GridUserServerURI", request);
                GetConfigFor("AssetServerURI", request);
                GetConfigFor("InventoryServerURI", request);
                GetConfigFor("AvatarServerURI", request);
                GetConfigFor("PresenceServerURI", request);
                GetConfigFor("UserInfoServerURI", request);
                GetConfigFor("UserAccountServerURI", request);
                GetConfigFor("AuthenticationServerURI", request);
                GetConfigFor("FriendsServerURI", request);
                GetConfigFor("RemoteServerURI", request);
                GetConfigFor("EventQueueServiceURI", request);
                GetConfigFor("AbuseReportURI", request);
                AddNewUrls("default", request);
            }
            else
            {
                GetConfigFor("RegistrationURI", request);
                AddNewUrls("default", request);
            }
        }
开发者ID:kow,项目名称:Aurora-Sim,代码行数:32,代码来源:ConfigurationService.cs


示例3: Main

 // -------------------------------------------------------------------
 // Constructor
 // -------------------------------------------------------------------
 public Main(IFactory factory)
     : base(factory)
 {
     this.config = factory.Resolve<IConfig>();
     this.logic = factory.Resolve<IBuildLogic>();
     this.configRuntime = factory.Resolve<ICrystalBuildConfigurationRunTime>();
 }
开发者ID:Craiel,项目名称:CarbonProjects,代码行数:10,代码来源:Main.cs


示例4: Initialise

        // -----------------------------------------------------------------
        /// <summary>
        /// Initialise this shared module
        /// </summary>
        /// <param name="scene">this region is getting initialised</param>
        /// <param name="source">nini config, we are not using this</param>
        // -----------------------------------------------------------------
        public void Initialise(IConfigSource config)
        {
            try 
            {
                if ((m_config = config.Configs["JsonStore"]) == null)
                {
                    // There is no configuration, the module is disabled
                    // m_log.InfoFormat("[JsonStore] no configuration info");
                    return;
                }

                m_enabled = m_config.GetBoolean("Enabled", m_enabled);
                m_enableObjectStore = m_config.GetBoolean("EnableObjectStore", m_enableObjectStore);
                m_maxStringSpace = m_config.GetInt("MaxStringSpace", m_maxStringSpace);
                if (m_maxStringSpace == 0)
                    m_maxStringSpace = Int32.MaxValue;
            }
            catch (Exception e)
            {
                m_log.Error("[JsonStore]: initialization error: {0}", e);
                return;
            }

            if (m_enabled)
                m_log.DebugFormat("[JsonStore]: module is enabled");
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:33,代码来源:JsonStoreModule.cs


示例5: WriteConfig

        public override void WriteConfig(IConfig config, string password = null) {
            base.WriteConfig(config, password);

            // Writing configs may seem a little bit convoluted in Potato 2, but you should
            // think of it simply as Command serialization, which allows you to save complex
            // parameters.

            config.Append(new Command() {
                Name = "ThisIsJustACommand",
                Parameters = new List<ICommandParameter>() {
                    new CommandParameter() {
                        Data = {
                            Content = new List<String>() {
                                "Parameter1Value"
                            }
                        }
                    },
                    new CommandParameter() {
                        Data = {
                            Content = new List<String>() {
                                "Parameter2Value"
                            }
                        }
                    }
                }
            }.ToConfigCommand());
        }
开发者ID:EBassie,项目名称:Potato,代码行数:27,代码来源:Program.cs


示例6: Initialise

        public void Initialise(IConfigSource config)
        {
            m_windConfig = config.Configs["Wind"];
//            string desiredWindPlugin = m_dWindPluginName;

            if (m_windConfig != null)
            {
                m_enabled = m_windConfig.GetBoolean("enabled", true);

                m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150);

                // Determine which wind model plugin is desired
                if (m_windConfig.Contains("wind_plugin"))
                {
                    m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName);
                }
            }

            if (m_enabled)
            {
                m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);

            }

        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:25,代码来源:WindModule.cs


示例7: Initialize

        /// <summary>
        /// Initializes with the specified config.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <returns></returns>
        public static bool Initialize(IConfig config)
        {
            m_Config = config;

            if(!config.IndependentLogger)
                LogUtil.Setup(new ELLogger());
            else
                LogUtil.Setup(new DynamicELLogger("Logs", m_Config.GetServerList().Select(s => s.Name)));

            List<IServiceConfig> serviceList = config.GetServiceList();

            Type serviceType;

            foreach (IServiceConfig service in serviceList)
            {
                if (service.Disabled)
                    continue;

                if (!AssemblyUtil.TryGetType(service.Type, out serviceType))
                {
                    LogUtil.LogError("Failed to initialize " + service.ServiceName + "!");
                    return false;
                }

                m_ServiceDict[service.ServiceName] = serviceType;
            }

            return true;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:34,代码来源:SocketServerManager.cs


示例8: Preferences

 public Preferences(IConfig config, QuickFilters filters)
 {
     this.Build ();
     m_config = config;
     coordinateEntry.Latitude = config.HomeLat;
     coordinateEntry.Longitude = config.HomeLon;
     memberId.Text = config.OwnerID;
     unitsCombo.Active = config.ImperialUnits ? 1:0;
     nearbyCombo.Active = config.ShowNearby ? 0:1;
     childPointCombo.Active = config.ShowAllChildren? 1:0;
     dataDirEntry.Text = config.DataDirectory;
     importDirEntry.Text = config.ImportDirectory;
     WaypointSolvedMode = config.SolvedModeState;
     SetStartupFilter(filters, config.StartupFilter);
     MapPoints = config.MapPoints;
     prefixModeCombo.Active = config.IgnoreWaypointPrefixes ? 1:0;
     updateCheck.Active = config.CheckForUpdates;
     UpdateInterval = config.UpdateInterval;
     directEntryCheck.Active = config.UseDirectEntryMode;
     autoCloseCheck.Active = config.AutoCloseWindows;
     selectCachesFromMapCheck.Active = config.AutoSelectCacheFromMap;
     dnfCheck.Active = config.ShowDNFIcon;
     pollEntry.Text = config.GPSDPoll.ToString();
     recenterCheck.Active = config.GPSDAutoMoveMap;
     mapsWidget.Maps = config.OpenLayerMaps;
 }
开发者ID:TweetyHH,项目名称:Open-Cache-Manager,代码行数:26,代码来源:Preferences.cs


示例9: ExclusionFilter

		public ExclusionFilter(ILogger log, IConfig config)
		{
			m_log = log;
			m_config = config;
			m_branchRenamer = config.BranchRename;
			m_headOnlyState = RepositoryState.CreateWithBranchChangesOnly();
		}
开发者ID:runt18,项目名称:CvsntGitImporter,代码行数:7,代码来源:ExclusionFilter.cs


示例10: FileWorker

 protected FileWorker(IConfig controlConfig)
 {
     _userFolder = controlConfig.Get("UserFolder", ".");
     _sharedFolder = controlConfig.Get("SharedFolder", null);
     if (_sharedFolder != null)
         _sharedFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, _sharedFolder);
 }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:7,代码来源:FileWorker.cs


示例11: DropDatabaseTask

 public DropDatabaseTask(IConfig config)
 {
     var url = new MongoUrl(config.ProxyDbConnectionString);
     _mongoDatabase = new MongoClient(url)
         .GetServer()
         .GetDatabase(url.DatabaseName);
 }
开发者ID:hpence,项目名称:ApiProxy,代码行数:7,代码来源:DropDatabaseTask.cs


示例12: TypeToBenchmarks

        public static Benchmark[] TypeToBenchmarks(Type type, IConfig config = null)
        {
            config = GetFullConfig(type, config);

            var allMethods = type.GetMethods();
            return MethodsToBenchmarks(type, allMethods, config);
        }
开发者ID:redknightlois,项目名称:BenchmarkDotNet,代码行数:7,代码来源:BenchmarkConverter.cs


示例13: TransmissionNetDownloader

 public TransmissionNetDownloader(IConfig config)
 {
     var settings = config.GetConfigurationSettings();
     string url = settings.TransmissionUrl;
     transmission = new TransmissionRPC(new Uri(url));
     baseDownloadDir = settings.BaseDownloadDir;
 }
开发者ID:kappy,项目名称:ShowBot,代码行数:7,代码来源:TransmissionNetDownloader.cs


示例14: DefaultLogWrapper

        public DefaultLogWrapper(string logname, IConfig config)
        {
            this.logname = logname;

            Hierarchy hierarchy = (Hierarchy)LogManager.GetRepository();
            hierarchy.Clear();

            TraceAppender tracer = new TraceAppender();
            PatternLayout patternLayout = new PatternLayout();

            patternLayout.ConversionPattern = "%t (%-5level) - %m%n";
            patternLayout.ActivateOptions();

            tracer.Layout = patternLayout;
            tracer.ActivateOptions();
            hierarchy.Root.AddAppender(tracer);

            RollingFileAppender roller = new RollingFileAppender();
            roller.Layout = patternLayout;
            roller.AppendToFile = true;
            roller.RollingStyle = RollingFileAppender.RollingMode.Size;
            roller.MaxSizeRollBackups = 4;
            roller.MaximumFileSize = "100KB";
            roller.StaticLogFileName = true;
            roller.File = Path.Combine(config.IndexFolder, "totalrecall-" + this.logname + ".log");
            roller.ActivateOptions();
            hierarchy.Root.AddAppender(roller);

            hierarchy.Root.Level = Level.All;
            hierarchy.Configured = true;
        }
开发者ID:riadyb,项目名称:totalrecall,代码行数:31,代码来源:DefaultLogWrapper.cs


示例15: GetDatabase

 /// <summary>
 /// Returns MongoDatabase instance using config settings.
 /// If "database" setting is not specified then it's assumed that
 /// connection string contains database name
 /// </summary>
 /// <param name="settings"></param>
 /// <returns></returns>
 public static MongoDatabase GetDatabase(NameValueCollection settings, IConfig config)
 {
     string database = settings["database"];
     return string.IsNullOrEmpty(database) ?
         MongoDatabase.Create(GetConnectionString(settings, config)) :
         MongoServer.Create(GetConnectionString(settings, config)).GetDatabase(database);
 }
开发者ID:mikalai-silivonik,项目名称:bnh,代码行数:14,代码来源:ConnectionUtils.cs


示例16: WebServerAdministrationProvider

 public WebServerAdministrationProvider(ILog log, IConfig config, IFirewallService firewallService)
 {
     this.log = log;
     this.localIPAddress = config.LocalIPAddress;
     this.firewallService = firewallService;
     this.appCmdPath = InitAppCmdPath();
 }
开发者ID:hellojais,项目名称:ironfoundry,代码行数:7,代码来源:WebServerAdministrationProvider.cs


示例17: TypeToBenchmarks

        public static IList<Benchmark> TypeToBenchmarks(Type type, IConfig config = null)
        {
            config = GetFullConfig(type, config);

            var allMethods = type.GetMethods();

            var setupMethod = GetSetupMethod(allMethods);
            var targetMethods = allMethods.Where(method => method.HasAttribute<BenchmarkAttribute>()).ToArray();

            var parameterDefinitions = GetParameterDefinitions(type);
            var parameterInstancesList = parameterDefinitions.Expand();

            var rawJobs = config?.GetJobs().ToArray() ?? new IJob[0];
            if (rawJobs.IsEmpty())
                rawJobs = new[] { Job.Default };
            var jobs = rawJobs.ToArray();

            var targets = GetTargets(targetMethods, type, setupMethod).ToArray();

            return (
                from target in targets
                from job in jobs
                from parameterInstancese in parameterInstancesList
                select new Benchmark(target, job, parameterInstancese)).ToSortedList();
        }
开发者ID:omariom,项目名称:BenchmarkDotNet,代码行数:25,代码来源:BenchmarkConverter.cs


示例18: Agent

        public Agent(ILog log, IConfig config,
            IMessagingProvider messagingProvider,
            IFilesManager filesManager,
            IConfigManager configManager,
            IDropletManager dropletManager,
            IWebServerAdministrationProvider webServerAdministrationProvider,
            IVarzProvider varzProvider)
        {
            this.log               = log;
            this.config            = config;
            this.messagingProvider = messagingProvider;
            this.filesManager      = filesManager;
            this.configManager     = configManager;
            this.dropletManager    = dropletManager;
            this.webServerProvider = webServerAdministrationProvider;
            this.varzProvider      = varzProvider;

            helloMessage = new Hello(messagingProvider.UniqueIdentifier, config.LocalIPAddress, config.FilesServicePort);

            heartbeatTask = new Task(HeartbeatLoop);
            varzTask = new Task(SnapshotVarz);
            monitorAppsTask = new Task(MonitorApps);

            this.maxMemoryMB = config.MaxMemoryMB;
        }
开发者ID:hellojais,项目名称:ironfoundry,代码行数:25,代码来源:Agent.cs


示例19: WordCounter

 public WordCounter(ILogger logger, IConfig config)
 {
     _activeUserRequests = new Dictionary<string, Task>();
     _servedUserRequests = new Semaphore(MAX_ACTIVE_USER_REQUESTS, MAX_ACTIVE_USER_REQUESTS);
     _logger = logger;
     _config = config;
 }
开发者ID:vtchernomorskiy,项目名称:WordCountProblem,代码行数:7,代码来源:WordCounter.cs


示例20: GetProviderFromConfigName

        public static IGroupDataProvider GetProviderFromConfigName(ILog log, IConfig groupsConfig, string configName)
        {
            switch (configName)
            {
                case "XmlRpc":
                    string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL");
                    bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);

                    string ServiceReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", String.Empty);
                    string ServiceWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", String.Empty);

                    log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL);

                    return new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive, ServiceReadKey, ServiceWriteKey);


                case "Native":
                    string dbType = groupsConfig.GetString("NativeProviderDBType");
                    string connStr = groupsConfig.GetString("NativeProviderConnString");

                    ConnectionFactory connFactory = new ConnectionFactory(dbType, connStr);
                    return new NativeGroupDataProvider(connFactory);

            }

            return null;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:27,代码来源:ProviderFactory.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IConfigSectionNode类代码示例发布时间:2022-05-24
下一篇:
C# ICondition类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap