/// <summary> /// JSON data received as a response from the given wire. /// </summary> public JsonResponse(IWire wire, IDictionary <string, string> request) : base(() => new JsonBody.Of( wire.Response(request) ) ) { }
private void Construct(IWireRenderer wireRenderer, IWireFactory wireFactory, IWire wire, IInputManager inputManager) { this.wireRenderer = wireRenderer; this.wireFactory = wireFactory; this.wire = wire; this.inputManager = inputManager; }
/// <summary> /// Bytes received as a response from the given wire. /// Bytes will be decoded from base 64. /// </summary> public BytesResponse(IWire wire, IDictionary <string, string> request) : base(() => new BytesBody.Of( wire.Response(request) ).AsBytes() ) { }
private Task InternalAddWire(IWire wire) { _wires.Add(wire); WireAdded?.Invoke(wire); return(Task.CompletedTask); }
public static void RewriteWiresFiles(List <WiresFile> wireFiles) { foreach (WiresFile wierFile in wireFiles) { string bakFileName = MakeBakFileName(wierFile.FileName); File.Delete(bakFileName); File.Move(wierFile.FileName, bakFileName); var wiers = wierFile.Wires; string[] lines = new string[wiers.Count]; for (int i = 0; i < wiers.Count; i++) { IWire wireTmp = wiers[i]; if (wireTmp == null) { lines[i] = string.Empty; continue; } if (wireTmp.GetType() == typeof(WireDelimiter)) { lines[i] = ((WireDelimiter)wireTmp).Remark; continue; } Wire wire = (Wire)wireTmp; //lines[i] = $"{wire.Date:00} ! {wire.DebSct,-20} ! {wire.KrdSct,-20} ! {wire.Sum,12:0.00} ! {wire.Remark}"; lines[i] = string.Format("{0:00} ! {1,-20} ! {2,-20} ! {3,12:0.00} ! {4}", wire.Date, wire.DebSct, wire.KrdSct, wire.Sum, wire.Remark); } File.WriteAllLines(wierFile.FileName, lines, Encoding.UTF8); } }
public LogicGate(ref IWire inputWire1, ref IWire outputWire) { InputWire1 = inputWire1; OutputWire = outputWire; Executed = false; }
public string Solve(string input) { var circuit = new Circuit(input); IWire targetWire = circuit.Wires["a"]; return(targetWire.GetOutput(circuit.Wires).ToString()); }
internal Protocol([NotNull] string name, [NotNull] ISerializers serializers, [NotNull] IIdentities identities, [NotNull] IScheduler scheduler, [NotNull] IWire wire, Lifetime lifetime, SerializationCtx?serializationCtx = null, [CanBeNull] ProtocolContexts parentContexts = null, params RdContextBase[] initialContexts) { Name = name ?? throw new ArgumentNullException(nameof(name)); Location = new RName(name); Serializers = serializers ?? throw new ArgumentNullException(nameof(serializers)); Identities = identities ?? throw new ArgumentNullException(nameof(identities)); Scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler)); Wire = wire ?? throw new ArgumentNullException(nameof(wire)); SerializationContext = serializationCtx ?? new SerializationCtx(this, new Dictionary <string, IInternRoot <object> >() { { ProtocolInternScopeStringId, CreateProtocolInternRoot(lifetime) } }); Contexts = parentContexts ?? new ProtocolContexts(SerializationContext); wire.Contexts = Contexts; if (serializationCtx == null) { SerializationContext.InternRoots[ProtocolInternScopeStringId].Bind(lifetime, this, ProtocolInternRootRdId); } foreach (var rdContextBase in initialContexts) { rdContextBase.RegisterOn(Contexts); } if (parentContexts == null) { BindContexts(lifetime); } OutOfSyncModels = new ViewableSet <RdExtBase>(); }
/// <summary> /// Hosts a local http server for unit testing. /// Handles incoming requests using the wire specified for that path. /// Always dispose this or the returned <see cref="MockServer"/> after use. /// DO NOT use a wire that will send a http request (like AspNetCoreWire), that would just forward incoming requests, potentially causing an infinite loop. /// </summary> public HttpMock(int port, string path, IWire wire) : this( port, "localhost", new KvpOf <IWire>(path, wire) ) { }
/// <summary> /// Hosts a local http server for unit testing. /// Handles incoming requests using the wire specified for that path. /// Always dispose this or the returned <see cref="MockServer"/> after use. /// DO NOT use a wire that will send a http request (like AspNetCoreWire), that would just forward incoming requests, potentially causing an infinite loop. /// </summary> public HttpMock(int port, string hostname, string path, IWire wire) : this( port, hostname, new KvpOf <IWire>(path, wire) ) { }
public Or([NotNull] IWire wireInOne, [NotNull] IWire wireInTwo, [NotNull] IWire wireOut) { m_WireInOne = wireInOne; m_WireInTwo = wireInTwo; m_WireOut = wireOut; }
/// <summary> /// Form data received as a response from the given wire. /// </summary> public FormResponse(IWire wire, IDictionary <string, string> request) : base(() => new FormParams.Of( wire.Response(request) ), live: false ) { }
/// <summary> /// Routes requests to the given wire, if they match the specified path. /// Otherwise returns 404. /// </summary> public MatchingWire(string path, IWire wire) : this( new Match( new Path(path), wire ) ) { }
/// <summary> /// Default Constructor /// </summary> public WireViewModel(IWire wire) { Wire = wire ?? throw new ArgumentNullException(nameof(wire)); RemoveWireCommand = new RelayCommand(RemoveWire); WireSocketClickedCommand = new RelayParametrizedCommand(WireSocketClicked); WireClickedCommand = new RelayParametrizedCommand(WireClicked); }
protected WiredRdTask(RdCall <TReq, TRes> call, RdId rdId, IScheduler wireScheduler) { myCall = call; RdId = rdId; WireScheduler = wireScheduler; myWire = call.Wire; Location = call.Location.Sub(rdId); }
public void Output_ReturnsOutput_WhenCalled() { // Arrange // Act IWire actual = m_Sut.GetOutputWithIndex(0); // Assert actual.ShouldEqual(m_WireOut); }
public void GetOutputWithIndex_ReturnsWireIn_ForZero() { // Arrange // Act IWire actual = m_Sut.GetOutputWithIndex(0); // Assert actual.ShouldEqual(m_WireOut); }
private void SendState(IWire parentWire, ExtState state) { parentWire.Send(RdId, writer => { SendTrace?.Log($"{this} : {state}"); writer.Write((int)state); writer.Write(SerializationHash); }); }
private void SendState(IWire parentWire, ExtState state) { parentWire.Send(RdId, writer => { TraceMe(LogSend, state); writer.Write((int)state); writer.Write(SerializationHash); }); }
/// <summary> /// A wire template that applies to a request, if the request has the specified path and additional template parts. /// </summary> public Match(string path, IMapInput template, IWire wire) : this( new Parts.Joined( new Parts.Uri.Path(path), template ), wire ) { }
public void WhenTheSignalOnTheWireIs([NotNull] string wireName, bool value, int time) { IWire wire = GetWireFromContext(wireName); wire.SetSignal(time, value); }
public void Update(IWire wire, bool completed) { if (wires.ContainsKey(wire)) { wires[wire] = completed; } CheckTaskState(); }
/// <summary> /// A wire that adds extra parts to every request. /// </summary> public Refined(IWire origin, IEnumerable <IMapInput> requestParts) : base(request => origin.Response( new Requests.Refined( request, requestParts ) ) ) { }
public static int GetServerPort(this IWire wire) { var serverSocketWire = wire as SocketWire.Server; if (serverSocketWire == null) { throw new ArgumentException("You must use SocketWire.Server to get server port"); } return(serverSocketWire.Port); }
/// <summary> /// XML data received as a response from the given wire. /// </summary> public XmlResponse(IWire wire, IDictionary <string, string> request) : base( new ScalarOf <IXML>(() => new XmlBody.Of( wire.Response(request) ) ), live: false ) { }
public WiredRdTask(RdCall <TReq, TRes> call, RdId rdId, IScheduler wireScheduler, bool isEndpoint) { myCall = call; myIsEndpoint = isEndpoint; RdId = rdId; WireScheduler = wireScheduler; myWire = call.Wire; Location = call.Location.Sub(rdId); }
private Task InternalRemoveWire(IWire wire, CancellationToken cancellationToken) { if (wire == null) { throw new ArgumentNullException(nameof(wire)); } _wires.Remove(wire); return(Task.CompletedTask); }
private void SendState(IWire parentWire, ExtState state) { using (base.Proto.Contexts.CreateSendWithoutContextsCookie()) parentWire.Send(RdId, writer => { SendTrace?.Log($"{this} : {state}"); writer.Write((int)state); writer.Write(SerializationHash); }); }
public static IRealTimeProbe CreateRealTimeProbe(IAgenda agenda, IWire wire) { WindsorContainer container = GetWindsorContainerFromContext(); var factory = container.Resolve <IRealTimeProbeFactory>(); IRealTimeProbe probe = factory.Create(agenda, wire); return(probe); }
// todo obsolete public static IRealTimeInverter CreateRealTimeInverter(IWire input, IWire output) { WindsorContainer container = GetWindsorContainerFromContext(); var factory = container.Resolve <IRealTimeInverterFactory>(); IRealTimeInverter inverter = factory.Create(input, output); return(inverter); }