コード例 #1
0
 /// <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)
                                                                                  )
                                                                              )
 {
 }
コード例 #2
0
ファイル: WireView.cs プロジェクト: omidizadi/among-us-tasks
 private void Construct(IWireRenderer wireRenderer, IWireFactory wireFactory, IWire wire, IInputManager inputManager)
 {
     this.wireRenderer = wireRenderer;
     this.wireFactory  = wireFactory;
     this.wire         = wire;
     this.inputManager = inputManager;
 }
コード例 #3
0
 /// <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()
                                                                               )
 {
 }
コード例 #4
0
        private Task InternalAddWire(IWire wire)
        {
            _wires.Add(wire);
            WireAdded?.Invoke(wire);

            return(Task.CompletedTask);
        }
コード例 #5
0
ファイル: Tools.cs プロジェクト: hurginmixa/Buchalter
        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);
            }
        }
コード例 #6
0
ファイル: LogicGate.cs プロジェクト: FUNCTOR99/AOC
        public LogicGate(ref IWire inputWire1, ref IWire outputWire)
        {
            InputWire1 = inputWire1;
            OutputWire = outputWire;

            Executed = false;
        }
コード例 #7
0
        public string Solve(string input)
        {
            var   circuit    = new Circuit(input);
            IWire targetWire = circuit.Wires["a"];

            return(targetWire.GetOutput(circuit.Wires).ToString());
        }
コード例 #8
0
        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>();
        }
コード例 #9
0
 /// <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)
         )
 {
 }
コード例 #10
0
 /// <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)
         )
 {
 }
コード例 #11
0
 public Or([NotNull] IWire wireInOne,
           [NotNull] IWire wireInTwo,
           [NotNull] IWire wireOut)
 {
     m_WireInOne = wireInOne;
     m_WireInTwo = wireInTwo;
     m_WireOut   = wireOut;
 }
コード例 #12
0
 /// <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
                                                                              )
 {
 }
コード例 #13
0
 /// <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
             )
         )
 {
 }
コード例 #14
0
ファイル: WireViewModel.cs プロジェクト: GeneralKenobi/ECAT
        /// <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);
        }
コード例 #15
0
 protected WiredRdTask(RdCall <TReq, TRes> call, RdId rdId, IScheduler wireScheduler)
 {
     myCall        = call;
     RdId          = rdId;
     WireScheduler = wireScheduler;
     myWire        = call.Wire;
     Location      = call.Location.Sub(rdId);
 }
コード例 #16
0
        public void Output_ReturnsOutput_WhenCalled()
        {
            // Arrange
            // Act
            IWire actual = m_Sut.GetOutputWithIndex(0);

            // Assert
            actual.ShouldEqual(m_WireOut);
        }
コード例 #17
0
        public void GetOutputWithIndex_ReturnsWireIn_ForZero()
        {
            // Arrange
            // Act
            IWire actual = m_Sut.GetOutputWithIndex(0);

            // Assert
            actual.ShouldEqual(m_WireOut);
        }
コード例 #18
0
ファイル: RdExtBase.cs プロジェクト: ForNeVeR/rd
 private void SendState(IWire parentWire, ExtState state)
 {
     parentWire.Send(RdId, writer =>
     {
         SendTrace?.Log($"{this} : {state}");
         writer.Write((int)state);
         writer.Write(SerializationHash);
     });
 }
コード例 #19
0
ファイル: RdExtBase.cs プロジェクト: LongJohnCoder/rd
 private void SendState(IWire parentWire, ExtState state)
 {
     parentWire.Send(RdId, writer =>
     {
         TraceMe(LogSend, state);
         writer.Write((int)state);
         writer.Write(SerializationHash);
     });
 }
コード例 #20
0
 /// <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
         )
 {
 }
コード例 #21
0
        public void WhenTheSignalOnTheWireIs([NotNull] string wireName,
                                             bool value,
                                             int time)
        {
            IWire wire = GetWireFromContext(wireName);

            wire.SetSignal(time,
                           value);
        }
コード例 #22
0
    public void Update(IWire wire, bool completed)
    {
        if (wires.ContainsKey(wire))
        {
            wires[wire] = completed;
        }

        CheckTaskState();
    }
コード例 #23
0
 /// <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
                                                                                   )
                                                                               )
                                                                           )
 {
 }
コード例 #24
0
        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);
        }
コード例 #25
0
 /// <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
         )
 {
 }
コード例 #26
0
ファイル: WiredRdTask.cs プロジェクト: tralivali1234/rd
 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);
 }
コード例 #27
0
        private Task InternalRemoveWire(IWire wire, CancellationToken cancellationToken)
        {
            if (wire == null)
            {
                throw new ArgumentNullException(nameof(wire));
            }

            _wires.Remove(wire);
            return(Task.CompletedTask);
        }
コード例 #28
0
ファイル: RdExtBase.cs プロジェクト: vorotynsky/rd
 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);
         });
 }
コード例 #29
0
        public static IRealTimeProbe CreateRealTimeProbe(IAgenda agenda,
                                                         IWire wire)
        {
            WindsorContainer container = GetWindsorContainerFromContext();

            var            factory = container.Resolve <IRealTimeProbeFactory>();
            IRealTimeProbe probe   = factory.Create(agenda,
                                                    wire);

            return(probe);
        }
コード例 #30
0
        // 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);
        }