示例#1
0
        public async Task <string> GetJobLogs(int projectId, int jobQueueId, CancellationToken cancellationToken = default(CancellationToken))
        {
            var jobQueue = await GetJobQueueById(projectId, jobQueueId);

            if (jobQueue != null)
            {
                return(await _textWriter.Read($"{JobQueueLog.FolderNamePrefix}_{projectId}_{jobQueueId}", null));
            }

            return("");
        }
示例#2
0
        public async Task <string> Get(string name, CancellationToken cancellationToken = default(CancellationToken))
        {
            var protectedValue = await _textWriter.Read(FolderName, name);

            if (!string.IsNullOrEmpty(protectedValue))
            {
                return(_protector.Unprotect(protectedValue));
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        public override async Task <IEnumerable <HelpContext> > GetBySpec(ISpecification <HelpContext> spec, CancellationToken cancellationToken = default)
        {
            var result = await base.GetBySpec(spec, cancellationToken);

            foreach (var item in result)
            {
                var folderPath = Path.Combine(AppContext.BaseDirectory, "HelpContexts", item.Section);
                var fileName   = !string.IsNullOrEmpty(item.SubSection) ? $"{item.SubSection}.txt" : "Default.txt";

                item.Text = await _textWriter.Read(folderPath, fileName);
            }

            return(result);
        }
示例#4
0
        public override async Task OnConnectedAsync()
        {
            var httpContext = Context.GetHttpContext();
            var jobQueueId  = httpContext.Request.Query[JobQueueIdQueryParamKey];

            if (!string.IsNullOrEmpty(jobQueueId))
            {
                await Groups.AddToGroupAsync(Context.ConnectionId, GetGroupName(jobQueueId));

                var previousMessages = await _textWriter.Read($"{JobQueueLog.FolderNamePrefix}{jobQueueId}", null);

                await Clients.Caller.SendAsync("ReceiveInitialMessage", previousMessages);
            }

            await base.OnConnectedAsync();
        }
示例#5
0
 public Task <string> GetJobLogs(int id, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(_textWriter.Read($"{JobQueueLog.FolderNamePrefix}{id}", null));
 }