本文整理汇总了C#中IConfigSectionNode类的典型用法代码示例。如果您正苦于以下问题:C# IConfigSectionNode类的具体用法?C# IConfigSectionNode怎么用?C# IConfigSectionNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IConfigSectionNode类属于命名空间,在下文中一共展示了IConfigSectionNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Group
public Group(IConfigSectionNode node)
{
ConfigAttribute.Apply(this, node);
if (m_Name.IsNullOrWhiteSpace())
m_Name = Guid.NewGuid().ToString();
if (node!=null)
foreach(var cn in node.Children.Where(cn=>cn.IsSameName(NetGate.CONFIG_ADDRESS_SECTION)))
if(!m_Addresses.Register( FactoryUtils.Make<Address>(cn, typeof(Address), args: new object[]{ cn })) )
throw new NetGateException(StringConsts.NETGATE_CONFIG_DUPLICATE_ENTITY_ERROR.Args(cn.AttrByName(Configuration.CONFIG_NAME_ATTR).Value, "Group."+NetGate.CONFIG_ADDRESS_SECTION));
}
开发者ID:vlapchenko,项目名称:nfx,代码行数:11,代码来源:Group.cs
示例17: CompositeHandler
public CompositeHandler(WorkDispatcher dispatcher, IConfigSectionNode confNode) : base(dispatcher, confNode)
{
foreach(var hNode in confNode.Children.Where(cn=>cn.IsSameName(WorkHandler.CONFIG_HANDLER_SECTION)))
{
var sub = FactoryUtils.Make<WorkHandler>(hNode, args: new object[] {dispatcher, hNode});
sub.___setParentHandler( this );
if(!m_Handlers.Register(sub))
throw new WaveException(StringConsts.CONFIG_DUPLICATE_HANDLER_NAME_ERROR.Args(hNode.AttrByName(Configuration.CONFIG_NAME_ATTR).Value));
}
}
开发者ID:vlapchenko,项目名称:nfx,代码行数:11,代码来源:CompositeHandler.cs
示例18: 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
示例19: ConfigureServerInspectors
public static void ConfigureServerInspectors(Registry<IServerMsgInspector> registry, IConfigSectionNode node)
{
node = node[CONFIG_SERVER_INSPECTORS_SECTION];
if (!node.Exists) return;
foreach(var inode in node.Children.Where(c => c.IsSameName(CONFIG_INSPECTOR_SECTION)))
{
var si = FactoryUtils.MakeAndConfigure<IServerMsgInspector>(inode);
registry.Register(si);
}
}
开发者ID:vlapchenko,项目名称:nfx,代码行数:12,代码来源:InspectorIntfs.cs
示例20: 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
注:本文中的IConfigSectionNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论