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


C# IConfigSectionNode.AttrByName方法代码示例

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


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

示例1: ctor

      private void ctor(IConfigSectionNode confNode)
      {
        
        m_UseThemeCookie = confNode.AttrByName(CONF_USE_THEME_COOKIE_ATTR).ValueAsBool(true);
        m_ThemeCookieName = confNode.AttrByName(CONF_THEME_COOKIE_NAME_ATTR).ValueAsString(DEFAULT_THEME_COOKIE_NAME);

        //read matches
        foreach(var cn in confNode.Children.Where(cn=>cn.IsSameName(WorkMatch.CONFIG_MATCH_SECTION)))
          if(!m_PortalMatches.Register( FactoryUtils.Make<WorkMatch>(cn, typeof(WorkMatch), args: new object[]{ cn })) )
            throw new WaveException(StringConsts.CONFIG_OTHER_DUPLICATE_MATCH_NAME_ERROR.Args(cn.AttrByName(Configuration.CONFIG_NAME_ATTR).Value, "{0}".Args(GetType().FullName))); 
      }
开发者ID:PavelTorgashov,项目名称:nfx,代码行数:11,代码来源:PortalFilter.cs

示例2: Configure

    public override void Configure(IConfigSectionNode node)
    {
      base.Configure(node);

      var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
      var apiKey = node.AttrByName(CONFIG_APIKEY_ATTR).Value;

      var cred = new TaxJarCredentials(email, apiKey);
      var at = new AuthenticationToken(TAXJAR_REALM, email);

      User = new User(cred, at, UserStatus.User, email, email, Rights.None);
    }
开发者ID:PavelTorgashov,项目名称:nfx,代码行数:12,代码来源:TaxJarConnectionParameters.cs

示例3: Configure

        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

            var email = node.AttrByName(CFG_EMAIL).Value;
            var clientID = node.AttrByName(CFG_CLIENT_ID).Value;
            var clientSecret = node.AttrByName(CFG_CLIENT_SECRET).Value;

            var credentials = new PayPalCredentials(email, clientID, clientSecret);
            var token = new AuthenticationToken(PayPalSystem.PAYPAL_REALM, null); // OAuth token is empty at start
            User = new User(credentials, token, email, Rights.None);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:12,代码来源:PayPalConnectionParameters.cs

示例4: Theme

        protected Theme(Portal portal, IConfigSectionNode conf)
        {
            m_Portal = portal;
              m_Name = conf.AttrByName(Configuration.CONFIG_NAME_ATTR).Value;
              if (m_Name.IsNullOrWhiteSpace())
               throw new WaveException(StringConsts.CONFIG_PORTAL_THEME_NO_NAME_ERROR.Args(portal.Name));

              m_Description = conf.AttrByName(Portal.CONFIG_DESCR_ATTR).ValueAsString(m_Name);
              m_Default = conf.AttrByName(Portal.CONFIG_DEFAULT_ATTR).ValueAsBool(false);

              ConfigAttribute.Apply(this, conf);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:12,代码来源:Theme.cs

示例5: Configure

        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

              var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
              var secretKey = node.AttrByName(CONFIG_SECRETKEY_ATTR).Value;
              var publishableKey = node.AttrByName(CONFIG_PUBLISHABLEKEY_ATTR).Value;

              var cred = new StripeCredentials(email, secretKey, publishableKey);
              var at = new AuthenticationToken(STRIPE_REALM, publishableKey);

              User = new User(cred, at, UserStatus.User, publishableKey, publishableKey, Rights.None);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:13,代码来源:StripeConnectionParameters.cs

示例6: WorkFilter

      protected WorkFilter(WorkDispatcher dispatcher, IConfigSectionNode confNode)
      {
        if (confNode==null||dispatcher==null)
         throw new WaveException(StringConsts.ARGUMENT_ERROR + GetType().FullName+".ctor(dispatcher|confNode==null|empty)");

        m_Dispatcher = dispatcher;
        m_Server = dispatcher.ComponentDirector;
        m_Name = confNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value;
        m_Order = confNode.AttrByName(Configuration.CONFIG_ORDER_ATTR).ValueAsInt(0);

        if (m_Name.IsNullOrWhiteSpace())
         throw new WaveException(StringConsts.ARGUMENT_ERROR + GetType().FullName+".ctor(confNode$name==null|empty)");
      }
开发者ID:vlapchenko,项目名称:nfx,代码行数:13,代码来源:WorkFilter.cs

示例7: Configure

    public override void Configure(IConfigSectionNode node)
    {
 	    base.Configure(node);
      var accessKey = node.AttrByName(CONFIG_ACCESSKEY_ATTR).Value;
      var secretKey = node.AttrByName(CONFIG_SECRETKEY_ATTR).Value;

      if (accessKey.IsNotNullOrWhiteSpace())
	    {
        var cred = new S3Credentials(accessKey, secretKey);
        var at = new AuthenticationToken(Bucket, accessKey);
        User = new User(cred, at, UserStatus.User, accessKey, accessKey, Rights.None); 
	    }
    }
开发者ID:vlapchenko,项目名称:nfx,代码行数:13,代码来源:S3V4FileSystemSession.cs

示例8: Configure

    public override void Configure(IConfigSectionNode node)
    {
      base.Configure(node);

      var unm = node.AttrByName(CONFIG_UNAME_ATTR).Value;
      var upwd = node.AttrByName(CONFIG_UPWD_ATTR).Value;

      if (unm.IsNotNullOrWhiteSpace())
      {
        var cred = new IDPasswordCredentials(unm, upwd);
        var at = new AuthenticationToken(ServerURL, unm);
        User = new User(cred, at, UserStatus.User, unm, unm, Rights.None);  
      }
    }
开发者ID:vlapchenko,项目名称:nfx,代码行数:14,代码来源:SVNFileSystemSession.cs

示例9: Configure

    public override void Configure(IConfigSectionNode node)
    {
      base.Configure(node);

      var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
      var cred = new NOPCredentials(email);
      var at = new AuthenticationToken(NOP_REALM, email);

      User = new User(cred, at, email, Rights.None);
    }
开发者ID:PavelTorgashov,项目名称:nfx,代码行数:10,代码来源:NOPConnectionParameters.cs

示例10: Portal

    /// <summary>
    /// Makes portal from config.
    /// Due to the nature of Portal object there is no need to create other parametrized ctors
    /// </summary>
    protected Portal(IConfigSectionNode conf)
    {
      const string PORTAL = "portal";

      m_Name = conf.AttrByName(Configuration.CONFIG_NAME_ATTR).Value;
      if (m_Name.IsNullOrWhiteSpace())
      {
        m_Name = this.GetType().Name;
        if (m_Name.EndsWith(PORTAL, StringComparison.OrdinalIgnoreCase) && m_Name.Length>PORTAL.Length)
         m_Name = m_Name.Substring(0, m_Name.Length-PORTAL.Length);
      }

      m_Description = conf.AttrByName(CONFIG_DESCR_ATTR).ValueAsString(m_Name);
      m_Offline = conf.AttrByName(CONFIG_OFFLINE_ATTR).ValueAsBool(false);
      m_Default = conf.AttrByName(CONFIG_DEFAULT_ATTR).ValueAsBool(false);

      var puri = conf.AttrByName(CONFIG_PRIMARY_ROOT_URI_ATTR).Value;

      try{ m_PrimaryRootUri = new Uri(puri, UriKind.Absolute); }
      catch(Exception error)
      {
        throw new WaveException(StringConsts.CONFIG_PORTAL_ROOT_URI_ERROR.Args(m_Name, error.ToMessageWithType()), error);
      }

      m_Themes = new Registry<Theme>();
      var nthemes = conf.Children.Where(c => c.IsSameName(CONFIG_THEME_SECTION));
      foreach(var ntheme in nthemes)
      {
        var theme = FactoryUtils.Make<Theme>(ntheme, args: new object[]{this, ntheme});
        if(!m_Themes.Register(theme))
          throw new WaveException(StringConsts.CONFIG_PORTAL_DUPLICATE_THEME_NAME_ERROR.Args(theme.Name, m_Name)); 
      }

      if (m_Themes.Count==0)
        throw new WaveException(StringConsts.CONFIG_PORTAL_NO_THEMES_ERROR.Args(m_Name)); 

      m_DefaultTheme = m_Themes.FirstOrDefault(t => t.Default);
      if (m_DefaultTheme==null)
        throw new WaveException(StringConsts.CONFIG_PORTAL_NO_DEFAULT_THEME_ERROR.Args(m_Name)); 

      ConfigAttribute.Apply(this, conf);
    }//.ctor
开发者ID:keck,项目名称:nfx,代码行数:46,代码来源:Portal.cs

示例11: Configure

        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

              var privateToken = node.AttrByName("private-token").ValueAsString();
              if (privateToken.IsNullOrWhiteSpace())
            User = User.Fake;

              var publicToken = node.AttrByName("public-token").ValueAsString();
              if (publicToken.IsNullOrWhiteSpace())
            User = User.Fake;

              var carrierID = node.AttrByName("carrier-id").ValueAsString();
              if (carrierID.IsNotNullOrWhiteSpace())
            CarrierID = carrierID;

              var cred = new ShippoCredentials(privateToken, publicToken);
              var token = new AuthenticationToken(ShippoSystem.SHIPPO_REALM, null);
              User = new User(cred, token, null, Rights.None);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:20,代码来源:ShippoConnectionParameters.cs

示例12: TableOptions

        public TableOptions(IConfigSectionNode node, bool nameRequired = true)
        {
            if (nameRequired) 
            if (node==null || node.AttrByName(Configuration.CONFIG_NAME_ATTR).Value.IsNullOrWhiteSpace())
                throw new PileException(StringConsts.ARGUMENT_ERROR + "TableOptions.ctor($name=null|Empty)");

            ConfigAttribute.Apply(this, node);

            if (this.m_Name.IsNullOrWhiteSpace())
             m_Name = Guid.NewGuid().ToString();
        }
开发者ID:vlapchenko,项目名称:nfx,代码行数:11,代码来源:TableOptions.cs

示例13: Configure

      public override void Configure(IConfigSectionNode node)
      {
        base.Configure(node);
        
        var email = node.AttrByName(CONFIG_EMAIL_ATTR).Value;
        
        var credentials = new GoogleDriveCredentials(email);

        var authToken = new AuthenticationToken();

        User = new User(credentials, authToken, UserStatus.User, name:null, descr:null, rights:Rights.None);
      }
开发者ID:vlapchenko,项目名称:nfx,代码行数:12,代码来源:GoogleDriveParameters.cs

示例14: WorkHandler

      protected WorkHandler(WorkDispatcher dispatcher, IConfigSectionNode confNode)
      {
        if (confNode==null||dispatcher==null)
         throw new WaveException(StringConsts.ARGUMENT_ERROR + GetType().FullName+".ctor(dispatcher|confNode==null|empty)");

        m_Dispatcher = dispatcher;
        m_Server = dispatcher.ComponentDirector;
        m_Name = confNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value;
        m_Order = confNode.AttrByName(Configuration.CONFIG_ORDER_ATTR).ValueAsInt(0);
        if (m_Name.IsNullOrWhiteSpace())
         m_Name = "{0}({1})".Args(GetType().FullName, Guid.NewGuid());


        foreach(var cn in confNode.Children.Where(cn=>cn.IsSameName(WorkFilter.CONFIG_FILTER_SECTION)))
          if(!m_Filters.Register( FactoryUtils.Make<WorkFilter>(cn, typeof(WorkFilter), args: new object[]{ this, cn })) )
            throw new WaveException(StringConsts.CONFIG_HANDLER_DUPLICATE_FILTER_NAME_ERROR.Args(cn.AttrByName(Configuration.CONFIG_NAME_ATTR).Value)); 

        foreach(var cn in confNode.Children.Where(cn=>cn.IsSameName(WorkMatch.CONFIG_MATCH_SECTION)))
          if(!m_Matches.Register( FactoryUtils.Make<WorkMatch>(cn, typeof(WorkMatch), args: new object[]{ cn })) )
            throw new WaveException(StringConsts.CONFIG_HANDLER_DUPLICATE_MATCH_NAME_ERROR.Args(cn.AttrByName(Configuration.CONFIG_NAME_ATTR).Value)); 
      }
开发者ID:vlapchenko,项目名称:nfx,代码行数:21,代码来源:WorkHandler.cs

示例15: Configure

        public override void Configure(IConfigSectionNode node)
        {
            base.Configure(node);

              var merchantId = node.AttrByName("merchant-id").ValueAsString();
              if (merchantId.IsNullOrWhiteSpace())
            User = User.Fake; //throw new PaymentException("Braintree: " + StringConsts.PAYMENT_BRAINTREE_MERCHANT_ID_REQUIRED.Args(this.GetType().FullName));

              var accessToken = node.AttrByName("access-token").ValueAsString();
              if (accessToken.IsNotNullOrWhiteSpace())
            User = new User(new BraintreeAuthCredentials(merchantId, accessToken), new AuthenticationToken(BRAINTREE_REALM, accessToken), merchantId, Rights.None);
              else
              {
            var publicKey = node.AttrByName("public-key").ValueAsString();
            var privateKey = node.AttrByName("private-key").ValueAsString();
            if (publicKey.IsNullOrWhiteSpace() || privateKey.IsNullOrWhiteSpace())
              User = User.Fake; //throw new PaymentException("Braintree: " + StringConsts.PAYMENT_BRAINTREE_CREDENTIALS_REQUIRED.Args(this.GetType().FullName));

            User = new User(new BraintreeCredentials(merchantId, publicKey, privateKey), new AuthenticationToken(BRAINTREE_REALM, publicKey), merchantId, Rights.None);
              }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:21,代码来源:BraintreeConnectionParameters.cs


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