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


C# Config.Get方法代码示例

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


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

示例1: CanConnectToPivotal

 public void CanConnectToPivotal()
 {
     var config = new Config();
     var p = new Pivotal(config.Get<string>("PivotalUserAPIKey"));
     var story = p.GetUnestimatedStory(0);
     Assert.That(story, Is.Not.Null);
 }
开发者ID:cheezburger,项目名称:pivotal-poker,代码行数:7,代码来源:PivotalTest.cs

示例2: GetReturnsConvertedValue

        public void GetReturnsConvertedValue()
        {
            // Arrange
            var cfg = new Config
            {
                Value = "True"
            };

            // Act
            bool b = cfg.Get<bool>();

            cfg.Value = "123";
            int i = cfg.Get<int>();

            // Assert
            Assert.AreEqual( true, b );
            Assert.AreEqual( 123, i );
        }
开发者ID:TheSylence,项目名称:GSD,代码行数:18,代码来源:ConfigTests.cs

示例3: GoogleDocService

        public GoogleDocService()
        {
            var config = new Config();
            OAuth2Parameters parameters = new OAuth2Parameters();

            parameters.ClientId = config.Get("Google_Client_Id");
            parameters.ClientSecret = config.Get("Google_Client_Secret");
            parameters.Scope = config.Get("Google_Scope");

            parameters.AccessToken = config.Get("Google_Auth2_AccessToken");
            parameters.RefreshToken = config.Get("Google_Auth2_RefreshToken");


            GOAuth2RequestFactory requestFactory =
                new GOAuth2RequestFactory(null, "Sheet-bill", parameters);
            _spreadsheetService = new SpreadsheetsService("Sheet-bill");
            _spreadsheetService.RequestFactory = requestFactory;
        }
开发者ID:JonghoL,项目名称:RTBS.Webhooks,代码行数:18,代码来源:GoogleDocService.cs

示例4: Should_favor_instance_property_over_default_array_separator

 public void Should_favor_instance_property_over_default_array_separator()
 {
     ConfiguratorNamespace.Config.DefaultArraySeparator = '|';
     Config = new Config {ArraySeparator = ';'};
     CollectionAssert.AreEqual(
         new[] { 9.1m, 9.2m, 9.3m },
         Config.Get<decimal[]>("test-array-decimal-semicolon")
     );
     ConfiguratorNamespace.Config.DefaultArraySeparator = ',';
 }
开发者ID:ubercow,项目名称:configurator,代码行数:10,代码来源:GetArrayTests.cs

示例5: CanAssignPointsToAStory

        public void CanAssignPointsToAStory()
        {
            const int projectId = 0, storyId = 13115015;
            var config = new Config();
            var p = new Pivotal(config.Get<string>("PivotalUserAPIKey"));
            p.EstimateStory(projectId, storyId, 1);

            var story = p.GetStory(0, storyId);

            Assert.That(story.Estimate, Is.EqualTo(1));
        }
开发者ID:cheezburger,项目名称:pivotal-poker,代码行数:11,代码来源:PivotalTest.cs

示例6: fMap

      //====================================================================================================
      // Constructor
      //====================================================================================================
      public fMap(IController controller, Process process, Config config) {
         m_controller = controller;
         m_config = config;
         
         //Initialize form
         m_config.Suspend();
         Editor = controller.Editors.Default;
         InitializeComponent();
         InitializeLanguage();

         //Add the supported editors to the mode list
         if (controller.Editors != null && controller.Editors.Count > 0) {
            //add supported editors to the mode selector
            foreach (IMapEditor editor in controller.Editors) {
               ToolStripItem item = new ToolStripMenuItem(editor.ToString());
               item.Tag = editor;
               ModeMenu.Items.Add(item);
            }
            miModeMenu.Visible = true;
         } else {
            currentEditor = new MapNavigator();
            miModeMenu.Visible = false;
         }

         //apply the configuration settings from the current profile
         ApplyConfig();
         m_config.Resume();

         //set the intial check state of the context menu toggles
         miOnTop.Checked = this.TopMost;
         miDraggable.Checked = this.Draggable;
         miResizable.Checked = this.Resizable;
         miClickThru.Checked = this.ClickThrough;

         //bind event handlers
         this.Paint += new PaintEventHandler(fMap_Paint);
         MapEngine.Updated += new GenericEvent(MapEngine_Updated);
         MapEngine.ClientRectangle = Bounds;

         MapMenu.Opening += new CancelEventHandler(MapMenu_Opening);
         miOnTop.CheckedChanged += new EventHandler(miOnTop_CheckedChanged);
         miDraggable.CheckedChanged += new EventHandler(miDraggable_CheckedChanged);
         miResizable.CheckedChanged += new EventHandler(miResizable_CheckedChanged);
         miClickThru.CheckedChanged += new EventHandler(miClickThru_CheckedChanged);

         //check the data path and inform the user if invalid
         bool dns = m_config.Get("DNS_MapPath", false);
         if(!dns && !Directory.Exists(MapEngine.Data.FilePath)) {
            int button = MessageBoxEx.Show(string.Format(Program.GetLang("msg_mappath_invalid_text"), MapEngine.Data.FilePath), Program.GetLang("msg_mappath_invalid_title"), new string[] { Program.GetLang("button_browse"), Program.GetLang("button_ignore") }, MessageBoxIcon.Warning, out dns);
            m_config["DNS_MapPath"] = dns;
            if(button == 0) {
               FolderBrowserDialog browse = new FolderBrowserDialog();
               if(browse.ShowDialog(this) == DialogResult.OK) {
                  MapEngine.Data.FilePath = browse.SelectedPath;
                  m_config["MapPath"] = MapEngine.Data.FilePath;
               }
            }
         }

         //check the map pack path and inform the user if invalid
         dns = m_config.Get("DNS_MapPackPath", false);
         if(!dns && !File.Exists(MapPackPath + Program.MapIniFile)) {
            int button = MessageBoxEx.Show(string.Format(Program.GetLang("msg_mappack_invalid_text"), MapPackPath), Program.GetLang("msg_mappack_invalid_title"), new string[] { Program.GetLang("button_download"), Program.GetLang("button_browse"), Program.GetLang("button_ignore") }, MessageBoxIcon.Warning, out dns);
            m_config["DNS_MapPackPath"] = dns;
            if(button == 0) {
               System.Diagnostics.Process.Start(Program.ResGlobal.GetString("config_mappack_url"));
               MessageBox.Show(Program.GetLang("msg_pack_afterdownload_text"), Program.GetLang("msg_pack_afterdownload_title"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            } else if(button == 1) {
               while(true) {
                  FolderBrowserDialog browse = new FolderBrowserDialog();
                  if(browse.ShowDialog(this) == DialogResult.OK) {
                     //if the user selected a path that does not contain the map.ini file then reject it and inform the user
                     if(!File.Exists(browse.SelectedPath + "\\" + Program.MapIniFile)) {
                        if(MessageBox.Show(string.Format(Program.GetLang("msg_mappack_badsel_text_alt"), browse.SelectedPath, Program.MapIniFile), Program.GetLang("msg_mappack_badsel_title"), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                           continue;
                        break;
                     }

                     //lock the new map pack in
                     MapPackPath = browse.SelectedPath;
                     m_config["MapPackPath"] = MapPackPath;
                  }
                  break;
               }
            }
         }

         try {
            //initialize the game instance with the map engine
            m_game = controller.CreateInstance(process, this);

            if (m_game.Valid)
            {
               MapTimer.Tick += new EventHandler(MapTimer_Tick);
               MapTimer.Enabled = true;
            }
         } catch (InstanceException fex) {
//.........这里部分代码省略.........
开发者ID:stsy,项目名称:mappy,代码行数:101,代码来源:fMap.cs

示例7: Test007_readUserConfig

 public virtual void Test007_readUserConfig()
 {
     MockSystemReader mockSystemReader = new MockSystemReader();
     SystemReader.SetInstance(mockSystemReader);
     string hostname = mockSystemReader.GetHostname();
     Config userGitConfig = mockSystemReader.OpenUserConfig(null, FS.DETECTED);
     Config localConfig = new Config(userGitConfig);
     mockSystemReader.ClearProperties();
     string authorName;
     string authorEmail;
     // no values defined nowhere
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual(Constants.UNKNOWN_USER_DEFAULT, authorName);
     NUnit.Framework.Assert.AreEqual(Constants.UNKNOWN_USER_DEFAULT + "@" + hostname,
         authorEmail);
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the system user name is defined
     mockSystemReader.SetProperty(Constants.OS_USER_NAME_KEY, "os user name");
     localConfig.Uncache(UserConfig.KEY);
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     NUnit.Framework.Assert.AreEqual("os user name", authorName);
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     if (hostname != null && hostname.Length != 0)
     {
         authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
         NUnit.Framework.Assert.AreEqual("os user [email protected]" + hostname, authorEmail);
     }
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the git environment variables are defined
     mockSystemReader.SetProperty(Constants.GIT_AUTHOR_NAME_KEY, "git author name");
     mockSystemReader.SetProperty(Constants.GIT_AUTHOR_EMAIL_KEY, "[email protected]");
     localConfig.Uncache(UserConfig.KEY);
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual("git author name", authorName);
     NUnit.Framework.Assert.AreEqual("[email protected]", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the values are defined in the global configuration
     userGitConfig.SetString("user", null, "name", "global username");
     userGitConfig.SetString("user", null, "email", "[email protected]");
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual("global username", authorName);
     NUnit.Framework.Assert.AreEqual("[email protected]", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the values are defined in the local configuration
     localConfig.SetString("user", null, "name", "local username");
     localConfig.SetString("user", null, "email", "[email protected]");
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual("local username", authorName);
     NUnit.Framework.Assert.AreEqual("[email protected]", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     authorName = localConfig.Get(UserConfig.KEY).GetCommitterName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetCommitterEmail();
     NUnit.Framework.Assert.AreEqual("local username", authorName);
     NUnit.Framework.Assert.AreEqual("[email protected]", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsCommitterNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsCommitterEmailImplicit
         ());
 }
开发者ID:kenji-tan,项目名称:ngit,代码行数:77,代码来源:ConfigTest.cs

示例8: ObjectDirectoryInserter

		internal ObjectDirectoryInserter(FileObjectDatabase dest, Config cfg)
		{
			db = dest;
			config = cfg.Get(WriteConfig.KEY);
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:5,代码来源:ObjectDirectoryInserter.cs

示例9: Controller

      //=================================================================================
      // Constructor
      //=================================================================================
      public Controller() {
         InitializeComponent();
         InitializeLanguage();

         //defines a list of built-in action handlers that may be bound to at run time
         m_actions = new Actions<Keys>();
         m_actions.RegisterAction("hk_center", Program.GetLang("hotkey_center"), HK_CenterView, Keys.Control | Keys.Alt | Keys.C);
         m_actions.RegisterAction("hk_snap", Program.GetLang("hotkey_snap"), HK_SnapRange, Keys.Control | Keys.Alt | Keys.S);
         m_actions.RegisterAction("hk_zoom_increase", Program.GetLang("hotkey_zoom_increase"), HK_ZoomIncrease, Keys.Control | Keys.Alt | Keys.OemPeriod);
         m_actions.RegisterAction("hk_zoom_decrease", Program.GetLang("hotkey_zoom_decrease"), HK_ZoomDecrease, Keys.Control | Keys.Alt | Keys.Oemcomma);
         m_actions.RegisterAction("hk_togglegrid", Program.GetLang("hotkey_togglegrid"), HK_ToggleGrid, Keys.Control | Keys.Alt | Keys.G);
         m_actions.RegisterAction("hk_togglelines", Program.GetLang("hotkey_togglelines"), HK_ToggleLines, Keys.Control | Keys.Alt | Keys.M);
         m_actions.RegisterAction("hk_togglelabels", Program.GetLang("hotkey_togglelabels"), HK_ToggleLabels, Keys.Control | Keys.Alt | Keys.L);
         m_actions.RegisterAction("hk_togglehidden", Program.GetLang("hotkey_togglehidden"), HK_ToggleHidden, Keys.Control | Keys.Alt | Keys.H);
         m_actions.RegisterAction("hk_toggleclickthru", Program.GetLang("hotkey_toggleclickthru"), HK_ToggleClickThrough, Keys.Control | Keys.Alt | Keys.T);
         m_actions.RegisterAction("hk_togglemapimage", Program.GetLang("hotkey_togglemapimage"), HK_ToggleMapImage, Keys.Control | Keys.Alt | Keys.I);
         m_actions.RegisterAction("hk_openprefs", Program.GetLang("hotkey_openprefs"), HK_OpenPreferences, Keys.Control | Keys.Alt | Keys.P);
         m_actions.RegisterAction("hk_exit", Program.GetLang("hotkey_exit"), HK_Exit, Keys.Control | Keys.Alt | Keys.Shift | Keys.X);
         m_actions.RegisterAction("hk_edit_start", Program.GetLang("hotkey_edit_start"), HK_EditStartLine, Keys.Alt | Keys.Shift | Keys.S);
         m_actions.RegisterAction("hk_edit_cancel", Program.GetLang("hotkey_edit_cancel"), HK_EditCancelLine, Keys.Alt | Keys.Shift | Keys.C);
         m_actions.RegisterAction("hk_edit_add", Program.GetLang("hotkey_edit_add"), HK_EditAddPoint, Keys.Alt | Keys.Shift | Keys.A);
         m_actions.RegisterAction("hk_edit_remove", Program.GetLang("hotkey_edit_remove"), HK_EditRemovePoint, Keys.Alt | Keys.Shift | Keys.R);

         //Set the initial editor. This must be available before form events begin to fire.
         m_editors = new MapEditors();
         m_editors.RegisterEditor(new MapNavigator());
         m_editors.RegisterEditor(new FFXIMapImageEditor());

         m_gamelist = new Dictionary<int, ProcessItem>();
         m_config = new RegistryConfig(Program.ConfigKey);

         //bind actions from the config
         foreach (KeyValuePair<string, Actions<Keys>.Action> pair in m_actions) {
            pair.Value.Trigger = m_config.GetValue<Keys>(pair.Key, pair.Value.Trigger);
         }

         TrayIcon.MouseDoubleClick += new MouseEventHandler(TrayIcon_MouseDoubleClick);
         TrayMenu.Opening += new CancelEventHandler(TrayMenu_Opening);
         miTrayExit.Click += new EventHandler(miTrayExit_Click);
         miInstance.SelectedIndexChanged += new EventHandler(miInstance_SelectedIndexChanged);
         miRefresh.Click += new EventHandler(miRefresh_Click);
         miSaveDefault.Click += new EventHandler(miSaveDefault_Click);
         miClearDefault.Click += new EventHandler(miClearDefault_Click);
         miActiveOnTop.CheckedChanged += new EventHandler(miActiveOnTop_CheckedChanged);
         miActiveClickthru.CheckedChanged += new EventHandler(miActiveClickthru_CheckedChanged);
         miActiveResizable.CheckedChanged += new EventHandler(miActiveResizable_CheckedChanged);
         miActiveDraggable.CheckedChanged += new EventHandler(miActiveDraggable_CheckedChanged);
         miActiveShowSpawns.CheckedChanged += new EventHandler(miActiveShowSpawns_CheckedChanged);
         miActiveShowHidden.CheckedChanged += new EventHandler(miActiveShowHidden_CheckedChanged);
         miActiveShowLines.CheckedChanged += new EventHandler(miActiveShowLines_CheckedChanged);
         miActiveShowLabels.CheckedChanged += new EventHandler(miActiveShowLabels_CheckedChanged);
         miActiveShowMapImage.CheckedChanged += new EventHandler(miActiveShowMapImage_CheckedChanged);
         miActiveCenter.Click += new EventHandler(miActiveCenter_Click);
         miActiveSnapRange.Click += new EventHandler(miActiveSnapRange_Click);
         miAbout.Click += new EventHandler(miAbout_Click);
         miOptions.Click += new EventHandler(miOptions_Click);
         SetIcon(MapRes.MappyIcon);

         RefreshInstances();

         m_hook = new Hook(Hook.HookType.Keyboard | Hook.HookType.Mouse);
         m_hook.AllowCancel = m_config.Get("HotkeysConsume", false);
         m_hook.KeyDown += new Hook.HookKeyEventHandler(m_hook_KeyDown);
         m_hook.KeyUp += new Hook.HookKeyEventHandler(m_hook_KeyUp);
         m_hook.MouseWheel += new Hook.HookMouseEventHandler(m_hook_MouseWheel);
         m_hook.Enabled = m_config.Get("UseGlobalHotkeys", false);

         bool dns = m_config.Get("DNS_UseGlobalHotkeys", false);
         if(!m_hook.Enabled && !dns) {
            int button = MessageBoxEx.Show(Program.GetLang("msg_hotkey_enable_text"), Program.GetLang("msg_hotkey_enable_title"), new string[] { Program.GetLang("button_enable"), Program.GetLang("button_decline") }, MessageBoxIcon.Question, out dns);
            m_config["DNS_UseGlobalHotkeys"] = dns;
            if(button == 0) {
               m_hook.Enabled = true;
            }
         }

         m_actionkey = m_config.GetValue<Keys>("HotkeyModifier", m_actionkey);
         m_actionkeyState = false;
      }
开发者ID:stsy,项目名称:mappy,代码行数:82,代码来源:Controller.cs

示例10: LoadSignatures

        private static void LoadSignatures(Config config)
        {
            if (sigloaded)
                return;

            //Determine if there are manually configured signatures
            if (config.Exists("sigversion"))
            {
                //If so, first determine if there are new internally built ones and clobber the manual ones if so.
                if (config.Get("sigversion", "") != Application.ProductVersion)
                {
                    config.Remove("sigversion");
                    config.Remove("SIG_MY_ID");
                    config.Remove("SIG_MY_TARGET");
                    config.Remove("SIG_SPAWN_END");
                    config.Remove("SIG_SPAWN_START");
                    config.Remove("SIG_ZONE_ID");
                    config.Remove("SIG_ZONE_SHORT");
                }

                //push the manually configured signatures
                SIG_MY_ID = config.Get("SIG_MY_ID", DEFAULT_SIG_MY_ID);
                SIG_MY_TARGET = config.Get("SIG_MY_TARGET", DEFAULT_SIG_MY_TARGET);
                SIG_SPAWN_END = config.Get("SIG_SPAWN_END", DEFAULT_SIG_SPAWN_END);
                SIG_SPAWN_START = config.Get("SIG_SPAWN_START", DEFAULT_SIG_SPAWN_START);
                SIG_ZONE_ID = config.Get("SIG_ZONE_ID", DEFAULT_SIG_ZONE_ID);
                SIG_ZONE_SHORT = config.Get("SIG_ZONE_SHORT", DEFAULT_SIG_ZONE_SHORT);
            }
            sigloaded = true;
        }
开发者ID:stsy,项目名称:mappy,代码行数:30,代码来源:FFXIGameInstance.cs

示例11: Should_set_default_array_separator

 public void Should_set_default_array_separator()
 {
     ConfiguratorNamespace.Config.DefaultArraySeparator = ';';
     Config = new Config();
     CollectionAssert.AreEqual(
         new[] { 9.1m, 9.2m, 9.3m },
         Config.Get<decimal[]>("test-array-decimal-semicolon")
     );
     ConfiguratorNamespace.Config.DefaultArraySeparator = ',';
 }
开发者ID:ubercow,项目名称:configurator,代码行数:10,代码来源:GetArrayTests.cs


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