/// <summary> /// Build the Protocol /// </summary> /// <returns>a Protocol Definition</returns> public ProtocolDefinition Build(IDelegateBuilder builder) { var v = new ProtocolDefinition(); v.Accessors = _accessors; v.Packets = _packets.Select((def) => { def.WriteDelegate = builder.BuildWriteDelegate(def, _accessors); def.ReadDelegate = builder.BuildReadDelegate(def, _accessors); return(def); }).ToArray(); v.IdType = _idType; v.LengthHeader = _lengthBehaviour; v.IdHeader = _idHeader; v.IdResolver = _idResolver; if (v.LengthHeader != null) { v.LengthHeader.Protocol = v; } if (v.IdHeader != null) { v.IdHeader.Protocol = v; } if (v.IdResolver != null) { v.IdResolver.Protocol = v; } return(v); }
public LightweightFactory(IKernel kernel, IDelegateBuilder delegateBuiler) { if (kernel == null) { throw new ArgumentNullException("kernel"); } if (delegateBuiler == null) { throw new ArgumentNullException("delegateBuiler"); } this.kernel = kernel; this.delegateBuiler = delegateBuiler; }
public void Setup() { rnd = new Random(); nullBuilder = new NullDelegateBuilder(); }