コード例 #1
0
        public StatusResponse Get(StatusRequest request)
        {
            string platform;
            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.MacOSX:
                    platform = "mac";
                    break;
                case PlatformID.Unix:
                    platform = "unix";
                    break;
                default:
                    platform = "windows";
                    break;
            }

            return new StatusResponse
            {
                Build = new Build
                {
                    Version = typeof(AppHost).Assembly.GetName().Version.ToString()
                },
                OS = new OperatingSystem
                {
                    Name = platform,
                    Version = Environment.OSVersion.Version.ToString(),
                    Arch = Environment.Is64BitProcess ? "64bit" : "32bit"
                }
            };
        }
コード例 #2
0
 public StatusResponse Get(StatusRequest request)
 {
     var matchers = m_evaluator.GetMatchers();
       return new StatusResponse()
     {
       Matchers = matchers
     };
 }
コード例 #3
0
        public StatusResponse Status(string token)
        {
            ValidationUtil.hasTextWithMaxLength(token, ApiConstants.TOKEN_LENGTH, "token");

            return(ExceptionHandler.Perform <StatusResponse, TransactionStatusException>(() =>
            {
                var statusRequest = new StatusRequest(token);
                return _requestService.Perform <StatusResponse, TransactionStatusException>(
                    statusRequest, Options);
            }));
        }
コード例 #4
0
        public ActionResult <StatusResponse> GetTransactionStatus([FromBody]  StatusRequest statusRequest)
        {
            var result = this._IGetStatus.Execute(statusRequest.TransactionId);

            if (result == null)
            {
                return(NotFound($"Transaction '{statusRequest.TransactionId}' not found"));
            }

            return(Ok(result));
        }
        public IHttpActionResult GetStatusRequest(int id)
        {
            StatusRequest statusRequest = db.StatusRequests.Find(id);

            if (statusRequest == null)
            {
                return(NotFound());
            }

            return(Ok(statusRequest));
        }
コード例 #6
0
        public bool ChangePostStatusCMS(Guid id, StatusRequest request)
        {
            bool updated = _postService.UpdateStatus(id, request.UserStatus) != null;

            if (updated == false)
            {
                throw new InternalServerErrorException(CommonConstant.Error.InternalServerError);
            }

            return(updated);
        }
コード例 #7
0
    public void statusPlayer()
    {
        StatusRequest statusRequest = new StatusRequest();

        Ready.SetActive(false);
        Cancel.SetActive(true);
        statusRequest.action = "playerReady";
        statusRequest.ready  = true;
        statusRequest.token  = token;
        SendWebSocketMessage(JsonUtility.ToJson(statusRequest));
    }
コード例 #8
0
ファイル: StatusWorkflow.cs プロジェクト: ThomasReth/ITSS2
        private void Dialog_RequestReceived(Object sender, MessageReceivedEventArgs <StatusRequest> e)
        {
            StatusRequest request = e.Message;

            this.OnMessageReceived(request,
                                   () =>
            {
                IStatusRequestedProcessState processState = new StatusRequestedProcessState(this, request);

                this.ProcessStarted?.Invoke(this, new ProcessStartedEventArgs <IStatusRequestedProcessState>(processState));
            });
        }
        public IHttpActionResult PostStatusRequest(StatusRequest statusRequest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.StatusRequests.Add(statusRequest);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = statusRequest.StatusRequestId }, statusRequest));
        }
コード例 #10
0
    //-------------------------------------------------------------------------
    async void c2sStatusRequest(StatusRequest status_request)
    {
        IRpcSession s           = EntityMgr.LastRpcSession;
        ClientInfo  client_info = CoApp.getClientInfo(s);

        if (client_info == null)
        {
            return;
        }

        var task = await Task.Factory.StartNew <Task <MethodData> >(async() =>
        {
            MethodData method_data = new MethodData();
            method_data.method_id  = MethodType.c2sStatusRequest;
            method_data.param1     = EbTool.protobufSerialize <StatusRequest>(status_request);

            MethodData r = null;
            try
            {
                var grain_playerproxy = GrainClient.GrainFactory.GetGrain <ICellPlayer>(new Guid(client_info.et_player_guid));
                r = await grain_playerproxy.c2sRequest(method_data);
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.ToString());
            }

            return(r);
        });

        if (task.Status == TaskStatus.Faulted || task.Result == null)
        {
            if (task.Exception != null)
            {
                EbLog.Error(task.Exception.ToString());
            }

            return;
        }

        MethodData result = task.Result;

        if (result.method_id == MethodType.None)
        {
            return;
        }

        lock (CoApp.RpcLock)
        {
            var status_response = EbTool.protobufDeserialize <StatusResponse>(result.param1);
            CoApp.rpcBySession(s, (ushort)MethodType.s2cStatusResponse, status_response);
        }
    }
コード例 #11
0
ファイル: StatusWorkflow.cs プロジェクト: ThomasReth/ITSS2
        public async Task <IStatusFinishedProcessState> StartProcessAsync(bool?includeDetails, CancellationToken cancellationToken = default)
        {
            StatusRequest request = this.CreateRequest(includeDetails);

            StatusResponse response = await this.SendRequestAsync(request,
                                                                  () =>
            {
                return(this.Dialog.SendRequestAsync(request, cancellationToken));
            }).ConfigureAwait(continueOnCapturedContext: false);

            return(new StatusFinishedProcessState(request, response));
        }
コード例 #12
0
        protected async override Task Handle(StatusRequest <AzureDevOpsPullRequestsWidget> request, CancellationToken cancellationToken)
        {
            var api = new AzureDevOpsApi(Endpoint);

            var pullRequests = await api.GetPullRequestsAsync(request.Context.Account, request.Context.Project).ConfigureAwait(false);

            request.Context.Text = pullRequests.Count.ToString();

            if (pullRequests is null || pullRequests.Count == 0)
            {
                _dispatcher.InvokeAsync(request.Context.Clear);
            }
コード例 #13
0
ファイル: StatusWorkflow.cs プロジェクト: ThomasReth/ITSS2
        public IStatusFinishedProcessState StartProcess(bool?includeDetails)
        {
            StatusRequest request = this.CreateRequest(includeDetails);

            StatusResponse response = this.SendRequest(request,
                                                       () =>
            {
                return(this.Dialog.SendRequest(request));
            });

            return(new StatusFinishedProcessState(request, response));
        }
コード例 #14
0
        public StatusResponse Status()
        {
            var request = new StatusRequest();

            try {
                return(client.status(request));
            }
            catch (RpcException e) {
                Console.WriteLine("Status Did not work");
                Console.WriteLine(e.Message);
                return(new StatusResponse());
            }
        }
コード例 #15
0
        protected override Task Handle(StatusRequest <PortHealthCheckWidget> request, CancellationToken cancellationToken)
        {
            var protocol = request.Context.Protocol == NetworkProtocol.TCP ? ProtocolType.Tcp : ProtocolType.Udp;

            using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, protocol))
            {
                socket.Connect(request.Context.Host, request.Context.PortNumber);

                request.Context.Status = Status.OK;
            }

            return(Task.CompletedTask);
        }
コード例 #16
0
        public IHttpActionResult DeleteStatusRequest(int id)
        {
            StatusRequest statusRequest = db.StatusRequests.Find(id);

            if (statusRequest == null)
            {
                return(NotFound());
            }

            db.StatusRequests.Remove(statusRequest);
            db.SaveChanges();

            return(Ok(statusRequest));
        }
コード例 #17
0
        public BaseResult <StatusResult> Status(StatusRequest status)
        {
            var validator = new StatusRequestValidator();
            var results   = validator.Validate(status);

            if (results.IsValid)
            {
                return(_gameManager.Execute(status));
            }
            else
            {
                return(BaseResult <StatusResult> .Fail(errors : results.Errors.Select(e => e.ErrorMessage)));
            }
        }
コード例 #18
0
        public async Task <ActionResult <StatusResult> > Status([FromBody] StatusRequest request)
        {
            if (!await _authManager.HasSitePermissionsAsync(request.SiteId, GatherManager.PermissionsList))
            {
                return(Unauthorized());
            }

            var cache = _gatherManager.GetCache(request.Guid);

            return(new StatusResult
            {
                Cache = cache
            });
        }
コード例 #19
0
        public async Task <StatusResponse> StatusAsync(string channel)
        {
            var accessToken = this.channelStore.Get(channel).AccessToken;
            var client      = new RestClient(ApiUrl);
            var request     = new RestRequest(StatusApi);

            request.AddParameter("Authorization", $"Bearer {accessToken}", ParameterType.HttpHeader);
            var requestObject = new StatusRequest()
            {
            };

            request.AddObject(requestObject);
            return(await client.GetAsync <StatusResponse>(request));
        }
コード例 #20
0
        protected override async Task Handle(StatusRequest <HomeAssistantStateWidget> request, CancellationToken cancellationToken)
        {
            request.Context.Status = Status.Running;
            var client = new HAClient(Endpoint.Token, Endpoint.Address);
            var state  = await client.GetState(request.Context.EntityId);

            string value = state.state;

            if (state.attributes.ContainsKey("device_class"))
            {
                var device_class = state.attributes["device_class"];
                if (device_class.ToString() == "timestamp")
                {
                    if (DateTime.TryParse(value, out DateTime date))
                    {
                        var age = DateTime.Now - date;
                        if (age.TotalDays > 1)
                        {
                            value = Math.Round(age.TotalDays).ToString() + " days ago";
                        }
                        else if (age.TotalHours > 1)
                        {
                            value = Math.Round(age.TotalHours).ToString() + " hours ago";
                        }
                        else if (age.TotalMinutes > 1)
                        {
                            value = Math.Round(age.TotalMinutes).ToString() + " minutes ago";
                        }
                        else if (age.TotalSeconds > 1)
                        {
                            value = Math.Round(age.TotalSeconds).ToString() + " seconds ago";
                        }
                        else
                        {
                            value = age.ToString();
                        }
                    }
                }
            }
            if (state.attributes.ContainsKey("unit_of_measurement"))
            {
                value = value + state.attributes["unit_of_measurement"];
            }
            if (request.Context.Notify && request.Context.Text != value)
            {
                _notificationService.Send(new Notification($"State changed from {request.Context.Text} to {value}.", request.Context.Name, NotificationIcon.Info));
            }
            request.Context.Text   = value;
            request.Context.Status = Status.OK;
        }
コード例 #21
0
ファイル: StatusService.cs プロジェクト: BooTeK/Rainy
        public Status Get(StatusRequest req)
        {
            var s = new Status();

            s.Uptime           = MainClass.Uptime;
            s.NumberOfRequests = MainClass.ServedRequests;

            // determine number of users
            using (var conn = DbConfig.GetConnection()) {
                s.NumberOfUser        = conn.Scalar <int>("SELECT COUNT(*) FROM DBUser");
                s.TotalNumberOfNotes  = conn.Scalar <int>("SELECT COUNT(*) FROM DBNote");
                s.AverageNotesPerUser = (float)s.TotalNumberOfNotes / (float)s.NumberOfUser;
            };
            return(s);
        }
コード例 #22
0
        public IEnumerable <ValidationResult> Validate(StatusRequest <TContext> request)
        {
            if (request.Context is null)
            {
                throw new ValidationException("Request context is null.");
            }

            var context = new ValidationContext(request.Context, null, null);

            var results = new List <ValidationResult>();

            Validator.TryValidateObject(request.Context, context, results);

            return(results);
        }
コード例 #23
0
        public void updateClientRequestStatus(GuestRequest gr, StatusRequest s)
        {
            XElement GuestRequestElement = (from p in GuestRequestRoot.Elements()
                                            where Convert.ToInt32(p.Element("GuestRequestKey").Value) == gr.GuestRequestKey
                                            select p).FirstOrDefault();

            if (GuestRequestElement == null)
            {
                throw new Exceptions("This guest request isn't exist, can't update (DAL)", gr.GuestRequestKey, gr.PrivateName);
            }

            GuestRequestElement.Remove();
            GuestRequestRoot.Add(ConverGRToXElement(gr));
            GuestRequestRoot.Save(GuestRequestPath);
        }
コード例 #24
0
ファイル: DiscoveryProvider.cs プロジェクト: t-smirnov/Flip
        public async Task <bool> Status()
        {
            try
            {
                var request  = new StatusRequest();
                var response = await _client.StatusASync(request);

                return(response != null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
コード例 #25
0
        public override ServerBoundPacket ParsePacket(Stream Stream, int Length, int PacketID, MinecraftVersion Version, ConnectionState CurrentState)
        {
            ServerBoundPacket result = new UnknownServerBoundPacket();

            switch (CurrentState)
            {
            case ConnectionState.Handshake:
                switch (PacketID)
                {
                case 0x00:
                    Handshake handshake = new Handshake();
                    handshake.ParseFromStream(Stream, Length, Version);
                    result = handshake;
                    break;
                }
                break;

            case ConnectionState.Status:
                switch (PacketID)
                {
                case 0x00:
                    StatusRequest request = new StatusRequest();
                    request.ParseFromStream(Stream, Length, Version);
                    result = request;
                    break;

                case 0x01:
                    StatusPing ping = new StatusPing();
                    ping.ParseFromStream(Stream, Length, Version);
                    result = ping;
                    break;
                }
                break;

            case ConnectionState.Login:
                switch (PacketID)
                {
                }
                break;

            case ConnectionState.Play:
                switch (PacketID)
                {
                }
                break;
            }
            return(result);
        }
コード例 #26
0
        protected override async Task Handle(StatusRequest <GitHubPagesBuildStatusWidget> request, CancellationToken cancellationToken)
        {
            var response = await new GitHubAPI(Endpoint).GetPagesAsync(request.Context.Repository);

            request.Context.Status = response.Status switch
            {
                "queued" => Status.Queued,
                "building" => Status.Running,
                "built" => Status.OK,
                "errored" => Status.Failed,
                _ => null
            };

            request.Context.URL = response.HtmlUrl;
        }
    }
コード例 #27
0
        public Status AddStatus(StatusRequest request)
        {
            Status newStatus = new Status
            {
                Name        = request.Name,
                StateTypeId = (StateEnum)request.status
            };

            using (var db = new TimeTrackerModelContainer())
            {
                db.Status.Add(newStatus);
                db.SaveChanges();
            }

            return(newStatus);
        }
コード例 #28
0
        private void CarregarStatus()
        {
            IServicoPoupeDirect lServico = Ativador.Get <IServicoPoupeDirect>();

            StatusRequest request = new StatusRequest();

            request.Status = new StatusInfo();

            var lRetornoResgate = lServico.SelecionarStatusAplicacaoResgate(request);

            if (lRetornoResgate.StatusResposta == OMS.Library.MensagemResponseStatusEnum.OK)
            {
                this.rptStatus_FiltroAplicacaoResgate.DataSource = lRetornoResgate.ListaStatus;
                this.rptStatus_FiltroAplicacaoResgate.DataBind();
            }
        }
コード例 #29
0
        public override async Task RunScan(StatusRequest request, IServerStreamWriter <StatusReply> responseStream, ServerCallContext context)
        {
            float progress = 0f;

            while (progress < 1f)
            {
                progress += (float)rng.NextDouble() / 10f;
                await responseStream.WriteAsync(new StatusReply
                {
                    Progress = (progress >= 1f) ? 1f : progress,
                    Finished = (progress >= 1f) ? true : false,
                    Message  = (progress >= 1f) ? "Scan finished!" : "Scanning devices..."
                });

                await Task.Delay(500);
            }
        }
コード例 #30
0
        public void ProcessStatus(StatusRequest request)
        {
            StatusResponse response = new StatusResponse();

            response.AdoptHeader(request);
            response.Component                  = new StatusComponent();
            response.Component.Type             = "Mosaic";
            response.Component.Description      = "Mosaic Service";
            response.Component.State            = this.status;
            response.Component.StateDescription = this.stateDescriptions;

            if (request.IncludeDetails)
            {
                response.Component.SubComponents = this.statusSubComponentList.ToArray();
            }

            request.ConverterStream.Write(response);
        }
コード例 #31
0
        /// <summary>
        ///     Optional connection warm-up to speed up initial access.
        /// </summary>
        public async Task <bool> ConnectAsync()
        {
            try
            {
                var statusRequest = new StatusRequest();

                StatusResponse response = await _etcdClient.StatusASync(statusRequest);

                _logger.LogDebug("Successfully connected to etcd: {response}", response.ToString());
            }
            catch (Exception e)
            {
                _logger.LogWarning(e, "Error connecting to etcd using {client}", _etcdClient);
                return(false);
            }

            return(true);
        }
コード例 #32
0
        public IActionResult Post([FromBody] StatusRequest statusRequest)
        {
            if (!EnumHelper.TryGetFromDescription(statusRequest.Status, out TipoStatus status))
            {
                return(StatusCode(422, new ErroResponse($"O status {statusRequest.Status} é inválido")));
            }

            var statusDoPedido = _statusService.ModificarStatus(
                statusRequest.Pedido, status,
                statusRequest.ItensAprovados,
                statusRequest.ValorAprovado);

            return(StatusCode(200, new StatusResponse
            {
                Pedido = statusRequest.Pedido,
                Status = statusDoPedido.Select(EnumHelper.GetDescription).ToList(),
            }));
        }