Пример #1
0
        /// <summary>
        /// Saves the user store to disk.
        /// </summary>
        public void Save()
        {
            string contents = JsonConvert.SerializeObject(this, Formatting.Indented);

            _dirWrap.CreateDirectory(Path.GetDirectoryName(this.FilePath));
            _fileWrap.WriteAllText(this.FilePath, contents);
        }
Пример #2
0
        public dynamic Save()
        {
            SaveLogFileViewModel model = this.Bind <SaveLogFileViewModel>();

            // make sure the processing directory exists
            _dirWrap.CreateDirectory(_appSettings.LogFileProcessingDirectory);

            foreach (HttpFile f in Request.Files)
            {
                // save the file to disk
                string filePath = Path.Combine(_appSettings.LogFileProcessingDirectory, f.Name);
                using (var fileStream = File.Create(filePath))
                {
                    f.Value.Seek(0, SeekOrigin.Begin);
                    f.Value.CopyTo(fileStream);
                }

                // create the log file record - this will kick off the job to actually process the file
                try
                {
                    _dbContext.BeginTransaction();
                    _createLogFileCommand.Execute(model.ProjectId, filePath);
                    _dbContext.Commit();
                }
                catch (Exception ex)
                {
                    _dbContext.Rollback();
                    return(this.Response.AsJson <string>(ex.Message, HttpStatusCode.BadRequest));
                }
            }
            return(HttpStatusCode.OK);
        }
        public FileSystemContainerManager(string rootPath, IDirectoryWrap directory)
        {
            _rootPath = rootPath;
              _directoryWrapper = directory;

              if (!_directoryWrapper.Exists(rootPath)) {
            _directoryWrapper.CreateDirectory(rootPath);
              }
        }
Пример #4
0
 public void ArgumentNullException_is_thrown_if_directorySecurity_is_null()
 {
     _directoryWrap.CreateDirectory(path, null);
 }
Пример #5
0
 public void StartTest()
 {
     _directoryWrap     = new DirectoryWrap();
     _directoryInfoWrap = _directoryWrap.CreateDirectory(path);
     Assert.IsTrue(_directoryInfoWrap.Exists, "Directory TempTest must be created.");
 }
Пример #6
0
 public void StartTest()
 {
     _directoryWrap = new DirectoryWrap();
     _directoryInfoWrap = _directoryWrap.CreateDirectory(path);
     Assert.IsTrue(_directoryInfoWrap.Exists, "Directory TempTest must be created.");
 }