using System; using System.Collections.Generic; using Core.Common.Base.Storage; using log4net; using Ringtoets.Integration.Data; namespace Ringtoets.Integration.Service.Merge { /// /// Service which provides a from a file. /// public class AssessmentSectionProviderService : IAssessmentSectionProvider { private readonly ILog log = LogManager.GetLogger(typeof(AssessmentSectionProviderService)); private readonly IStoreProject storage; /// /// Creates a new instance of /// /// Class responsible to storing and loading the application project. /// Thrown when is null. public AssessmentSectionProviderService(IStoreProject projectStorage) { if (projectStorage == null) { throw new ArgumentNullException(nameof(projectStorage)); } storage = projectStorage; } public IEnumerable GetAssessmentSections(string filePath) { RingtoetsProject openedProject = null; try { openedProject = (RingtoetsProject)storage.LoadProject(filePath); } catch (StorageException e) { log.Error(e.Message, e.InnerException); } return openedProject?.AssessmentSections; } } }