Пример #1
0
        private FileVm GetFileFromRequest(IFormFile file)
        {
            if (Request.Form.Files.Count == 0)
            {
                throw new System.ArgumentException("Files not found");
            }

            file = Request.Form.Files[0];

            string fileName    = file.FileName;
            string contentType = file.ContentType;

            byte[] content;

            using (var stream = new MemoryStream())
            {
                file.CopyTo(stream);
                content = stream.ToArray();
            }

            FileVm fileModel = new FileVm
            {
                Content     = content,
                ContentType = contentType,
                FileName    = fileName,
            };

            return(fileModel);
        }
Пример #2
0
 public PopupItemViewModel(int symbolId, FileVm file, NSpan span, bool isDefenition, IntelliSensePopupViewModel popup)
 {
     SymbolId     = symbolId;
     File         = file;
     Span         = span;
     IsDefenition = isDefenition;
     Text         = file.Name + " (" + span + ")"; // TODO: convert to line pos and make line preview
     Popup        = popup;
 }
Пример #3
0
 public PopupItemViewModel(int symbolId, FileVm file, NSpan span, bool isDefenition, IntelliSensePopupViewModel popup)
 {
   SymbolId     = symbolId;
   File         = file;
   Span         = span;
   IsDefenition = isDefenition;
   Text         = file.Name + " (" + span + ")"; // TODO: convert to line pos and make line preview
   Popup        = popup;
 }
Пример #4
0
    public void SelectText(FileVm file, NSpan span)
    {
      if (Host.CurrentSolution == null)
        return;

      if (file == null)
        return;

      file.IsSelected = true;

      Selection = span;
      ScrollPosition = new ScrollPosition(CaretLine, CaretColumn);
    }
Пример #5
0
        public void SelectText(FileVm file, NSpan span)
        {
            if (Host.CurrentSolution == null)
            {
                return;
            }

            if (file == null)
            {
                return;
            }

            file.IsSelected = true;

            Selection      = span;
            ScrollPosition = new ScrollPosition(CaretLine, CaretColumn);
        }
Пример #6
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                var    httpClient = _httpClientFactory.CreateClient("IncreaseAPI");
                FileVm fileVm     = null;

                while (fileVm == null)
                {
                    try
                    {
                        fileVm = TransactionUtility
                                 .TransactionBatchSplitter(await httpClient.GetStringAsync("/file.txt"));
                    } catch (Exception e) {
                        Console.WriteLine(e.Message);
                    }
                }

                await FileToBd(fileVm);

                await Task.Delay(TimeSpan.FromMinutes(5), stoppingToken);
            }
        }
Пример #7
0
 private async Task FileToBd(FileVm fileVm)
 {
     await SaveTransactionsAndUsers(fileVm.Transactions);
 }