Пример #1
0
        public ResultFileMigrationDocumentHandler.ResultFile Add(ResultFileMigrationDocumentHandler.ResultFile model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            using (var stream = new MemoryStream(model.Content))
            {
                _resultFileStorage.Insert(model.ScenarioId, model.FileId, stream, model.IsCompressed);
            }
            return(model);
        }
Пример #2
0
        public void Insert(Guid scenarioId, string fileId, string localFolder)
        {
            var localFile = Path.Combine(localFolder, GetFileName(fileId, false));

            if (!System.IO.File.Exists(localFile))
            {
                throw new FileNotFoundException($"Results file {localFile} does not exist");
            }
            using (var stream = File.OpenRead(localFile))
            {
                _resultFileStorage.Insert(scenarioId, fileId, stream, Compression);
                _resultFileStorage.Flush();
            }
        }