Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSegments.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSegments.cs (.../CsvImporterSegments.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSegments.cs (.../CsvImporterSegments.cs) (revision 4069) @@ -55,7 +55,7 @@ if (headers.Count() != 4) { string csvHeaderError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderError"); - throw new CsvImporterSegmentsException(String.Format("{0} : {1}", fileName, csvHeaderError)); + throw new CsvImporterSegmentsException($"{fileName} : {csvHeaderError}"); } const string fieldsement_id = "segment_id"; @@ -70,7 +70,7 @@ if ((colIndexSoilProfileId < 0) && (colIndexGeometry2dName < 0)) { string csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); - throw new CsvImporterSoilProfilesException(String.Format("{0} : {1} {2} / {3}", fileName, csvHeaderFieldError, fieldsoilprofile_id, fieldsoilgeometry2D_name)); + throw new CsvImporterSoilProfilesException($"{fileName} : {csvHeaderFieldError} {fieldsoilprofile_id} / {fieldsoilgeometry2D_name}"); } const string fieldprobability = "probability"; @@ -115,7 +115,7 @@ else { string csvSegmentCalculationTypeError = LocalizationManager.GetTranslatedText(GetType(), "csvSegmentCalculationTypeError"); - ErrorMessages.Add(String.Format("{0} : {1} {2}", fileName, segment.SegmentId, csvSegmentCalculationTypeError)); + ErrorMessages.Add($"{fileName} : {segment.SegmentId} {csvSegmentCalculationTypeError}"); } ImportedItems.Add(segment); @@ -143,7 +143,7 @@ if (index < 0) { string csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); - throw new CsvImporterSegmentsException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, fieldName)); + throw new CsvImporterSegmentsException($"{fileName} : {csvHeaderFieldError} {fieldName}"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoHelperServices.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoHelperServices.cs (.../DtoHelperServices.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/DtoHelperServices.cs (.../DtoHelperServices.cs) (revision 4069) @@ -319,7 +319,7 @@ } catch { - throw new DtoPropertyMapException(string.Format("Error reading property {0} of type {1}", pInfo.Name, pInfo.ReflectedType.Name)); + throw new DtoPropertyMapException($"Error reading property {pInfo.Name} of type {pInfo.ReflectedType.Name}"); } if (val != null) Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Segment.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Segment.cs (.../Segment.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Segment.cs (.../Segment.cs) (revision 4069) @@ -271,11 +271,11 @@ { if (spp.SoilProfile != null) { - sb.Append(String.Format("(1D) {0} ({1}%) ", spp.SoilProfile.Name, spp.Probability)); + sb.Append($"(1D) {spp.SoilProfile.Name} ({spp.Probability}%) "); } else { - sb.Append(String.Format("(2D) {0} ({1}%) ", spp.SoilGeometry2DName, spp.Probability)); + sb.Append($"(2D) {spp.SoilGeometry2DName} ({spp.Probability}%) "); } } } Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 4056) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/DamEngineRunner.cs (.../DamEngineRunner.cs) (revision 4069) @@ -401,7 +401,7 @@ } catch (Exception e) { - LogManager.Add(new LogMessage(LogMessageType.FatalError, typeof(EngineInterface), string.Format("{0}", e.Message))); + LogManager.Add(new LogMessage(LogMessageType.FatalError, typeof(EngineInterface), $"{e.Message}")); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/CoverageFunction.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/CoverageFunction.cs (.../CoverageFunction.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/CoverageFunction.cs (.../CoverageFunction.cs) (revision 4069) @@ -103,7 +103,7 @@ { if (string.IsNullOrEmpty(attributeName)) { - throw new ArgumentException(string.Format("An invalid attribute found at index {0}", index)); + throw new ArgumentException($"An invalid attribute found at index {index}"); } index++; @@ -128,12 +128,12 @@ if (!matches.Any()) { - throw new FeatureCoverageException(string.Format("No geometries found covering point ({0} {1})", x, y)); + throw new FeatureCoverageException($"No geometries found covering point ({x} {y})"); } if (matches.Count() > 1) { - throw new FeatureCoverageException(string.Format("Multiple geometries found covering point ({0} {1})", x, y)); + throw new FeatureCoverageException($"Multiple geometries found covering point ({x} {y})"); } return matches.First().Attributes[attrName]; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardImporter.cs (.../WaterBoardImporter.cs) (revision 4069) @@ -792,8 +792,7 @@ int soilIndex = dike.SoilList.GetSoilIndexByName(layer.SoilName); if (soilIndex < 0) { - throw new WaterBoardImporterException(String.Format("Soil '{0}' not found in 1d-profile '{1}'", - dpSoilProfile.Layers[layerIndex].SoilName, soilProfile1DId)); + throw new WaterBoardImporterException($"Soil '{dpSoilProfile.Layers[layerIndex].SoilName}' not found in 1d-profile '{soilProfile1DId}'"); } soilProfile.Layers.Add(new SoilLayer1D @@ -812,7 +811,7 @@ } else { - throw new WaterBoardImporterException(String.Format("Soil 1d-profile '{0}' has no layers", soilProfile.Name)); + throw new WaterBoardImporterException($"Soil 1d-profile '{soilProfile.Name}' has no layers"); } return soilProfile; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/GaugePLLine.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/GaugePLLine.cs (.../GaugePLLine.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/GaugePLLine.cs (.../GaugePLLine.cs) (revision 4069) @@ -43,7 +43,7 @@ public override string ToString() { - return String.Format("({0}, {1}, '{2}', '{3}')", X.HasValue ? X.ToString() : "?", Z.HasValue ? Z.ToString() : "?", GaugeIDX, GaugeIDZ); + return $"({(X.HasValue ? X.ToString() : "?")}, {(Z.HasValue ? Z.ToString() : "?")}, '{GaugeIDX}', '{GaugeIDZ}')"; } } @@ -61,7 +61,7 @@ public override string ToString() { - string result = String.Format("{0} | ", PLLineType.ToString()); + string result = $"{PLLineType.ToString()} | "; foreach (GaugePLLinePoint point in Points) { result += point + ", "; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationCharacteristicPointImporter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationCharacteristicPointImporter.cs (.../LocationCharacteristicPointImporter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationCharacteristicPointImporter.cs (.../LocationCharacteristicPointImporter.cs) (revision 4069) @@ -169,7 +169,7 @@ { if (!Directory.Exists(path)) { - throw new DirectoryNotFoundException(string.Format("Data folder '{0}' not found", path)); + throw new DirectoryNotFoundException($"Data folder '{path}' not found"); } return Directory.GetFiles(path); @@ -191,7 +191,7 @@ if (!IsRepositoryValid(repository, attributeName)) { throw new InvalidOperationException( - string.Format("The geometry repository doesn't contain the required attribute '{0}'", attributeName)); + $"The geometry repository doesn't contain the required attribute '{attributeName}'"); } } @@ -200,8 +200,7 @@ if (!IsRepositoryValid(repository, attributeName)) { throw new ArgumentException( - string.Format("The ShapeFile '{0}' doesn't contain the required attribute '{1}'", - fileName, attributeName)); + $"The ShapeFile '{fileName}' doesn't contain the required attribute '{attributeName}'"); } } @@ -214,15 +213,13 @@ if (!files.Any(file => file.EndsWith(CharacteristicLinesFile))) { - throw new FileNotFoundException(string.Format("The folder '{0}' doesn't contain the required file '{1}'", - dataFolder, CharacteristicLinesFile)); + throw new FileNotFoundException($"The folder '{dataFolder}' doesn't contain the required file '{CharacteristicLinesFile}'"); } if (!files.Any(file => file.EndsWith(LocationsFile))) { throw new FileNotFoundException( - string.Format("The folder '{0}' doesn't contain the required file '{1}'", - dataFolder, LocationsFile)); + $"The folder '{dataFolder}' doesn't contain the required file '{LocationsFile}'"); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InRangeSpecification.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InRangeSpecification.cs (.../InRangeSpecification.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InRangeSpecification.cs (.../InRangeSpecification.cs) (revision 4069) @@ -35,7 +35,7 @@ this.max = max; Name = "In range specification"; - Description = string.Format("The candidate value should have a value between {0} and {1}. Boundaries are included", min, max); + Description = $"The candidate value should have a value between {min} and {max}. Boundaries are included"; } public override bool IsSatisfiedBy(double candidate) Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Dike.cs (.../Dike.cs) (revision 4069) @@ -246,7 +246,7 @@ { if (SoilDatabaseName == null || !File.Exists(SoilDatabaseName)) { - throw new DikeException(String.Format("The soil database '{0}' cannot be found", SoilDatabaseName)); + throw new DikeException($"The soil database '{SoilDatabaseName}' cannot be found"); } SoilBaseDB = SoilbaseDB.Create(SoilDatabaseName); @@ -272,7 +272,7 @@ { if (SoilDatabaseName == null || !File.Exists(SoilDatabaseName)) { - throw new DikeException(String.Format("The MGeobase database '{0}' cannot be found", SoilDatabaseName)); + throw new DikeException($"The MGeobase database '{SoilDatabaseName}' cannot be found"); } if (soilList.Soils.Count == 0) @@ -283,7 +283,7 @@ if (soilList.Soils.Count == 0) { - throw new DikeException(String.Format("The MGeobase database '{0}' does not contain soils and can not be used.", SoilDatabaseName)); + throw new DikeException($"The MGeobase database '{SoilDatabaseName}' does not contain soils and can not be used."); } var mgbDB = new MGeobaseDB(soilList); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeCoordinateSystemConverter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeCoordinateSystemConverter.cs (.../DikeCoordinateSystemConverter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DikeCoordinateSystemConverter.cs (.../DikeCoordinateSystemConverter.cs) (revision 4069) @@ -47,7 +47,7 @@ { // This can obviously only be done when SurfaceLine is available // In unit test situations sometimes the surfaceline is not defined - ThrowIfAlreadyConvertedToLocalCoordinates(location.AreLocalXZObjectsCreated, String.Format("Location {0}", location.Name)); + ThrowIfAlreadyConvertedToLocalCoordinates(location.AreLocalXZObjectsCreated, $"Location {location.Name}"); var coordinateSystemConverter = new CoordinateSystemConverter(); coordinateSystemConverter.DefineGlobalXYZBasedOnLine(location.SurfaceLine2.Geometry); PL1Line localPL1Line = (location.PL1Line != null) ? location.PL1Line.Clone() : null; @@ -94,7 +94,7 @@ { if (isConvertedToLocalCoordinates) { - throw new DikeCoordinateSystemConverterException(String.Format("{0} has already been converted from global to local coordinates", objectDescription)); + throw new DikeCoordinateSystemConverterException($"{objectDescription} has already been converted from global to local coordinates"); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/PolygonAttributeImporter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/PolygonAttributeImporter.cs (.../PolygonAttributeImporter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/PolygonAttributeImporter.cs (.../PolygonAttributeImporter.cs) (revision 4069) @@ -116,7 +116,7 @@ double x = XGetter(target); double y = YGetter(target); - Debug.Write(string.Format("analyzing location at ({0} {1})", x, y)); + Debug.Write($"analyzing location at ({x} {y})"); List features = AttributeRepository.GetFeaturesCovering(x, y).ToList(); if (features.Count == 0) @@ -129,7 +129,7 @@ if (features.Count > 1) { Debug.WriteLine("Error: Multiple matches"); - AddError(new FeatureCoverageException(string.Format("Multiple geometries found covering point ({0} {1})", x.ToString("F2"), y.ToString("F2")))); + AddError(new FeatureCoverageException($"Multiple geometries found covering point ({x.ToString("F2")} {y.ToString("F2")})")); continue; } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs (.../LocationPropertyImporter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationPropertyImporter.cs (.../LocationPropertyImporter.cs) (revision 4069) @@ -177,8 +177,7 @@ if (!LocationShapeFileAttributeMap.IsAttributeIdSupported(attributeId)) { - string message = string.Format("The attribute id '{0}' is not supported by this importer.", - attributeId); + string message = $"The attribute id '{attributeId}' is not supported by this importer."; ImproperAttributeMessages.Add(message); } else @@ -223,7 +222,7 @@ var file = new ShapeFileLocation(DataFileLocation, dataFileName); if (!file.Exists) { - throw new FileNotFoundException(string.Format("The file '{0}' is not found", file.FullPath)); + throw new FileNotFoundException($"The file '{file.FullPath}' is not found"); } return file; @@ -263,7 +262,7 @@ } catch (LineAttributeImporterException e) { - throw new LocationPropertyImporterException(String.Format("Error finding locations in crossections, {0}", e.Message)); + throw new LocationPropertyImporterException($"Error finding locations in crossections, {e.Message}"); } #if DEBUG Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs (.../LocationShapeFileImporter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileImporter.cs (.../LocationShapeFileImporter.cs) (revision 4069) @@ -103,7 +103,7 @@ var file = new ShapeFileLocation(shapeFileLocation, locationMapping.File); if (!file.Exists) { - throw new FileNotFoundException(string.Format("The file '{0}' is not found", file.FullPath)); + throw new FileNotFoundException($"The file '{file.FullPath}' is not found"); } var importer = new LocationShapeFileImporter(existingLocationRecords, configuredAttributes) Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs =================================================================== diff -u -r4058 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (.../Location.cs) (revision 4058) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Location.cs (.../Location.cs) (revision 4069) @@ -539,7 +539,7 @@ { if (SoildatabaseName == null || !File.Exists(SoildatabaseName)) { - throw new DikeException(String.Format("The soil database '{0}' cannot be found", SoildatabaseName)); + throw new DikeException($"The soil database '{SoildatabaseName}' cannot be found"); } return SoilbaseDB.Create(SoildatabaseName); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs (.../LocationShapeFileAttributeMap.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LocationShapeFileAttributeMap.cs (.../LocationShapeFileAttributeMap.cs) (revision 4069) @@ -127,7 +127,7 @@ if (AttributePropertyMap.ContainsKey(key)) { throw new TypeInitializationException(typeof(LocationShapeFileAttributeMap).FullName, - new ArgumentException(string.Format("The item with the key '{0}' has already been added", key))); + new ArgumentException($"The item with the key '{key}' has already been added")); } AttributePropertyMap.Add(key, keyValuePair.Value); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/ThrowHelper.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/ThrowHelper.cs (.../ThrowHelper.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/ThrowHelper.cs (.../ThrowHelper.cs) (revision 4069) @@ -266,7 +266,7 @@ { if (!File.Exists(fileName)) { - throw new FileNotFoundException(string.Format(GetResourceString(resourceNamesName), String.Format("{0} in {1}", (fileName ?? ""), DamProject.ProjectWorkingPath))); + throw new FileNotFoundException(string.Format(GetResourceString(resourceNamesName), $"{(fileName ?? "")} in {DamProject.ProjectWorkingPath}")); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSurfaceLines.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSurfaceLines.cs (.../CsvImporterSurfaceLines.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSurfaceLines.cs (.../CsvImporterSurfaceLines.cs) (revision 4069) @@ -145,7 +145,7 @@ if (index < 0) { string csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); - throw new CsvImporterSurfaceLinesException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, fieldName)); + throw new CsvImporterSurfaceLinesException($"{fileName} : {csvHeaderFieldError} {fieldName}"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterScenarios.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterScenarios.cs (.../CsvImporterScenarios.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterScenarios.cs (.../CsvImporterScenarios.cs) (revision 4069) @@ -56,7 +56,7 @@ if (headers.Count() < 2) { string csvHeaderError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderError"); - throw new CsvImporterSegmentsException(String.Format("{0} : {1}", fileName, csvHeaderError)); + throw new CsvImporterSegmentsException($"{fileName} : {csvHeaderError}"); } const string fieldLocationId = CsvColumnNames.LocationColumnName; @@ -269,7 +269,7 @@ if (index < 0) { string csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); - throw new CsvImporterScenariosException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, fieldName)); + throw new CsvImporterScenariosException($"{fileName} : {csvHeaderFieldError} {fieldName}"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs (.../Scenario.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Scenario.cs (.../Scenario.cs) (revision 4069) @@ -1017,24 +1017,25 @@ /// public override string ToString() { - return String.Format("Location={0}, ID={1} RiverLevel={2} RiverLevelLow={3} DikeTableHeight={4} RequiredSafetyFactorStabilityInnerSlope={5} RequiredSafetyFactorStabilityOuterSlope={6} PlLineOffsetBelowDikeTopAtRiver={7} PlLineOffsetBelowDikeToeAtPolder={8} PlLineOffsetBelowDikeTopAtPolder={9} PlLineOffsetBelowShoulderBaseInside={10} UsePlLineOffsetBelowDikeCrestMiddle {11} PlLineOffsetBelowDikeCrestMiddle {12} UsePlLineOffsetFactorBelowShoulderCrest {13} PlLineOffsetFactorBelowShoulderCrest {14} HeadPl3={15} HeadPl4={16} PolderLevel={17} HeadPl2={18}", - Location.Name, LocationScenarioID, RiverLevel, - RiverLevelLow.HasValue ? RiverLevelLow.Value.ToString(CultureInfo.InvariantCulture) : "?", - DikeTableHeight.HasValue ? DikeTableHeight.Value.ToString(CultureInfo.InvariantCulture) : "?", - ModelFactors.RequiredSafetyFactorStabilityInnerSlope.ToString(CultureInfo.InvariantCulture), - ModelFactors.RequiredSafetyFactorStabilityOuterSlope.ToString(CultureInfo.InvariantCulture), - PlLineOffsetBelowDikeTopAtRiver.ToString(CultureInfo.InvariantCulture), - PlLineOffsetBelowDikeToeAtPolder.ToString(CultureInfo.InvariantCulture), - PlLineOffsetBelowDikeTopAtPolder.ToString(CultureInfo.InvariantCulture), - PlLineOffsetBelowShoulderBaseInside.ToString(CultureInfo.InvariantCulture), - UsePlLineOffsetBelowDikeCrestMiddle.HasValue ? UsePlLineOffsetBelowDikeCrestMiddle.Value.ToString(CultureInfo.InvariantCulture) : "?", - PlLineOffsetBelowDikeCrestMiddle.HasValue ? PlLineOffsetBelowDikeCrestMiddle.Value.ToString(CultureInfo.InvariantCulture) : "?", - UsePlLineOffsetFactorBelowShoulderCrest.HasValue ? UsePlLineOffsetFactorBelowShoulderCrest.Value.ToString(CultureInfo.InvariantCulture) : "?", - PlLineOffsetFactorBelowShoulderCrest.HasValue ? PlLineOffsetFactorBelowShoulderCrest.Value.ToString(CultureInfo.InvariantCulture) : "?", - HeadPl3.HasValue ? HeadPl3.Value.ToString(CultureInfo.InvariantCulture) : "?", - HeadPl4.HasValue ? HeadPl4.Value.ToString(CultureInfo.InvariantCulture) : "?", - PolderLevel.ToString(CultureInfo.InvariantCulture), - HeadPl2.HasValue ? HeadPl2.Value.ToString(CultureInfo.InvariantCulture) : "?"); + return $"Location={Location.Name}, " + + $"ID={LocationScenarioID} " + + $"RiverLevel={RiverLevel} " + + $"RiverLevelLow={(RiverLevelLow.HasValue ? RiverLevelLow.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"DikeTableHeight={(DikeTableHeight.HasValue ? DikeTableHeight.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"RequiredSafetyFactorStabilityInnerSlope={ModelFactors.RequiredSafetyFactorStabilityInnerSlope.ToString(CultureInfo.InvariantCulture)} " + + $"RequiredSafetyFactorStabilityOuterSlope={ModelFactors.RequiredSafetyFactorStabilityOuterSlope.ToString(CultureInfo.InvariantCulture)} " + + $"PlLineOffsetBelowDikeTopAtRiver={PlLineOffsetBelowDikeTopAtRiver.ToString(CultureInfo.InvariantCulture)} " + + $"PlLineOffsetBelowDikeToeAtPolder={PlLineOffsetBelowDikeToeAtPolder.ToString(CultureInfo.InvariantCulture)} " + + $"PlLineOffsetBelowDikeTopAtPolder={PlLineOffsetBelowDikeTopAtPolder.ToString(CultureInfo.InvariantCulture)} " + + $"PlLineOffsetBelowShoulderBaseInside={PlLineOffsetBelowShoulderBaseInside.ToString(CultureInfo.InvariantCulture)} " + + $"UsePlLineOffsetBelowDikeCrestMiddle {(UsePlLineOffsetBelowDikeCrestMiddle.HasValue ? UsePlLineOffsetBelowDikeCrestMiddle.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"PlLineOffsetBelowDikeCrestMiddle {(PlLineOffsetBelowDikeCrestMiddle.HasValue ? PlLineOffsetBelowDikeCrestMiddle.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"UsePlLineOffsetFactorBelowShoulderCrest {(UsePlLineOffsetFactorBelowShoulderCrest.HasValue ? UsePlLineOffsetFactorBelowShoulderCrest.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"PlLineOffsetFactorBelowShoulderCrest {(PlLineOffsetFactorBelowShoulderCrest.HasValue ? PlLineOffsetFactorBelowShoulderCrest.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"HeadPl3={(HeadPl3.HasValue ? HeadPl3.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"HeadPl4={(HeadPl4.HasValue ? HeadPl4.Value.ToString(CultureInfo.InvariantCulture) : "?")} " + + $"PolderLevel={PolderLevel.ToString(CultureInfo.InvariantCulture)} " + + $"HeadPl2={(HeadPl2.HasValue ? HeadPl2.Value.ToString(CultureInfo.InvariantCulture) : "?")}"; } /// Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs (.../CsvImporterLocations.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterLocations.cs (.../CsvImporterLocations.cs) (revision 4069) @@ -50,7 +50,7 @@ if (headers.Count() < 3) { string csvHeaderError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderError"); - throw new CsvImporterSegmentsException(String.Format("{0} : {1}", fileName, csvHeaderError)); + throw new CsvImporterSegmentsException($"{fileName} : {csvHeaderError}"); } int colIndexLocationId = CsvReaderUtilities.GetHeaderIndexByString(headers, CsvColumnNames.LocationColumnName); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs (.../LineAttributeImporter.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Importers/LineAttributeImporter.cs (.../LineAttributeImporter.cs) (revision 4069) @@ -220,7 +220,7 @@ string locationId = GetID(crossSection); if (!targetLookup.ContainsKey(locationId)) { - errors.Add(new ImportException(string.Format("Location {0} not found", LocationIDAttributeName))); + errors.Add(new ImportException($"Location {LocationIDAttributeName} not found")); continue; } @@ -254,8 +254,7 @@ catch (Exception e) { throw new AttributeParseException( - string.Format("Error parsing the value '{0}' of '{1}' for target '{2}' ", value.ToString().Replace("\0", ""), - mapping.Name, target.LocationId), e); + $"Error parsing the value '{value.ToString().Replace("\0", "")}' of '{mapping.Name}' for target '{target.LocationId}' ", e); } } } @@ -271,7 +270,7 @@ bool attributeExists = feature.Attributes.Exists(LocationIDAttributeName); if (!attributeExists) { - throw new LineAttributeImporterException(String.Format("Cannot find attribute '{0}'", LocationIDAttributeName)); + throw new LineAttributeImporterException($"Cannot find attribute '{LocationIDAttributeName}'"); } return feature.Attributes[LocationIDAttributeName].ToString().ToLowerInvariant(); Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs (.../FillDamUiFromXmlInput.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamEngineIo/FillDamUiFromXmlInput.cs (.../FillDamUiFromXmlInput.cs) (revision 4069) @@ -381,7 +381,7 @@ { if ((surfaceLine.Points == null) || (surfaceLine.Points.Length < 1)) { - throw new NullReferenceException(string.Format("Surfaceline '{0}' has no points", surfaceLine.Name)); + throw new NullReferenceException($"Surfaceline '{surfaceLine.Name}' has no points"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvExportData.cs (.../CsvExportData.cs) (revision 4069) @@ -2058,9 +2058,7 @@ } catch (Exception) { - ExceptionMessage = string.Format( - "The file {0} could not be opened with D-Stability. Make sure D-Stability is installed and that files with the extension {1} are associated with D-Stability.", - InputFile, Path.GetExtension(InputFile)); + ExceptionMessage = $"The file {InputFile} could not be opened with D-Stability. Make sure D-Stability is installed and that files with the extension {Path.GetExtension(InputFile)} are associated with D-Stability."; DataEventPublisher.AfterChange(this, "ExceptionMessage"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSoilProfiles.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSoilProfiles.cs (.../CsvImporterSoilProfiles.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterSoilProfiles.cs (.../CsvImporterSoilProfiles.cs) (revision 4069) @@ -57,7 +57,7 @@ if ((headers.Count() < 3) || (headers.Count() > 4)) { string csvHeaderError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderError"); - throw new CsvImporterSoilProfilesException(String.Format("{0} : {1}", fileName, csvHeaderError)); + throw new CsvImporterSoilProfilesException($"{fileName} : {csvHeaderError}"); } const string fieldsoilprofile_id = "soilprofile_id"; @@ -91,7 +91,7 @@ catch (Exception e) { string csvSoilProfileError = String.Format(LocalizationManager.GetTranslatedText(GetType(), "csvSoilProfileError"), soilProfile.SoilProfileId, colIndex + 1); - ErrorMessages.Add(String.Format("Record {0} : {1}", index, csvSoilProfileError + e.Message)); + ErrorMessages.Add($"Record {index} : {csvSoilProfileError + e.Message}"); } } } @@ -111,8 +111,7 @@ if (index < 0) { string csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); - throw new CsvImporterSoilProfilesException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, - fieldName)); + throw new CsvImporterSoilProfilesException($"{fileName} : {csvHeaderFieldError} {fieldName}"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 4069) @@ -236,12 +236,12 @@ public override string ToString() { var description = ""; - description += String.Format("{0}", FailureMechanismSystemType); + description += $"{FailureMechanismSystemType}"; if ((FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside) || (FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside)) { //interface? - description += String.Format(" ({0})", FailureMechanismeParamatersMStab.MStabParameters.Model); + description += $" ({FailureMechanismeParamatersMStab.MStabParameters.Model})"; } return description; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Common.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Common.cs (.../Common.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DtoAssembler/Common.cs (.../Common.cs) (revision 4069) @@ -49,7 +49,7 @@ } catch (Exception e) { - throw new Exception(string.Format("{0}: {1}", assemblyName, e.Message)); + throw new Exception($"{assemblyName}: {e.Message}"); } } @@ -67,15 +67,14 @@ if (str == null) { throw new Exception( - string.Format("Could not locate embedded resource '{0}' in assembly '{1}'", - resourceName, assembly.GetName())); + $"Could not locate embedded resource '{resourceName}' in assembly '{assembly.GetName()}'"); } return str; } catch (Exception e) { - throw new Exception(string.Format("{0}: {1}", assembly.GetName(), e.Message)); + throw new Exception($"{assembly.GetName()}: {e.Message}"); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/UpliftFactorToBetaCalculator.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/UpliftFactorToBetaCalculator.cs (.../UpliftFactorToBetaCalculator.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/UpliftFactorToBetaCalculator.cs (.../UpliftFactorToBetaCalculator.cs) (revision 4069) @@ -56,7 +56,7 @@ { if (upliftFactor < 0) { - throw new UpliftFactorToBetaCalculatorException(String.Format("Upliftfactor of {0} is < 0.0 not allowed", upliftFactor)); + throw new UpliftFactorToBetaCalculatorException($"Upliftfactor of {upliftFactor} is < 0.0 not allowed"); } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterCharacteristicPoints.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterCharacteristicPoints.cs (.../CsvImporterCharacteristicPoints.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvImporters/CsvImporterCharacteristicPoints.cs (.../CsvImporterCharacteristicPoints.cs) (revision 4069) @@ -57,7 +57,7 @@ if (headers.Count() < minimalNumberOfColumns) { string csvHeaderColumnCountError = String.Format(LocalizationManager.GetTranslatedText(GetType(), "csvHeaderColumnCountError"), minimalNumberOfColumns); - throw new CsvImporterCharacteristicPointsException(String.Format("{0} : {1}", fileName, csvHeaderColumnCountError)); + throw new CsvImporterCharacteristicPointsException($"{fileName} : {csvHeaderColumnCountError}"); } int SurfaceLineIdCol = CsvReaderUtilities.GetHeaderIndexByString(headers, CharacteristicPointCsvIdentifiers.LocationId); @@ -457,8 +457,7 @@ if (index < 0) { string csvHeaderFieldError = LocalizationManager.GetTranslatedText(GetType(), "csvHeaderFieldError"); - throw new CsvImporterCharacteristicPointsException(String.Format("{0} : {1} {2}", fileName, csvHeaderFieldError, - fieldName)); + throw new CsvImporterCharacteristicPointsException($"{fileName} : {csvHeaderFieldError} {fieldName}"); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/ShapeFileReader.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/ShapeFileReader.cs (.../ShapeFileReader.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/ShapeFileReader.cs (.../ShapeFileReader.cs) (revision 4069) @@ -79,11 +79,9 @@ if (reader.RecordCount != count) { - string message = string.Format( - "The shape file '{0}' contains multiple records but only one (composite) shape. " + - "This is not yet supported. The current implementation of the shape file reader only works " + - "with shape files where each shape has exactly one database record.", - File.FullPath); + string message = $"The shape file '{File.FullPath}' contains multiple records but only one (composite) shape. " + + "This is not yet supported. The current implementation of the shape file reader only works " + + "with shape files where each shape has exactly one database record."; throw new NotSupportedException(message); } } Index: DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/CalculationParametersAssemblerTest.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/CalculationParametersAssemblerTest.cs (.../CalculationParametersAssemblerTest.cs) (revision 4056) +++ DamClients/DamLive/trunk/src/Deltares.DamLive.Tests/CalculationParametersAssemblerTest.cs (.../CalculationParametersAssemblerTest.cs) (revision 4069) @@ -68,7 +68,7 @@ // When parsing, then exception is thrown Assert.That(() => assembler.CreateDomainObject(inputDocument), Throws.TypeOf(typeof(DtoAssemblerException)).With.Message.EqualTo( - String.Format("Your input file is incorrect. The specified parameter '{0}' in your xml is obsolete. Please remove it.", obsoleteElement))); + $"Your input file is incorrect. The specified parameter '{obsoleteElement}' in your xml is obsolete. Please remove it.")); } [Test] @@ -86,7 +86,7 @@ // When parsing, then exception is thrown Assert.That(() => assembler.CreateDomainObject(inputDocument), Throws.TypeOf(typeof(DtoAssemblerException)).With.Message.EqualTo( - String.Format("Your input file is incorrect. The specified parameter '{0}' in your xml is obsolete. Please remove it.", obsoleteElement))); + $"Your input file is incorrect. The specified parameter '{obsoleteElement}' in your xml is obsolete. Please remove it.")); } [Test] Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorImportFromExcelSheet.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorImportFromExcelSheet.cs (.../SensorImportFromExcelSheet.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/SensorImportFromExcelSheet.cs (.../SensorImportFromExcelSheet.cs) (revision 4069) @@ -66,7 +66,7 @@ DataSet ds = null; string fileName = sourceFile; - string connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName); + string connectionString = $"Provider=Microsoft.Jet.OLEDB.4.0; data source={fileName}; Extended Properties=Excel 8.0;"; using (var conn = new OleDbConnection(connectionString)) { ds = FillDataSet(conn, ds, sheets); @@ -102,8 +102,8 @@ count++; } - Logger.LogInfo(string.Format("Successfully imported {0} sensor groups(s).", count)); - Logger.LogInfo(string.Format("Successfully imported {0} sensor profile(s).", count)); + Logger.LogInfo($"Successfully imported {count} sensor groups(s)."); + Logger.LogInfo($"Successfully imported {count} sensor profile(s)."); } private static List ParseSensors(DataSet ds) @@ -116,8 +116,7 @@ { if (row.IsNull(IDColumnName)) { - Logger.LogWarning(string.Format( - "Error reading row {0} in worksheet {1}. This row will be skipped.", count + 2, SensorSheetName)); + Logger.LogWarning($"Error reading row {count + 2} in worksheet {SensorSheetName}. This row will be skipped."); continue; } @@ -182,7 +181,7 @@ sensors.Add(sensor); } - Logger.LogInfo(string.Format("Successfully imported {0} sensor(s).", count)); + Logger.LogInfo($"Successfully imported {count} sensor(s)."); return sensors; } @@ -215,8 +214,7 @@ if (groupIdValue == null) { - Logger.LogWarning(string.Format("Error reading the value from column {0} for group id {1}", - sensorSelectionColumnName, id)); + Logger.LogWarning($"Error reading the value from column {sensorSelectionColumnName} for group id {id}"); } else { @@ -230,8 +228,7 @@ if (groupIds == null) { - Logger.LogWarning(string.Format("Couldn't find group id '{0}' in worksheet {1}", id, - SensorGroupSheetName)); + Logger.LogWarning($"Couldn't find group id '{id}' in worksheet {SensorGroupSheetName}"); return true; } @@ -246,7 +243,7 @@ { if (!string.IsNullOrWhiteSpace(currentSensorId)) { - string message = string.Format("Error finding sensor. The sensor with ID '{0}' was not found in the Excel worksheet '{1}'", currentSensorId, SensorSheetName); + string message = $"Error finding sensor. The sensor with ID '{currentSensorId}' was not found in the Excel worksheet '{SensorSheetName}'"; throw new InvalidOperationException(message, ioe); } @@ -294,8 +291,7 @@ if (record == null) { - Logger.LogWarning(string.Format("Location profile ID '{0}' not found in worksheet {1}. Location profile skipped.", - location.Name, SensorProfileSheetName)); + Logger.LogWarning($"Location profile ID '{location.Name}' not found in worksheet {SensorProfileSheetName}. Location profile skipped."); return true; } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvParser.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvParser.cs (.../CsvParser.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/CsvParser.cs (.../CsvParser.cs) (revision 4069) @@ -175,7 +175,7 @@ { if (materializer.IsRequired(key) && !headers.Contains(key)) { - throw new CsvParserException(string.Format("The mapped key '{0}' doesn't exist in the header of csv file '{1}'", key, fileName)); + throw new CsvParserException($"The mapped key '{key}' doesn't exist in the header of csv file '{fileName}'"); } } @@ -192,7 +192,7 @@ // For now just throw an exception if (items.Length != firstLineItemCount) { - throw new CsvParserException(string.Format("The number of items parsed in the current line don't match with the number of the first line in csv file '{0}'", fileName)); + throw new CsvParserException($"The number of items parsed in the current line don't match with the number of the first line in csv file '{fileName}'"); } var entity = new T(); @@ -220,7 +220,7 @@ } catch (Exception e) { - throw new CsvParserException(String.Format("Error parsing CSV file. Check if no empty lines or columns are defined in file '{0}. (Parser error is: '{1}')", fileName, e.Message)); + throw new CsvParserException($"Error parsing CSV file. Check if no empty lines or columns are defined in file '{fileName}. (Parser error is: '{e.Message}')"); } yield return entity; Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Extensions/SpecificationExtensions.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Extensions/SpecificationExtensions.cs (.../SpecificationExtensions.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/Extensions/SpecificationExtensions.cs (.../SpecificationExtensions.cs) (revision 4069) @@ -92,8 +92,7 @@ { Subject = property, MessageType = ValidationResultType.Error, - Error = new ValidationException(string.Format("The property or field {0} has the value {1} which is less then the specification {2}", - property.Name, gte.CandidateValue, minAttr.AttributeValue)) + Error = new ValidationException($"The property or field {property.Name} has the value {gte.CandidateValue} which is less then the specification {minAttr.AttributeValue}") }); } } @@ -110,8 +109,7 @@ { Subject = property, MessageType = ValidationResultType.Error, - Error = new ValidationException(string.Format("The property or field {0} has the value {1} which is greater then the specification {2}", - property.Name, lte.CandidateValue, maxAttr.AttributeValue)) + Error = new ValidationException($"The property or field {property.Name} has the value {lte.CandidateValue} which is greater then the specification {maxAttr.AttributeValue}") }); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InBetweenRangeSpecification.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InBetweenRangeSpecification.cs (.../InBetweenRangeSpecification.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Specifications/InBetweenRangeSpecification.cs (.../InBetweenRangeSpecification.cs) (revision 4069) @@ -35,7 +35,7 @@ this.max = max; Name = "In between range specification"; - Description = string.Format("The candidate value should have a value between {0} and {1}. Boundaries are excluded", min, max); + Description = $"The candidate value should have a value between {min} and {max}. Boundaries are excluded"; } /// Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/FeatureRepository.cs =================================================================== diff -u -r4059 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/FeatureRepository.cs (.../FeatureRepository.cs) (revision 4059) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Maps/FeatureRepository.cs (.../FeatureRepository.cs) (revision 4069) @@ -153,7 +153,7 @@ return feature.Geometry; } - throw new ArgumentException(string.Format("Unknown id '{0}', geometry not found", id)); + throw new ArgumentException($"Unknown id '{id}', geometry not found"); } public IEnumerable> GetAttributes(IGeometry geom) Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardPostProcessRelativeProfiles.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardPostProcessRelativeProfiles.cs (.../WaterBoardPostProcessRelativeProfiles.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/WaterBoardPostProcessRelativeProfiles.cs (.../WaterBoardPostProcessRelativeProfiles.cs) (revision 4069) @@ -59,7 +59,7 @@ GeometryPoint characteristicGeometryPoint = location.SurfaceLine2.CharacteristicPoints.GetGeometryPoint(characteristicPointType); var errorFound = false; var newSegment = new Segment(); - newSegment.Name = String.Format("Segment {0}-{1}", orgSegment.Name, location.Name); + newSegment.Name = $"Segment {orgSegment.Name}-{location.Name}"; var soilProbabilityIndex = 0; foreach (SoilGeometryProbability orgSoilGeometryProbability in orgSegment.SoilProfileProbabilities) { @@ -68,7 +68,7 @@ { if (characteristicGeometryPoint == null) { - throw new WaterBoardPostProcessRelativeProfilesException(String.Format("Characteristic point {0} is not defined", characteristicPointType)); + throw new WaterBoardPostProcessRelativeProfilesException($"Characteristic point {characteristicPointType} is not defined"); } if (orgSoilGeometryProbability.SoilProfileType.Equals(SoilProfileType.SoilGeometryStiFile)) @@ -84,7 +84,7 @@ // Dependent if deltaZ is positive or negative, the bottomLevel should be adjusted before or after adjusting the layers // This is necessary, because the bottomlevel is adjusted automatically during adjustment of layers SoilProfile1D soilProfile1D = newSoilGeometryProbability.SoilProfile; - soilProfile1D.Name = String.Format("{0}-{1}-{2}", orgSoilGeometryProbability.SoilProfile.Name, location.Name, soilProbabilityIndex); + soilProfile1D.Name = $"{orgSoilGeometryProbability.SoilProfile.Name}-{location.Name}-{soilProbabilityIndex}"; double deltaZ = characteristicGeometryPoint.Z - soilProfile1D.TopLevel; if (deltaZ < 0) { @@ -127,8 +127,7 @@ { errorFound = true; LogManager.Messages.Add(new LogMessage(LogMessageType.Error, location, - String.Format("Error in location '{0}' applying relative height for soilprofile '{1}': {2} ", - location.Name, orgSoilGeometryProbability.SoilGeometryName, e.Message))); + $"Error in location '{location.Name}' applying relative height for soilprofile '{orgSoilGeometryProbability.SoilGeometryName}': {e.Message} ")); } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamHelperFunctions.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamHelperFunctions.cs (.../DamHelperFunctions.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamHelperFunctions.cs (.../DamHelperFunctions.cs) (revision 4069) @@ -42,13 +42,11 @@ string calculationName; if (iterationIndex < 0) { - calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})", locationName, scenarioName, - soilGeometryName); + calculationName = $"Loc({locationName})_Sce({scenarioName})_Pro({soilGeometryName})"; } else { - calculationName = String.Format("Loc({0})_Sce({1})_Pro({2})_Ite({3})", locationName, scenarioName, - soilGeometryName, iterationIndex); + calculationName = $"Loc({locationName})_Sce({scenarioName})_Pro({soilGeometryName})_Ite({iterationIndex})"; } return Regex.Replace(calculationName, @"[\\\/:\*\?""'<>|.]", "_"); @@ -74,15 +72,15 @@ /// internal static string GetProjectFileName(string dikeName, Location location, int? jobCount, MStabModelType? model, string stabilityWorkingPath, DateTime? dateTime) { - string calculationName = String.Format("Dik({0})_Loc({1})", dikeName, location.Name); + string calculationName = $"Dik({dikeName})_Loc({location.Name})"; if (jobCount != null) { - calculationName = calculationName + String.Format("_Stp({0})", jobCount); + calculationName = calculationName + $"_Stp({jobCount})"; } if (model != null) { - calculationName = calculationName + String.Format("_Mdl({0})", model); + calculationName = calculationName + $"_Mdl({model})"; } if (dateTime != null) Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Sensor.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Sensor.cs (.../Sensor.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Sensors/Sensor.cs (.../Sensor.cs) (revision 4069) @@ -359,8 +359,7 @@ { string name = string.IsNullOrWhiteSpace(Name) ? "name_not_set" : Name; - return string.Format("[ID: {0}, Name: {1}, Depth: {2}, Type: {3}, RelativeLocation: {4}]", - ID, name, Depth, Type, RelativeLocation); + return $"[ID: {ID}, Name: {name}, Depth: {Depth}, Type: {Type}, RelativeLocation: {RelativeLocation}]"; } public bool IsVisible(string property) Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSourceContainer.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSourceContainer.cs (.../DataSourceContainer.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DataPlugins/Configuration/DataSourceContainer.cs (.../DataSourceContainer.cs) (revision 4069) @@ -178,7 +178,7 @@ { foreach (DataAttribute attribute in container.DataAttributes.Where(attribute => !allowedAttributes.Contains(attribute.AttributeName))) { - yield return new NotSupportedException(string.Format("The attribute {0} is not supported.", attribute)); + yield return new NotSupportedException($"The attribute {attribute} is not supported."); } } } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/CombineImportedData.cs (.../CombineImportedData.cs) (revision 4069) @@ -150,8 +150,7 @@ { string coincidingCharPointsFoundForSurfaceError = LocalizationManager.GetTranslatedText(GetType(), "CoincidingCharPointsFoundForSurfaceError"); - var logmessage = new LogMessage(LogMessageType.Error, null, String.Format("{0} : {1} : {2} : {3}", - surfaceLine.Name, coincidingCharPointsFoundForSurfaceError, firstType.ToString(), secondType.ToString())); + var logmessage = new LogMessage(LogMessageType.Error, null, $"{surfaceLine.Name} : {coincidingCharPointsFoundForSurfaceError} : {firstType.ToString()} : {secondType.ToString()}"); ErrorMessages.Add(logmessage); } @@ -219,7 +218,7 @@ { string segmentRecordHasNoId = LocalizationManager.GetTranslatedText(GetType(), "segmentRecordHasNoId"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("Record {0} : {1}", segmentRecordId, segmentRecordHasNoId)); + $"Record {segmentRecordId} : {segmentRecordHasNoId}"); ErrorMessages.Add(logmessage); return false; } @@ -239,7 +238,7 @@ { string segmentHasNoProfileOrGeometry = LocalizationManager.GetTranslatedText(GetType(), "segmentHasNoProfileOrGeometry"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("{0} : {1}", segmentId, segmentHasNoProfileOrGeometry)); + $"{segmentId} : {segmentHasNoProfileOrGeometry}"); ErrorMessages.Add(logmessage); return false; } @@ -259,7 +258,7 @@ { string segmentHasProfileAndGeometry = LocalizationManager.GetTranslatedText(GetType(), "segmentHasProfileAndGeometry"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("{0} : {1}", segmentId, segmentHasProfileAndGeometry)); + $"{segmentId} : {segmentHasProfileAndGeometry}"); ErrorMessages.Add(logmessage); return false; } @@ -320,8 +319,7 @@ { string dikeHasNoSoilProfiles = LocalizationManager.GetTranslatedText(GetType(), "dikeHasNoSoilProfiles"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("{0} : {1}", dike.Name, - dikeHasNoSoilProfiles)); + $"{dike.Name} : {dikeHasNoSoilProfiles}"); ErrorMessages.Add(logmessage); } else @@ -388,7 +386,7 @@ { string noIdForSoilProfileRecordError = LocalizationManager.GetTranslatedText(GetType(), "noIdOrSoilForSoilProfileRecordError"); var logmessage = new LogMessage(LogMessageType.Error, this, - String.Format("Record {0} : {1}", soilProfileRecord.SoilProfileRecordId, noIdForSoilProfileRecordError)); + $"Record {soilProfileRecord.SoilProfileRecordId} : {noIdForSoilProfileRecordError}"); ErrorMessages.Add(logmessage); AddErrorMessage("noIdOrSoilForSoilProfileRecordError", soilProfileRecord); } @@ -436,7 +434,7 @@ { string existingSoilProfileHasNoLayers = LocalizationManager.GetTranslatedText(GetType(), "existingSoilProfileHasNoLayers"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("{0} : {1}", soilProfileRecord.SoilProfileId, existingSoilProfileHasNoLayers)); + $"{soilProfileRecord.SoilProfileId} : {existingSoilProfileHasNoLayers}"); ErrorMessages.Add(logmessage); } @@ -480,7 +478,7 @@ { if ((soilProfile.Layers == null) || (soilProfile.Layers.Count == 0)) { - throw new SoilProfileLayersNotSortedDescendingException(String.Format("Soilprofile '{0}' has no layers", soilProfile.Name)); + throw new SoilProfileLayersNotSortedDescendingException($"Soilprofile '{soilProfile.Name}' has no layers"); } soilProfile.ValidateDirect(); @@ -504,7 +502,7 @@ catch (Exception e) { //var error = new StringBuilder(); - string error = String.Format("Error postprocessing soilprofile '{0}': {1}", soilProfile1.Name, e.Message); + string error = $"Error postprocessing soilprofile '{soilProfile1.Name}': {e.Message}"; var logmessage = new LogMessage(LogMessageType.Error, null, error); ErrorMessages.Add(logmessage); } @@ -524,7 +522,7 @@ { string noIdForSurfaceLineRecordError = LocalizationManager.GetTranslatedText(GetType(), "noIdSurfaceLineRecordError"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("Record {0} : {1}", surfaceLineRecord.SurfaceLineRecordId, noIdForSurfaceLineRecordError)); + $"Record {surfaceLineRecord.SurfaceLineRecordId} : {noIdForSurfaceLineRecordError}"); ErrorMessages.Add(logmessage); } else @@ -583,8 +581,7 @@ { string charPointNotFoundInSurfaceError = LocalizationManager.GetTranslatedText(GetType(), "charPointNotFoundInSurfaceError"); - var logmessage = new LogMessage(LogMessageType.Error, null, String.Format("{0} : {1} {2}", - surfaceLine.Name, charPointNotFoundInSurfaceError, point.Type)); + var logmessage = new LogMessage(LogMessageType.Error, null, $"{surfaceLine.Name} : {charPointNotFoundInSurfaceError} {point.Type}"); ErrorMessages.Add(logmessage); charCheck = false; } @@ -595,8 +592,7 @@ { string noCharPointsFoundForSurfaceError = LocalizationManager.GetTranslatedText(GetType(), "noCharPointsFoundForSurfaceError"); var logmessage = new LogMessage(LogMessageType.Error, null, - String.Format("{0} : {1}", surfaceLine.Name, - noCharPointsFoundForSurfaceError)); + $"{surfaceLine.Name} : {noCharPointsFoundForSurfaceError}"); ErrorMessages.Add(logmessage); charCheck = false; } @@ -632,9 +628,7 @@ string noLocationIdForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "noLocationIdForScenarioRecordError"); var logmessage = new LogMessage(LogMessageType.Error, null, - string.Format("Record {0} : {1}", - scenarioRecord.ScenarioRecordId, - noLocationIdForScenarioRecordError)); + $"Record {scenarioRecord.ScenarioRecordId} : {noLocationIdForScenarioRecordError}"); ErrorMessages.Add(logmessage); recordError = true; } @@ -644,8 +638,7 @@ { string invalidLocationScenarioIdForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "invalidLocationScenarioIdForScenarioRecordError"); - var logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", - scenarioRecord.ScenarioRecordId, invalidLocationScenarioIdForScenarioRecordError)); + var logmessage = new LogMessage(LogMessageType.Error, null, $"Record {scenarioRecord.ScenarioRecordId} : {invalidLocationScenarioIdForScenarioRecordError}"); ErrorMessages.Add(logmessage); recordError = true; } @@ -654,8 +647,7 @@ if (dikeLocation == null) { string locationNotFoundForScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "locationNotFoundForScenarioRecordError"); - var logmessage = new LogMessage(LogMessageType.Error, this, string.Format("Record {0} : {1}", - scenarioRecord.ScenarioRecordId, locationNotFoundForScenarioRecordError)); + var logmessage = new LogMessage(LogMessageType.Error, this, $"Record {scenarioRecord.ScenarioRecordId} : {locationNotFoundForScenarioRecordError}"); ErrorMessages.Add(logmessage); recordError = true; } @@ -669,8 +661,7 @@ { string duplicateScenarioRecordError = LocalizationManager.GetTranslatedText(GetType(), "duplicateScenarioRecordError"); string errorMessage = string.Format(duplicateScenarioRecordError, dikeLocation.Name, dikeScenario.LocationScenarioID); - var logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", - scenarioRecord.ScenarioRecordId, errorMessage)); + var logmessage = new LogMessage(LogMessageType.Error, null, $"Record {scenarioRecord.ScenarioRecordId} : {errorMessage}"); ErrorMessages.Add(logmessage); } else @@ -682,8 +673,7 @@ if (locationRecord?.PolderLevel == null && scenarioRecord.PolderLevel == null) { string missingPolderLevelError = LocalizationManager.GetTranslatedText(GetType(), "missingPolderLevel"); - var logmessage = new LogMessage(LogMessageType.Error, null, string.Format("Record {0} : {1}", - scenarioRecord.ScenarioRecordId, missingPolderLevelError)); + var logmessage = new LogMessage(LogMessageType.Error, null, $"Record {scenarioRecord.ScenarioRecordId} : {missingPolderLevelError}"); ErrorMessages.Add(logmessage); } else @@ -884,10 +874,7 @@ string noIdForSoilProfileRecordError = LocalizationManager.GetTranslatedText(GetType(), errorMessageTranslationId); var logmessage = new LogMessage( LogMessageType.Error, this, - String.Format("Record {0} : {1}", - id, - noIdForSoilProfileRecordError - ) + $"Record {id} : {noIdForSoilProfileRecordError}" ); ErrorMessages.Add(logmessage); } Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Gauge.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Gauge.cs (.../Gauge.cs) (revision 4056) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/Gauge.cs (.../Gauge.cs) (revision 4069) @@ -33,6 +33,6 @@ public override string ToString() { - return String.Format("{0} @ Location {1} | Local X={2}", Name, Location != null ? Location.Name : "?", LocalX); + return $"{Name} @ Location {(Location != null ? Location.Name : "?")} | Local X={LocalX}"; } } \ No newline at end of file Index: DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/CalculationParametersAssembler.cs =================================================================== diff -u -r4056 -r4069 --- DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/CalculationParametersAssembler.cs (.../CalculationParametersAssembler.cs) (revision 4056) +++ DamClients/DamLive/trunk/src/Deltares.Dam.Application.Live/CalculationParametersAssembler.cs (.../CalculationParametersAssembler.cs) (revision 4069) @@ -185,7 +185,7 @@ XElement obsoleteElement = calculationModulesElement.Element(obsoleteElementKeyName); if (obsoleteElement != null) { - throw new DtoAssemblerException(String.Format("Your input file {0} is incorrect. The specified parameter '{1}' in your xml is obsolete. Please remove it.", fileName, obsoleteElementKeyName)); + throw new DtoAssemblerException($"Your input file {fileName} is incorrect. The specified parameter '{obsoleteElementKeyName}' in your xml is obsolete. Please remove it."); } }