Пример #1
0
 public void ApplyPatch(FilePatchDto patch)
 {
     try
     {
         _service.ApplyPatch(patch);
     }
     catch (Exception)
     {
         //TODO: add logger here
     }
 }
Пример #2
0
 public void ApplyPatch(FilePatchDto patch)
 {
     var user = UserActionControl(patch.UserId);
     var directory = _context.WorkingDirs.FirstOrDefault(e => e.Id == patch.ProjectId);
     if (directory == null)
     {
         throw new Exception("File");
     }
     var file = _context.Files.FirstOrDefault(e => e.Id == patch.FileId && e.WorkingDirId == patch.ProjectId);
     if (file == null)
     {
         throw new Exception("file");
     }
     using (var newFile = new FileStream(directory.Path + file.Name, FileMode.Create))
     {
         newFile.Write(patch.Patch,0,patch.Patch.Length);
         newFile.Flush();
     }
 }