Exemplo n.º 1
0
        public async Task <TaskDto> GetTaskList()
        {
            CognitoUserManager cognito = new CognitoUserManager();
            var     authorizationToken = cognito.Login(Configuration["AWS:Email"], Configuration["AWS:Password"]);
            TaskDto result             = new TaskDto();

            var client  = new RestClient($"{RemoteAddr}/api/lazyScanProcesses?itemsPerPage=100&pageIndex=0&currentTask.automatic=true&currentTask.status=0");
            var request = new RestRequest(Method.GET);

            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Authorization", $"Bearer {authorizationToken}");

            var response = await client.ExecuteAsync(request);

            if (response.IsSuccessful)
            {
                result = JsonConvert.DeserializeObject <TaskDto>(response.Content);
            }
            else if (response.StatusCode == HttpStatusCode.BadRequest)
            {
                TaskErrorModel resultError = JsonConvert.DeserializeObject <TaskErrorModel>(response.Content);
                throw new ServiceHttpRequestException <string>(response.StatusCode, resultError.errorMessage);
            }
            return(result);
        }
Exemplo n.º 2
0
        private void GetSquiggleValues(TaskErrorModel error, List <ITextSnapshotLine> lines,
                                       string text, int column, out int start, out int length)
        {
            start = LengthUntilGivenPosition(error, lines);
            start = start.ForceInRange(0, SourceBuffer.CurrentSnapshot.GetText().Length - 1);
            start = FindTheBeginning(text, start, column, out int stepsBack);

            length = FindLength(text, error.Column - stepsBack + 1);
        }
Exemplo n.º 3
0
        private int LengthUntilGivenPosition(TaskErrorModel error, List <ITextSnapshotLine> lines)
        {
            var count = 0;

            for (var i = 0; i < error.Line; ++i)
            {
                count += lines[i].GetText().Length;
            }

            return(count + error.Column + (error.Line * 2) + 1);
        }