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


C# IConfig.Get方法代码示例

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


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

示例1: 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

示例2: Init

        public void Init(VPServices app, Instance bot)
        {
            app.Commands.AddRange(new[] {
                new Command
                (
                    "IRC: Connect", "^irc(start|connect)$",
                    (s,a,d) => { return connect(); },
                    @"Starts the IRC-VP bridge", "!ircstart", 60
                ),

                new Command
                (
                    "IRC: Disconnect", "^irc(end|disconnect)$",
                    (s,a,d) => { return disconnect(); },
                    @"Stops the IRC-VP bridge", "!ircend", 60
                )
            });

            config = app.Settings.Configs["IRC"] ?? app.Settings.Configs.Add("IRC");

            this.app  = app;
            host      = config.Get("Server", "irc.ablivion.net");
            port      = config.GetInt("Port", 6667);
            channel   = config.Get("Channel", "#vp");
            bot.Chat += onWorldChat;

            if (config.GetBoolean("Autoconnect", false))
                connect();
        }
开发者ID:edwinr,项目名称:VPServices,代码行数:29,代码来源:IRC.cs

示例3: Init

 private static void Init()
 {
     config = ConfigurationManager.GetInstance(FILE, (cfg) =>
     {
         cfg.Set(EmailKey.CONTENT, new EmailConfig()
         {
             Username = "[email protected]",
             Password = "yourgmailpassword",
             ToAddress = new List<string>() { "[email protected]", "[email protected]" }
         });
     });
     _instance = config.Get<EmailConfig>(EmailKey.CONTENT);
 }
开发者ID:nkwsqyyzx,项目名称:BetStrategy,代码行数:13,代码来源:Email.cs

示例4: Add

        public void Add(IConfig config) {
            if(configList.Contains(config))
                throw new ArgumentException("IConfig already exists");

            var existingConfig = this[config.Name];

            if(existingConfig != null) {
                // Set all new keys
                var keys = config.GetKeys();
                for(var i = 0; i < keys.Length; i++) {
                    existingConfig.Set(keys[i], config.Get(keys[i]));
                }
            }
            else {
                configList.Add(config);
                OnConfigAdded(new ConfigEventArgs(config));
            }
        }
开发者ID:debop,项目名称:NFramework,代码行数:18,代码来源:ConfigCollection.cs

示例5: Expand

		/// <summary>
		/// Expands key values from the given IConfig.
		/// </summary>
		private string Expand (IConfig config, string key, bool setValue)
		{
			string result = config.Get (key);
			if (result == null) {
				throw new ArgumentException (String.Format ("[{0}] not found in [{1}]",
										key, config.Name));
			}

			while (true)
			{
				int startIndex = result.IndexOf ("${", 0);
				if (startIndex == -1) {
					break;
				}

				int endIndex = result.IndexOf ("}", startIndex + 2);
				if (endIndex == -1) {
					break;
				}

				string search = result.Substring (startIndex + 2, 
												  endIndex - (startIndex + 2));

				if (search == key) {
					// Prevent infinite recursion
					throw new ArgumentException 
						("Key cannot have a expand value of itself: " + key);
				}

				string replace = ExpandValue (config, search);

				result = result.Replace("${" + search + "}", replace);
			}

			if (setValue) {
				config.Set(key, result);
			}

			return result;
		}
开发者ID:exaphaser,项目名称:cs2j,代码行数:43,代码来源:ConfigSourceBase.cs

示例6: TheKeyService

 public TheKeyService(IConfig config)
 {
     _apiKey = config.Get("ThePasswordToLoadNewWordList");
 }
开发者ID:BuckRodgers,项目名称:Movies-AppDB,代码行数:4,代码来源:TheKeyService.cs

示例7: ReadConfigToDap

 public static void ReadConfigToDap(IConfig config, DAuthorProperties dap)
 {
     dap.Fill = DColor.FromString(config.Get(FILL_OPT));
     dap.Stroke = DColor.FromString(config.Get(STROKE_OPT));
     dap.StrokeWidth = config.GetInt(STROKEWIDTH_OPT, 1);
     dap.StrokeStyle = (DStrokeStyle)Enum.Parse(typeof(DStrokeStyle),
         config.Get(STROKESTYLE_OPT, DStrokeStyle.Solid.ToString()), true);
     dap.Alpha = config.GetDouble(ALPHA_OPT, 1);
     dap.StartMarker = (DMarker)Enum.Parse(typeof(DMarker),
         config.Get(STARTMARKER_OPT, DMarker.None.ToString()), true);
     dap.EndMarker = (DMarker)Enum.Parse(typeof(DMarker),
         config.Get(ENDMARKER_OPT, DMarker.None.ToString()), true);
     dap.FontName = config.Get(FONTNAME_OPT, "Arial");
     dap.Bold = config.GetBoolean(BOLD_OPT, false);
     dap.Italics = config.GetBoolean(ITALICS_OPT, false);
     dap.Underline = config.GetBoolean(UNDERLINE_OPT, false);
     dap.Strikethrough = config.GetBoolean(STRIKETHROUGH_OPT, false);
 }
开发者ID:djpnewton,项目名称:ddraw,代码行数:18,代码来源:WorkBookUtils.cs

示例8: FileWorker

 protected FileWorker(IConfig controlConfig)
 {
     _userFolder = controlConfig.Get("UserFolder", ".");
 }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:4,代码来源:FileWorker.cs

示例9: Init

 private static void Init()
 {
     config = ConfigurationManager.GetInstance(FILE_PATH, (cfg) =>
     {
         cfg.Set(ENUMCONSTANT.CONTENT, new Constants()
         {
             URL_BASE = "http://www.yn1999.com/",
             URL_GAME_SHOW = "game_show.asp",
             XPATH_GAME_SHOW_RESULT = "/html[1]/body[1]/table[1]/tr",
             COUNT_GAME_SHOW_RESULT_COLUMNS = 11,
             URL_GAME_TOP = "game_top.asp",
     URL_GAME_USER = "Game_User.asp?id=",
             XPATH_GAME_TOP_RESULT = "html[1]/body[1]/table[1]/tr",
             COUNT_GAME_TOP_RESULT_COLUMNS = 10,
             FILEPATH_GAME_TOP_BEST = "filepath_game_top_best.json.txt",
             COUNT_MIN_PROFIT = 7.0f,
             INT_MINUTES_UPDATE_TOP_PERSON = 600,
             INT_MINUTES_UPDATE_RECOMMEND = 17,
     INT_MINUTES_UPDATE_YIELD_ROI = 24*60
         });
     });
     _instance = config.Get<Constants>(ENUMCONSTANT.CONTENT);
 }
开发者ID:nkwsqyyzx,项目名称:BetStrategy,代码行数:23,代码来源:Constants.cs

示例10: Replace

        /// <summary>
        /// Recursively replaces text.
        /// </summary>
        private void Replace(IConfig config, string key)
        {
            string text = config.Get (key);
            if (text == null) {
                throw new Exception (String.Format ("[{0}] not found in [{1}]",
                                        key, config.Name));
            }
            int startIndex = text.IndexOf ("${", 0);

            if (startIndex != -1) {
                int endIndex = text.IndexOf ("}");
                if (endIndex != -1) {
                    string search = text.Substring (startIndex + 2,
                                                    endIndex - (startIndex + 2));

                    string replace = ReplaceValue (config, search);

                    // Assemble the result string
                    StringBuilder builder = new StringBuilder ();
                    for (int i = 0; i < startIndex; i++)
                    {
                        builder.Append (text[i]);
                    }
                    builder.Append (replace);
                    for (int i = endIndex + 1; i < text.Length; i++)
                    {
                        builder.Append (text[i]);
                    }

                    config.Set (key, builder.ToString ());
                    Replace (config, key); // recurse
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:player-sdk-svn,代码行数:37,代码来源:ConfigSourceBase.cs

示例11: TopologyManager

 public TopologyManager(IConfig controlConfig, IControlUtil controlUtil)
     : base(controlConfig)
 {
     _control = controlUtil;
     _schemaFile = controlConfig.GetString("TopologySchema", null);
     _topologyFolder = controlConfig.Get(FOLDER_KEY, ".");
     _rotateWithHost = controlConfig.GetBoolean("RotateWithHost", true);
     _packetsOnLoad = controlConfig.GetBoolean("PacketsOnLoad", false);
     Namespace = controlConfig.Get("Namespace", Namespace);
 }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:10,代码来源:TopologyManager.cs

示例12: Init

        public static void Init(IConfig controlConfig, UUID godID, Control control, IPrimFactory factory)
        {
            factory.AddLinkSetRoot(factory.Host.ID);

            string userFolder = controlConfig.Get("UserFolder", ".");
            string godName = controlConfig.GetString(GOD_KEY, GOD);
            string sequenceFolder = controlConfig.Get("SequenceFolder", ".");
            string sequence = controlConfig.GetString(SEQUENCE_KEY);

            if (sequence == null) {
                control.HostPrim.Say("Unable to start sequence control. No sequence file specified.");
                throw new Exception("Unable to start sequence control. No sequence file specified.");
            }
            string location = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.Combine(userFolder, Path.Combine(godName, Path.Combine(sequenceFolder, sequence))));
            if (!File.Exists(location)) {
                control.HostPrim.Say("Unable to start sequence control. Sequence File '" + location + "' does not exist.");
                throw new Exception("Unable to start sequence control. Sequence File '" + location + "' does not exist.");
            }

            IButton PlayButton = control.MakeButton("Play");
            IButton PauseButton = control.MakeButton("Pause");
            IButton StopButton = control.MakeButton("Stop");
            IButton StepButton = control.MakeButton("Step");
            IToggle PauseToggle = new Toggle(PauseButton, 1, control.ToggleGlow);

            foreach (var pause in PauseToggle.Prims)
                pause.Colour = Color.White;

            PlayButton.OnTouched += (source, args) => {
                if (!control.Record.PlayingSequence) {
                    control.Clear(godName, godID);
                    control.Record.PlayRecording(godName, godID, sequence);
                }
            };
            StopButton.OnTouched += (source, args) => {
                control.Record.StopPlayback();
                control.Clear(godName, godID);
                control.HostPrim.Say("Stopped playback.");
            };
            PauseToggle.OnToggled += (source, args) => {
                control.Record.Paused = PauseToggle.IsOn;
                foreach (var prim in PauseToggle.Prims) {
                    prim.Glow = PauseToggle.IsOn ? .1d : 0d;
                    prim.Colour = Color.White;
                }
            };
            StepButton.OnTouched += (source, args) => {
                if (!control.Model.Step() && control.Record.PlayingSequence)
                    control.Record.PlayNextEvent();
            };
        }
开发者ID:JohnMcCaffery,项目名称:RoutingIsland,代码行数:51,代码来源:SequenceControl.cs

示例13: Config

        protected override bool Config(out string assembly, out string clazz, out AppDomainSetup setup, out string[] args)
        {
            m_xmrmConfig = LoadConfigValues(out args);
            assembly = m_xmrmConfig.Get(ASSEMBLY);
            clazz = m_xmrmConfig.Get(CLASS);
            setup = new AppDomainSetup();

            string configFile = m_xmrmConfig.Get(CONFIG_FILE);

            //Default base folder is the folder the config file is in if there is one or the folder the assembly file is in if there isn't.
            string defaultBaseFolder = Path.GetDirectoryName(Path.GetFullPath(configFile != null ? configFile : assembly));
            string baseFolder = m_xmrmConfig.Get(BASE_FOLDER, defaultBaseFolder);

            //If the config file specified is relative take it relative to the default base folder.
            if (!Path.IsPathRooted(baseFolder))
                baseFolder = Path.Combine(defaultBaseFolder, baseFolder);
            if (assembly != null && configFile != null)
                assembly = Path.Combine(baseFolder, assembly);
            else if (assembly != null)
                assembly = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assembly);

            if (!TestConfig(configFile, assembly, clazz))
                return false;

            if (configFile != null)
                setup.ConfigurationFile = Path.GetFullPath(configFile);
            setup.ApplicationBase = baseFolder;
            setup.ShadowCopyFiles = m_xmrmConfig.GetBoolean(NO_SHADOW_COPY, true).ToString().ToLower();

            return true;
        }
开发者ID:sanyaade-research-hub,项目名称:XMRM,代码行数:31,代码来源:ScriptXMRM.cs

示例14: ExpandValue

		/// <summary>
		/// Returns the replacement value of a config.
		/// </summary>
		private string ExpandValue (IConfig config, string search)
		{
			string result = null;
			
			string[] replaces = search.Split ('|');
			
			if (replaces.Length > 1) {
				IConfig newConfig = this.Configs[replaces[0]];
				if (newConfig == null) {
					throw new ArgumentException ("Expand config not found: "
												 + replaces[0]);
				}
				result = newConfig.Get (replaces[1]);
				if (result == null) {
					throw new ArgumentException ("Expand key not found: "
												 + replaces[1]);
				}
			} else {
				result = config.Get (search);
				
				if (result == null) {
				    throw new ArgumentException ("Key not found: " + search);
				}
			}
			
			return result;
		}
开发者ID:exaphaser,项目名称:cs2j,代码行数:30,代码来源:ConfigSourceBase.cs

示例15: loadSettings

        void loadSettings(VPServices app)
        {
            lock (mutex)
            {
                iniConfig = app.Settings.Configs["IRC"] ?? app.Settings.Configs.Add("IRC");

                config = new IrcConfig
                {
                    Host    = iniConfig.Get("Server", "localhost"),
                    Port    = iniConfig.GetInt("Port", 6667),
                    Channel = iniConfig.Get("Channel", "#vp"),

                    AutoConnect = iniConfig.GetBoolean("Autoconnect", false),
                    NickName    = iniConfig.Get("Nickname", "VPBridgeBot"),
                    RealName    = iniConfig.Get("Realname", "VPBridgeAdmin"),
                };

                Log.Debug(Name, "Loaded IRC connection settings");
            }
        }
开发者ID:VirtualParadise,项目名称:VPServices,代码行数:20,代码来源:IRC.Core.cs


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