Index: Core/Common/src/Core.Common.Base/IO/FileImporterBase.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Core/Common/src/Core.Common.Base/IO/FileImporterBase.cs (.../FileImporterBase.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Common/src/Core.Common.Base/IO/FileImporterBase.cs (.../FileImporterBase.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -33,7 +33,7 @@
/// Object type that is the target for this importer.
public abstract class FileImporterBase : IFileImporter
{
- private readonly ILog log = LogManager.GetLogger(typeof(FileImporterBase));
+ protected readonly ILog Log = LogManager.GetLogger(typeof(FileImporterBase));
///
/// Initializes a new instance of the class.
@@ -110,7 +110,7 @@
///
/// Gets the path to the file to import from.
///
- protected string FilePath { get; private set; }
+ protected string FilePath { get; }
///
/// Gets the value indicating if a cancel request has been made. When true, no
@@ -146,7 +146,7 @@
private void LogImportUncancelableMessage()
{
- log.Warn(Resources.FileImporterBase_LogUncancelableMessage_Import_cannot_be_canceled_and_continued);
+ Log.Warn(Resources.FileImporterBase_LogUncancelableMessage_Import_cannot_be_canceled_and_continued);
}
}
}
\ No newline at end of file
Index: Core/Components/src/Core.Components.Gis.IO/Importers/FeatureBasedMapDataImporter.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Core/Components/src/Core.Components.Gis.IO/Importers/FeatureBasedMapDataImporter.cs (.../FeatureBasedMapDataImporter.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/src/Core.Components.Gis.IO/Importers/FeatureBasedMapDataImporter.cs (.../FeatureBasedMapDataImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -30,8 +30,6 @@
using Core.Components.Gis.IO.Readers;
using DotSpatial.Data;
using DotSpatial.Topology;
-using log4net;
-using ILog = log4net.ILog;
namespace Core.Components.Gis.IO.Importers
{
@@ -41,8 +39,6 @@
///
public class FeatureBasedMapDataImporter : FileImporterBase
{
- private static readonly ILog log = LogManager.GetLogger(typeof(FeatureBasedMapDataImporter));
-
///
/// Creates a new instance of .
///
@@ -68,7 +64,7 @@
protected override void LogImportCanceledMessage()
{
- log.Info(Resources.FeatureBasedMapDataImporter_HandleUserCancelingImport_Import_canceled_no_data_read);
+ Log.Info(Resources.FeatureBasedMapDataImporter_HandleUserCancelingImport_Import_canceled_no_data_read);
}
private void AddFeatureBasedMapDataToMapDataCollection(FeatureBasedMapData importedMapData)
@@ -146,7 +142,7 @@
{
string errorMessage = string.Format(Resources.FeatureBasedMapDataImporter_HandleCriticalFileReadError_Error_0_no_maplayer_imported,
new FileReaderErrorMessageBuilder(FilePath).Build(message));
- log.Error(errorMessage);
+ Log.Error(errorMessage);
return new ReadResult(true);
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Import/CalculationConfigurationImporter.cs
===================================================================
diff -u -r6b18e2c0134c97e01ba13c518fb7a8efa7f42253 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Import/CalculationConfigurationImporter.cs (.../CalculationConfigurationImporter.cs) (revision 6b18e2c0134c97e01ba13c518fb7a8efa7f42253)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Import/CalculationConfigurationImporter.cs (.../CalculationConfigurationImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -25,7 +25,6 @@
using Core.Common.Base.Data;
using Core.Common.Base.IO;
using Core.Common.IO.Readers;
-using log4net;
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
@@ -45,8 +44,6 @@
where TCalculationConfigurationReader : CalculationConfigurationReader
where TReadCalculation : class, IConfigurationItem
{
- protected readonly ILog Log = LogManager.GetLogger(typeof(CalculationConfigurationImporter));
-
///
/// Creates a new instance of .
///
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/FailureMechanismSectionsImporter.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/FailureMechanismSectionsImporter.cs (.../FailureMechanismSectionsImporter.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/FailureMechanismSectionsImporter.cs (.../FailureMechanismSectionsImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -25,7 +25,6 @@
using Core.Common.Base.Geometry;
using Core.Common.Base.IO;
using Core.Common.IO.Readers;
-using log4net;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.IO.Properties;
@@ -48,8 +47,6 @@
///
private const double lengthDifferenceTolerance = 1;
- private static readonly ILog log = LogManager.GetLogger(typeof(FailureMechanismSectionsImporter));
-
private readonly ReferenceLine referenceLine;
///
@@ -104,7 +101,7 @@
protected override void LogImportCanceledMessage()
{
- log.Info(Resources.FailureMechanismSectionsImporter_Import_canceled_no_data_read);
+ Log.Info(Resources.FailureMechanismSectionsImporter_Import_canceled_no_data_read);
}
private ReadResult ReadFailureMechanismSections()
@@ -175,7 +172,7 @@
{
string errorMessage = string.Format(Resources.FailureMechanismSectionsImporter_CriticalErrorMessage_0_No_sections_imported,
message);
- log.Error(errorMessage);
+ Log.Error(errorMessage);
}
private static bool HasStartOrEndPointsTooFarFromReferenceLine(ReferenceLine referenceLine, ICollection mechanismSections)
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs
===================================================================
diff -u -r34bec423be51e69135874f811713b5e41de8b379 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision 34bec423be51e69135874f811713b5e41de8b379)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/ProfilesImporter.cs (.../ProfilesImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -28,7 +28,6 @@
using Core.Common.Base.IO;
using Core.Common.IO.Exceptions;
using Core.Common.IO.Readers;
-using log4net;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.IO.DikeProfiles;
@@ -45,7 +44,6 @@
///
public abstract class ProfilesImporter : FileImporterBase
{
- protected readonly ILog Log = LogManager.GetLogger(typeof(ProfilesImporter));
protected readonly IImporterMessageProvider MessageProvider;
private readonly ReferenceLine referenceLine;
Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs
===================================================================
diff -u -r81eeb27299fa8e87731b4a362a3671c8f3cfac02 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision 81eeb27299fa8e87731b4a362a3671c8f3cfac02)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -30,7 +30,6 @@
using Core.Common.IO.Exceptions;
using Core.Common.IO.Readers;
using Core.Common.Utils.Builders;
-using log4net;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.IO.Exceptions;
using Ringtoets.Common.IO.Properties;
@@ -45,7 +44,6 @@
/// Object type that is the target for this importer.
public abstract class StructuresImporter : FileImporterBase
{
- private readonly ILog log = LogManager.GetLogger(typeof(StructuresImporter));
private readonly ReferenceLine referenceLine;
///
@@ -88,15 +86,15 @@
}
catch (CriticalFileValidationException e)
{
- log.Error(e.Message);
+ Log.Error(e.Message);
return false;
}
return true;
}
protected override void LogImportCanceledMessage()
{
- log.Info(Resources.StructuresImporter_User_canceled);
+ Log.Info(Resources.StructuresImporter_User_canceled);
}
///
@@ -111,7 +109,7 @@
{
if (structuresParameterRow.VarianceType == VarianceType.CoefficientOfVariation)
{
- log.WarnFormat(Resources.StructuresImporter_GetStandardDeviation_Converting_variation_StructureName_0_StructureId_1_ParameterId_2_on_Line_3_,
+ Log.WarnFormat(Resources.StructuresImporter_GetStandardDeviation_Converting_variation_StructureName_0_StructureId_1_ParameterId_2_on_Line_3_,
structureName, structuresParameterRow.LocationId, structuresParameterRow.ParameterId, structuresParameterRow.LineNumber);
return (RoundedDouble) structuresParameterRow.VarianceValue * Math.Abs(structuresParameterRow.NumericalValue);
}
@@ -122,7 +120,7 @@
{
if (structuresParameterRow.VarianceType == VarianceType.StandardDeviation)
{
- log.WarnFormat(Resources.StructuresImporter_GetCoefficientOfVariation_Converting_variation_StructureName_0_StructureId_1_ParameterId_2_on_Line_3_,
+ Log.WarnFormat(Resources.StructuresImporter_GetCoefficientOfVariation_Converting_variation_StructureName_0_StructureId_1_ParameterId_2_on_Line_3_,
structureName, structuresParameterRow.LocationId, structuresParameterRow.ParameterId, structuresParameterRow.LineNumber);
return (RoundedDouble) (structuresParameterRow.VarianceValue / Math.Abs(structuresParameterRow.NumericalValue));
}
@@ -152,7 +150,7 @@
}
else
{
- log.Info(string.Format(Resources.StructuresImporter_TrySetConstructionProperty_Parameter_0_of_StructureName_1_StructureId_2_missing_or_invalid_default_values_used,
+ Log.Info(string.Format(Resources.StructuresImporter_TrySetConstructionProperty_Parameter_0_of_StructureName_1_StructureId_2_missing_or_invalid_default_values_used,
key, structureName, structureId));
}
}
@@ -188,7 +186,7 @@
}
catch (CriticalFileReadException exception)
{
- log.Error(exception.Message);
+ Log.Error(exception.Message);
return new ReadResult(true);
}
@@ -210,7 +208,7 @@
}
catch (Exception exception) when (exception is CriticalFileReadException || exception is LineParseException)
{
- log.Error(exception.Message);
+ Log.Error(exception.Message);
return new ReadResult(true);
}
}
@@ -234,11 +232,11 @@
}
catch (CriticalFileReadException exception)
{
- log.Error(exception.Message);
+ Log.Error(exception.Message);
}
catch (ArgumentException exception)
{
- log.Error(exception.Message);
+ Log.Error(exception.Message);
}
return new ReadResult(true);
}
@@ -266,12 +264,12 @@
Resources.StructuresImporter_GetStructureLocationReadResult_Error_reading_Structure_LineNumber_0_Error_1_,
i + 1,
exception.Message);
- log.Error(message, exception);
+ Log.Error(message, exception);
return new ReadResult(true);
}
catch (CriticalFileReadException exception)
{
- log.Error(exception.Message);
+ Log.Error(exception.Message);
return new ReadResult(true);
}
}
Index: Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineImporter.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineImporter.cs (.../ReferenceLineImporter.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/ReferenceLines/ReferenceLineImporter.cs (.../ReferenceLineImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -25,7 +25,6 @@
using Core.Common.Base;
using Core.Common.Base.IO;
using Core.Common.IO.Readers;
-using log4net;
using Ringtoets.Common.Data.AssessmentSection;
using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources;
@@ -37,8 +36,6 @@
///
public class ReferenceLineImporter : FileImporterBase
{
- private static readonly ILog log = LogManager.GetLogger(typeof(ReferenceLineImporter));
-
private readonly List changedObservables = new List();
private readonly IReferenceLineReplaceHandler replacementHandler;
@@ -83,7 +80,7 @@
protected override void LogImportCanceledMessage()
{
- log.Info(RingtoetsCommonIOResources.ReferenceLineImporter_ProgressText_Import_canceled_no_data_read);
+ Log.Info(RingtoetsCommonIOResources.ReferenceLineImporter_ProgressText_Import_canceled_no_data_read);
}
protected override void DoPostImportUpdates()
@@ -138,11 +135,11 @@
}
}
- private static ReadResult HandleCriticalFileReadError(Exception e)
+ private ReadResult HandleCriticalFileReadError(Exception e)
{
string errorMessage = string.Format(RingtoetsCommonIOResources.ReferenceLineImporter_HandleCriticalFileReadError_Error_0_no_referenceline_imported,
e.Message);
- log.Error(errorMessage);
+ Log.Error(errorMessage);
return new ReadResult(true);
}
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresImporter.cs
===================================================================
diff -u -r81eeb27299fa8e87731b4a362a3671c8f3cfac02 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresImporter.cs (.../HeightStructuresImporter.cs) (revision 81eeb27299fa8e87731b4a362a3671c8f3cfac02)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.IO/HeightStructuresImporter.cs (.../HeightStructuresImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -26,8 +26,10 @@
using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.IO.FileImporters;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
using Ringtoets.Common.IO.Structures;
using Ringtoets.HeightStructures.Data;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
namespace Ringtoets.HeightStructures.IO
{
@@ -37,27 +39,34 @@
///
public class HeightStructuresImporter : StructuresImporter>
{
+ private readonly IImporterMessageProvider messageProvider;
private readonly IStructureUpdateStrategy structureUpdateStrategy;
///
/// Creates a new instance of .
///
/// The height structures to import on.
/// The reference line used to check if the
- /// objects found in the file are intersecting it.
- /// The strategy to update the structures with imported data.
+ /// objects found in the file are intersecting it.
/// The path to the file to import from.
+ /// The message provider to provide messages during importer actions.
+ /// The strategy to update the structures with imported data.
/// Thrown when any of the input parameters is null.
public HeightStructuresImporter(StructureCollection importTarget, ReferenceLine referenceLine,
- IStructureUpdateStrategy structureUpdateStrategy,
- string filePath)
+ string filePath, IImporterMessageProvider messageProvider,
+ IStructureUpdateStrategy structureUpdateStrategy)
: base(importTarget, referenceLine, filePath)
{
+ if (messageProvider == null)
+ {
+ throw new ArgumentNullException(nameof(messageProvider));
+ }
if (structureUpdateStrategy == null)
{
throw new ArgumentNullException(nameof(structureUpdateStrategy));
}
+ this.messageProvider = messageProvider;
this.structureUpdateStrategy = structureUpdateStrategy;
}
@@ -70,6 +79,12 @@
FilePath);
}
+ protected override void LogImportCanceledMessage()
+ {
+ string message = messageProvider.GetCancelledLogMessageText(RingtoetsCommonDataResources.StructureCollection_TypeDescriptor);
+ Log.Info(message);
+ }
+
private IEnumerable CreateHeightStructures(IEnumerable structureLocations,
IDictionary> groupedStructureParameterRows)
{
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs
===================================================================
diff -u -r250f2f821d2540a5c562d5fa9ccaab669dacb24b -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 250f2f821d2540a5c562d5fa9ccaab669dacb24b)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -25,6 +25,7 @@
using System.Linq;
using System.Windows.Forms;
using Core.Common.Base;
+using Core.Common.Base.IO;
using Core.Common.Controls.TreeView;
using Core.Common.Gui.ContextMenu;
using Core.Common.Gui.Forms.ProgressDialog;
@@ -43,6 +44,7 @@
using Ringtoets.Common.Forms.ImportInfos;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TreeNodeInfos;
+using Ringtoets.Common.IO.FileImporters.MessageProviders;
using Ringtoets.Common.Service;
using Ringtoets.Common.Utils;
using Ringtoets.HeightStructures.Data;
@@ -89,16 +91,14 @@
{
yield return new ImportInfo
{
- CreateFileImporter = (context, filePath) => new HeightStructuresImporter(context.WrappedData,
- context.AssessmentSection.ReferenceLine,
- new HeightStructureReplaceDataStrategy(context.FailureMechanism),
- filePath),
Name = RingtoetsCommonFormsResources.StructuresImporter_DisplayName,
Category = RingtoetsCommonFormsResources.Ringtoets_Category,
Image = RingtoetsCommonFormsResources.StructuresIcon,
- FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension,
- RingtoetsCommonIOResources.Shape_file_filter_Description),
- IsEnabled = context => context.AssessmentSection.ReferenceLine != null
+ IsEnabled = IsHeightStructuresImporterEnabled,
+ FileFilterGenerator = HeightStructureFileFilter(),
+ CreateFileImporter = (context, filePath) => CreateHeightStructuresImporter(context,
+ filePath,
+ new ImportMessageProvider())
};
yield return RingtoetsImportInfoFactory.CreateCalculationConfigurationImportInfo(
@@ -111,6 +111,22 @@
context.FailureMechanism));
}
+ public override IEnumerable GetUpdateInfos()
+ {
+ yield return new UpdateInfo
+ {
+ Name = RingtoetsCommonDataResources.StructureCollection_TypeDescriptor,
+ Category = RingtoetsCommonFormsResources.Ringtoets_Category,
+ Image = RingtoetsCommonFormsResources.StructuresIcon,
+ IsEnabled = IsHeightStructuresImporterEnabled,
+ FileFilterGenerator = HeightStructureFileFilter(),
+ CreateFileImporter = (context, filePath) => CreateHeightStructuresImporter(context,
+ filePath,
+ new UpdateMessageProvider()),
+ CurrentPath = context => context.WrappedData.SourcePath
+ };
+ }
+
public override IEnumerable GetExportInfos()
{
yield return RingtoetsExportInfoFactory.CreateCalculationGroupConfigurationExportInfo(
@@ -194,16 +210,7 @@
? Color.FromKnownColor(KnownColor.ControlText)
: Color.FromKnownColor(KnownColor.GrayText),
ChildNodeObjects = context => context.WrappedData.Cast
public class StochasticSoilModelImporter : FileImporterBase
{
- private readonly ILog log = LogManager.GetLogger(typeof(StochasticSoilModelImporter));
private readonly IImporterMessageProvider messageProvider;
private readonly IStochasticSoilModelUpdateModelStrategy modelUpdateStrategy;
private IEnumerable updatedInstances;
@@ -119,7 +117,7 @@
protected override void LogImportCanceledMessage()
{
string message = messageProvider.GetCancelledLogMessageText(RingtoetsPipingDataResources.StochasticSoilModelCollection_TypeDescriptor);
- log.Info(message);
+ Log.Info(message);
}
///
@@ -133,19 +131,19 @@
{
if (!stochasticSoilModel.StochasticSoilProfiles.Any())
{
- log.WarnFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_No_profiles_found_in_stochastic_soil_model_0,
+ Log.WarnFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_No_profiles_found_in_stochastic_soil_model_0,
stochasticSoilModel.Name);
return false;
}
if (stochasticSoilModel.StochasticSoilProfiles.Any(ssp => ssp.SoilProfile == null))
{
- log.WarnFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_SoilModel_0_with_stochastic_soil_profile_without_profile,
+ Log.WarnFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_SoilModel_0_with_stochastic_soil_profile_without_profile,
stochasticSoilModel.Name);
return false;
}
if (!IsSumOfAllProbabilitiesEqualToOne(stochasticSoilModel))
{
- log.WarnFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_Sum_of_probabilities_of_stochastic_soil_model_0_is_not_correct,
+ Log.WarnFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_Sum_of_probabilities_of_stochastic_soil_model_0_is_not_correct,
stochasticSoilModel.Name);
}
return true;
@@ -206,7 +204,7 @@
if (currentProfile.SoilProfileId == previousProfile.SoilProfileId &&
currentProfile.SoilProfileType == previousProfile.SoilProfileType)
{
- log.Warn(string.Format(Resources.StochasticSoilModelImporter_MergeStochasticSoilProfiles_Multiple_SoilProfile_0_used_in_StochasticSoilModel_1_Probabilities_added,
+ Log.Warn(string.Format(Resources.StochasticSoilModelImporter_MergeStochasticSoilProfiles_Multiple_SoilProfile_0_used_in_StochasticSoilModel_1_Probabilities_added,
previousProfile.SoilProfile.Name,
stochasticSoilModel.Name));
@@ -222,7 +220,7 @@
NotifyProgress(Resources.StochasticSoilModelImporter_CheckIfAllProfilesAreUsed_Start_checking_soil_profiles, 1, 1);
foreach (PipingSoilProfile soilProfile in soilProfiles.Where(soilProfile => !PipingSoilProfileIsUsed(soilProfile, stochasticSoilModels)))
{
- log.WarnFormat(Resources.StochasticSoilModelImporter_CheckIfAllProfilesAreUsed_SoilProfile_0_is_not_used_in_any_stochastic_soil_model, soilProfile.Name);
+ Log.WarnFormat(Resources.StochasticSoilModelImporter_CheckIfAllProfilesAreUsed_SoilProfile_0_is_not_used_in_any_stochastic_soil_model, soilProfile.Name);
}
}
@@ -238,7 +236,7 @@
{
string message = string.Format(Resources.StochasticSoilModelImporter_CriticalErrorMessage_0_File_Skipped,
e.Message);
- log.Error(message);
+ Log.Error(message);
}
#region read stochastic soil models
@@ -280,7 +278,7 @@
catch (StochasticSoilProfileReadException e)
{
string message = string.Format(Resources.StochasticSoilModelImporter_GetStochasticSoilModelReadResult_Error_0_stochastic_soil_model_skipped, e.Message);
- log.Error(message);
+ Log.Error(message);
}
}
return new ReadResult(false)
@@ -331,13 +329,13 @@
{
string message = string.Format(Resources.StochasticSoilModelImporter_ReadSoilProfiles_ParseErrorMessage_0_SoilProfile_skipped,
e.Message);
- log.Error(message);
+ Log.Error(message);
}
catch (CriticalFileReadException e)
{
string message = string.Format(Resources.StochasticSoilModelImporter_CriticalErrorMessage_0_File_Skipped,
FilePath, e.Message);
- log.Error(message);
+ Log.Error(message);
return new ReadResult(true);
}
}
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs
===================================================================
diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r8e74b5d6680386fce48486c8253b62331f7d7055
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision 8e74b5d6680386fce48486c8253b62331f7d7055)
@@ -28,7 +28,6 @@
using Core.Common.Base.IO;
using Core.Common.IO.Exceptions;
using Core.Common.IO.Readers;
-using log4net;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.IO.FileImporters.MessageProviders;
using Ringtoets.Piping.Data;
@@ -59,7 +58,6 @@
private const string csvFileExtension = ".csv";
private readonly IImporterMessageProvider messageProvider;
private readonly ISurfaceLineUpdateDataStrategy surfaceLineUpdateStrategy;
- private readonly ILog log = LogManager.GetLogger(typeof(PipingSurfaceLinesCsvImporter));
private readonly ReferenceLine referenceLine;
private IEnumerable updatedInstances;
@@ -72,16 +70,11 @@
/// The path to the file to import from.
/// The message provider to provide messages during importer actions.
/// The strategy to update the surface lines with imported data.
- /// Thrown when
- /// or is null.
+ /// Thrown when any of the input parameters is null.
public PipingSurfaceLinesCsvImporter(RingtoetsPipingSurfaceLineCollection importTarget, ReferenceLine referenceLine, string filePath,
IImporterMessageProvider messageProvider, ISurfaceLineUpdateDataStrategy surfaceLineUpdateStrategy)
: base(filePath, importTarget)
{
- if (importTarget == null)
- {
- throw new ArgumentNullException(nameof(importTarget));
- }
if (referenceLine == null)
{
throw new ArgumentNullException(nameof(referenceLine));
@@ -129,7 +122,7 @@
protected override void LogImportCanceledMessage()
{
string message = messageProvider.GetCancelledLogMessageText(RingtoetsPipingDataResources.PipingSurfaceLineCollection_TypeDescriptor);
- log.Info(message);
+ Log.Info(message);
}
protected override void DoPostImportUpdates()
@@ -142,7 +135,7 @@
private ReadResult HandleCriticalReadError(Exception e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
e.Message);
return new ReadResult(true);
}
@@ -184,15 +177,15 @@
}
else if (readCharacteristicPointsLocations.Count > 0)
{
- log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_No_characteristic_points_for_SurfaceLine_0_,
+ Log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_No_characteristic_points_for_SurfaceLine_0_,
readSurfaceLine.Name);
}
yield return readSurfaceLine;
}
foreach (string name in readCharacteristicPointsLocationNames)
{
- log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_Characteristic_points_found_for_unknown_SurfaceLine_0_,
+ Log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_Characteristic_points_found_for_unknown_SurfaceLine_0_,
name);
}
}
@@ -209,7 +202,7 @@
if (localDikeToeAtPolder.X <= localDikeToeAtRiver.X)
{
- log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_CheckCharacteristicPoints_EntryPointL_greater_or_equal_to_ExitPointL_for_0_, characteristicPoints.Name);
+ Log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_CheckCharacteristicPoints_EntryPointL_greater_or_equal_to_ExitPointL_for_0_, characteristicPoints.Name);
return false;
}
@@ -222,13 +215,13 @@
if (result.TypeOfIntersection == ReferenceLineIntersectionsResult.NoIntersections)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline_1_,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline_1_,
readSurfaceLine.Name,
Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_This_could_be_caused_coordinates_being_local_coordinate_system);
}
else if (result.TypeOfIntersection == ReferenceLineIntersectionsResult.MultipleIntersectionsOrOverlap)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline, readSurfaceLine.Name);
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CheckReferenceLineInterSections_Surfaceline_0_does_not_correspond_to_current_referenceline, readSurfaceLine.Name);
}
return result;
@@ -268,9 +261,7 @@
}
}
}
- return intersectionPoint != null ?
- ReferenceLineIntersectionResult.CreateIntersectionResult(intersectionPoint) :
- ReferenceLineIntersectionResult.CreateNoSingleIntersectionResult();
+ return intersectionPoint != null ? ReferenceLineIntersectionResult.CreateIntersectionResult(intersectionPoint) : ReferenceLineIntersectionResult.CreateNoSingleIntersectionResult();
}
private static void SetCharacteristicPointsOnSurfaceLine(RingtoetsPipingSurfaceLine readSurfaceLine, CharacteristicPoints characteristicPointsLocation)
@@ -322,12 +313,12 @@
return new ReadResult(true);
}
- log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Start_reading_surface_lines_from_File_0_,
+ Log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Start_reading_surface_lines_from_File_0_,
FilePath);
ReadResult readPipingSurfaceLines = ReadPipingSurfaceLines(reader);
- log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Finished_reading_surface_lines_from_File_0_,
+ Log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadSurfaceLines_Finished_reading_surface_lines_from_File_0_,
FilePath);
return readPipingSurfaceLines;
@@ -387,7 +378,7 @@
}
catch (LineParseException e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_ParseErrorMessage_0_SurfaceLine_skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_ReadPipingSurfaceLines_ParseErrorMessage_0_SurfaceLine_skipped,
e.Message);
}
}
@@ -396,7 +387,7 @@
{
if (readSurfaceLineIdentifiers.Any(i => i.Name == ringtoetsPipingSurfaceLine.Name))
{
- log.WarnFormat(
+ Log.WarnFormat(
Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_Duplicate_definitions_for_same_location_0_,
ringtoetsPipingSurfaceLine.Name);
@@ -413,7 +404,7 @@
}
catch (CriticalFileReadException e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
e.Message);
return -1;
}
@@ -427,7 +418,7 @@
}
catch (ArgumentException e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
e.Message);
return null;
}
@@ -453,7 +444,7 @@
if (consecutiveDuplicatePointIndices.Any())
{
- log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_SurfaceLine_0_has_multiple_duplicate_geometry_points_and_is_ignored,
+ Log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_SurfaceLine_0_has_multiple_duplicate_geometry_points_and_is_ignored,
ringtoetsPipingSurfaceLine.Name);
ringtoetsPipingSurfaceLine.SetGeometry(readPoints.Where((p, index) => !consecutiveDuplicatePointIndices.Contains(index)));
}
@@ -479,12 +470,12 @@
return new ReadResult(true);
}
- log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadCharacteristicPoints_Start_reading_characteristic_points_from_File_0_,
+ Log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadCharacteristicPoints_Start_reading_characteristic_points_from_File_0_,
characteristicPointsFilePath);
ReadResult readCharacteristicPoints = ReadCharacteristicPoints(characteristicPointsFilePath, reader);
- log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadCharacteristicPoints_Finished_reading_characteristic_points_from_File_0_,
+ Log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_ReadCharacteristicPoints_Finished_reading_characteristic_points_from_File_0_,
characteristicPointsFilePath);
return readCharacteristicPoints;
@@ -545,7 +536,7 @@
}
catch (LineParseException e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_ReadCharacteristicPoints_ParseErrorMessage_0_CharacteristicPoints_skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_ReadCharacteristicPoints_ParseErrorMessage_0_CharacteristicPoints_skipped,
e.Message);
}
}
@@ -554,7 +545,7 @@
{
if (list.Any(i => i.Name == location.Name))
{
- log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_Duplicate_definitions_for_same_characteristic_point_location_0_,
+ Log.WarnFormat(Resources.PipingSurfaceLinesCsvImporter_AddImportedDataToModel_Duplicate_definitions_for_same_characteristic_point_location_0_,
location.Name);
return false;
}
@@ -569,7 +560,7 @@
}
catch (CriticalFileReadException e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
e.Message);
return -1;
}
@@ -583,7 +574,7 @@
}
catch (ArgumentException e)
{
- log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
+ Log.ErrorFormat(Resources.PipingSurfaceLinesCsvImporter_CriticalErrorMessage_0_File_Skipped,
e.Message);
return null;
}
@@ -594,7 +585,7 @@
string path = FilePath.Insert(FilePath.Length - csvFileExtension.Length, characteristicPointsFileSubExtension);
if (!File.Exists(path))
{
- log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_Import_No_characteristic_points_file_for_surface_line_file_expecting_file_0_, path);
+ Log.InfoFormat(Resources.PipingSurfaceLinesCsvImporter_Import_No_characteristic_points_file_for_surface_line_file_expecting_file_0_, path);
return null;
}
return path;