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


C# IConfigSectionNode类代码示例

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


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

示例1: NFXSlim

        public NFXSlim(TestingSystem context, IConfigSectionNode conf)
            : base(context, conf)
        {
            Type[] known = ReadKnownTypes(conf);

              //we create type registry with well-known types that serializer does not have to emit every time
              m_TypeRegistry = new TypeRegistry(TypeRegistry.BoxedCommonTypes,
                                        TypeRegistry.BoxedCommonNullableTypes,
                                        TypeRegistry.CommonCollectionTypes,
                                        known);

              m_Serializer = new SlimSerializer(m_TypeRegistry);

              //batching allows to remember the encountered types and hence it is a "stateful" mode
              //where serialization part and deserialization part retain the type registries that
              //get auto-updated. This mode is not thread safe
              if (m_Batching)
              {
            m_BatchSer = new SlimSerializer(m_TypeRegistry);
            m_BatchSer.TypeMode = TypeRegistryMode.Batch;

            m_BatchDeser = new SlimSerializer(m_TypeRegistry);
            m_BatchDeser.TypeMode = TypeRegistryMode.Batch;
              }
        }
开发者ID:huoxudong125,项目名称:serbench,代码行数:25,代码来源:NFXSlim.cs

示例2: WorkMatch

        public WorkMatch(IConfigSectionNode confNode)
        {
            if (confNode==null)
              throw new WaveException(StringConsts.ARGUMENT_ERROR + GetType().FullName+".ctor(node==null)");

            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());

            var ppattern = confNode.AttrByName(CONFIG_PATH_ATTR).Value;
            if (ppattern.IsNotNullOrWhiteSpace())
              m_PathPattern = new URIPattern( ppattern );

            var nppattern = confNode.AttrByName(CONFIG_NOT_PATH_ATTR).Value;
            if (nppattern.IsNotNullOrWhiteSpace())
              m_NotPathPattern = new URIPattern( nppattern );

            //Variables
            foreach(var vnode in confNode.Children.Where(c=>c.IsSameName(CONFIG_VAR_SECTION)))
              m_Variables.Register(new Variable(vnode) );

            ConfigAttribute.Apply(this, confNode);

            var permsNode = confNode[Permission.CONFIG_PERMISSIONS_SECTION];
            if (permsNode.Exists)
              m_Permissions = Permission.MultipleFromConf(permsNode);
        }
开发者ID:yhhno,项目名称:nfx,代码行数:29,代码来源:WorkMatch.cs

示例3: IDPasswordCredentials

        /// <summary>
        /// Warning: storing plain credentials in config file is not secure. Use this method for the most simplistic cases
        /// like unit testing
        /// </summary>
        public IDPasswordCredentials(IConfigSectionNode cfg)
        {
            if (cfg == null || !cfg.Exists)
             throw new SecurityException(StringConsts.ARGUMENT_ERROR + "IDPasswordCredentials.ctor(cfg=null|!exists)");

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

示例4: ctor

 private void ctor(IConfigSectionNode confNode)
 {
   //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:vlapchenko,项目名称:nfx,代码行数:7,代码来源:PortalFilter.cs

示例5: Event

      public Event(IEventTimer timer, string name = null, TimerEvent body = null, TimeSpan? interval = null, IConfigSectionNode config = null) : base(timer)
      {
         if ((timer as IEventTimerImplementation) == null)
          throw new TimeException(StringConsts.ARGUMENT_ERROR + "Event.ctor(timer=null | timer!=IEventTimerImplementation)");

         m_Timer = timer;

         if (body!=null)
          Body += body;

         if (interval.HasValue)
          m_Interval = interval.Value;
      
         if (config!=null)
         {
           Configure(config);
           m_Name = config.AttrByName(Configuration.CONFIG_NAME_ATTR).Value;
         }
      
         if (name.IsNotNullOrWhiteSpace())
           m_Name = name;

         if (m_Name.IsNullOrWhiteSpace()) m_Name = Guid.NewGuid().ToString();

         ((IEventTimerImplementation)timer).__InternalRegisterEvent(this);
      }
开发者ID:sergey-msu,项目名称:nfx,代码行数:26,代码来源:Event.cs

示例6: ApplyConfiguredBehaviors

          /// <summary>
          /// Applies behaviors to instance as configured from config section node
          /// </summary>
          public static void ApplyConfiguredBehaviors(object target, IConfigSectionNode node)
          {
              if (target==null) return;
              if (typeof(Behavior).IsAssignableFrom(target.GetType())) return;

              string descr = string.Empty;
              try
              {
                  var firstLevel = true;

                  while(node.Exists)
                  {
                        var bnodes = node[CONFIG_BEHAVIORS_SECTION]
                                          .Children
                                          .Where(c=> c.IsSameName(CONFIG_BEHAVIOR_SECTION) && (firstLevel || c.AttrByName(CONFIG_CASCADE_ATTR).ValueAsBool(false)) )
                                          .OrderBy(c=> c.AttrByName(Configuration.CONFIG_ORDER_ATTR).ValueAsInt());
                        foreach(var bnode in bnodes)
                        {
                            descr = " config path: '{0}', type: '{1}'".Args(bnode.RootPath, bnode.AttrByName(FactoryUtils.CONFIG_TYPE_ATTR).ValueAsString(StringConsts.NULL_STRING));
                            var behavior = FactoryUtils.MakeAndConfigure<Behavior>(bnode);
                            behavior.Apply(target);
                        }

                        node = node.Parent;
                        firstLevel = false;
                 }
             }
             catch(Exception error)
             {
                throw new BehaviorApplyException(StringConsts.CONFIG_BEHAVIOR_APPLY_ERROR.Args(descr, error.ToMessageWithType()), error);
             }
          }
开发者ID:itadapter,项目名称:nfx,代码行数:35,代码来源:Behavior.cs

示例7: TypicalPerson

        public TypicalPerson(TestingSystem context, IConfigSectionNode conf)
            : base(context, conf)
        {
            if (m_Count < 1) m_Count = 1;

            for (var i = 0; i < m_Count; i++)
                m_Data.Add(TypicalPersonData.MakeRandom());
        }
开发者ID:huoxudong125,项目名称:serbench,代码行数:8,代码来源:TypicalPerson.cs

示例8: ProtoBufSerializer

        public ProtoBufSerializer(TestingSystem context, IConfigSectionNode conf)
            : base(context, conf)
        {
            m_KnownTypes = ReadKnownTypes(conf);
            foreach (var knownType in m_KnownTypes)
                m_Model.Add(knownType, true);

            m_Model.CompileInPlace();
        }
开发者ID:huoxudong125,项目名称:serbench,代码行数:9,代码来源:ProtoBufSerializer.cs

示例9: ArrayOfNullableInt

        public ArrayOfNullableInt(TestingSystem context, IConfigSectionNode conf)
            : base(context, conf)
        {
            m_Data = Array.CreateInstance(typeof(int?), Dimensions);

              NFX.Serialization.SerializationUtils.WalkArrayRead(m_Data,
               ()=> NFX.ExternalRandomGenerator.Instance.NextRandomInteger >0 ? (int?)null : NFX.ExternalRandomGenerator.Instance.NextScaledRandomInteger(m_Min, m_Max)
              );
        }
开发者ID:huoxudong125,项目名称:serbench,代码行数:9,代码来源:ArrayTests.cs

示例10: ArrayOfDouble

        public ArrayOfDouble(TestingSystem context, IConfigSectionNode conf)
            : base(context, conf)
        {
            m_Data = Array.CreateInstance(typeof(double), Dimensions);

              NFX.Serialization.SerializationUtils.WalkArrayRead(m_Data,
               ()=> NFX.ExternalRandomGenerator.Instance.NextRandomDouble
              );
        }
开发者ID:huoxudong125,项目名称:serbench,代码行数:9,代码来源:ArrayTests.cs

示例11: ErlLocalNode

 internal ErlLocalNode(string node, IConfigSectionNode config)
     : base(node, config)
 {
     var addr = m_AcceptAddressPort.Split(':').FirstOrDefault();
     if (node.IndexOf('@') < 0 && addr != null)
         node = "{0}@{1}".Args(node, addr);
     
     SetNodeName(node);
 }
开发者ID:sergey-msu,项目名称:nfx,代码行数:9,代码来源:ErlLocalNode.cs

示例12: SharpSerializer

 public SharpSerializer(TestingSystem context, IConfigSectionNode conf)
     : base(context, conf)
 {
     var settings = new Polenter.Serialization.SharpSerializerBinarySettings
       {
           Mode = BinarySerializationMode.Burst
       };
     m_Serializer = new Polenter.Serialization.SharpSerializer(settings);
 }
开发者ID:huoxudong125,项目名称:serbench,代码行数:9,代码来源:SharpSerializer.cs

示例13: getFiles

        static IEnumerable<string> getFiles(IConfigSectionNode configRoot)
        {
            var pathArg = configRoot.AttrByIndex(0).Value;
                                      if (!Path.IsPathRooted(pathArg)) pathArg = "."+Path.DirectorySeparatorChar + pathArg;
                                      var rootPath = Path.GetDirectoryName(pathArg);
                                      var mask = Path.GetFileName(pathArg);
                                      if (mask.Length == 0) mask = "*";

                                      return rootPath.AllFileNamesThatMatch(mask, configRoot["r"].Exists || configRoot["recurse"].Exists);
        }
开发者ID:vlapchenko,项目名称:nfx,代码行数:10,代码来源:Program.cs

示例14: Write

        /// <summary>
        /// Writes LaconicConfiguration data to the string
        /// </summary>
        public static string Write(IConfigSectionNode data, LaconfigWritingOptions options = null)
        {
            if (options==null) options = LaconfigWritingOptions.PrettyPrint;

            var sb = new StringBuilder();

            writeSection(sb, data, 0, options);

            return sb.ToString();
        }
开发者ID:yhhno,项目名称:nfx,代码行数:13,代码来源:LaconfigWriter.cs

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


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