diff --git a/MapControl/Shared/GeoImage.cs b/MapControl/Shared/GeoImage.cs index c74f7e4c..f5c3ff6a 100644 --- a/MapControl/Shared/GeoImage.cs +++ b/MapControl/Shared/GeoImage.cs @@ -125,7 +125,7 @@ namespace MapControl { if (!double.TryParse(line, NumberStyles.Float, CultureInfo.InvariantCulture, out double parameter)) { - throw new ArgumentException("Failed parsing line " + (i + 1) + " in world file \"" + worldFilePath + "\"."); + throw new ArgumentException($"Failed parsing line {i + 1} in world file {worldFilePath}."); } return parameter; }) @@ -133,7 +133,7 @@ namespace MapControl if (parameters.Count != 6) { - throw new ArgumentException("Insufficient number of parameters in world file \"" + worldFilePath + "\"."); + throw new ArgumentException($"Insufficient number of parameters in world file {worldFilePath}."); } return new Matrix( diff --git a/MapControl/Shared/GroundOverlay.cs b/MapControl/Shared/GroundOverlay.cs index 70476a66..f5fde74b 100644 --- a/MapControl/Shared/GroundOverlay.cs +++ b/MapControl/Shared/GroundOverlay.cs @@ -134,7 +134,7 @@ namespace MapControl if (docEntry == null) { - throw new ArgumentException("No KML entry found in " + archiveFilePath); + throw new ArgumentException($"No KML entry found in {archiveFilePath}."); } var imageOverlays = await Task.Run(() => diff --git a/MapControl/Shared/WmtsCapabilities.cs b/MapControl/Shared/WmtsCapabilities.cs index d74baf15..0c732f47 100644 --- a/MapControl/Shared/WmtsCapabilities.cs +++ b/MapControl/Shared/WmtsCapabilities.cs @@ -60,7 +60,7 @@ namespace MapControl if (layerElement == null) { - throw new ArgumentException("Layer element \"" + layerIdentifier + "\" not found."); + throw new ArgumentException($"Layer element \"{layerIdentifier}\" not found."); } } else @@ -87,7 +87,7 @@ namespace MapControl if (string.IsNullOrEmpty(style)) { - throw new ArgumentException("No valid Style element found in Layer \"" + layerIdentifier + "\"."); + throw new ArgumentException($"No valid Style element found in Layer \"{layerIdentifier}\"."); } var urlTemplate = ReadUrlTemplate(layerElement, layerIdentifier, style, capabilitiesUrl); @@ -107,7 +107,7 @@ namespace MapControl if (tileMatrixSetElement == null) { - throw new ArgumentException("Linked TileMatrixSet element not found in Layer \"" + layerIdentifier + "\"."); + throw new ArgumentException($"Linked TileMatrixSet element not found in Layer \"{layerIdentifier}\"."); } tileMatrixSets.Add(ReadTileMatrixSet(tileMatrixSetElement)); @@ -150,7 +150,7 @@ namespace MapControl if (formats.Count == 0) { - throw new ArgumentException("No Format element found in Layer \"" + layerIdentifier + "\"."); + throw new ArgumentException($"No Format element found in Layer \"{layerIdentifier}\"."); } var format @@ -174,7 +174,7 @@ namespace MapControl if (string.IsNullOrEmpty(urlTemplate)) { - throw new ArgumentException("No valid ResourceURL element found in Layer \"" + layerIdentifier + "\"."); + throw new ArgumentException($"No valid ResourceURL element found in Layer \"{layerIdentifier}\"."); } return urlTemplate; @@ -196,7 +196,7 @@ namespace MapControl if (string.IsNullOrEmpty(supportedCrs)) { - throw new ArgumentException("No ows:SupportedCRS element found in TileMatrixSet \"" + identifier + "\"."); + throw new ArgumentException($"No ows:SupportedCRS element found in TileMatrixSet \"{identifier}\"."); } var tileMatrixes = new List(); @@ -208,7 +208,7 @@ namespace MapControl if (tileMatrixes.Count <= 0) { - throw new ArgumentException("No TileMatrix elements found in TileMatrixSet \"" + identifier + "\"."); + throw new ArgumentException($"No TileMatrix elements found in TileMatrixSet \"{identifier}\"."); } return new WmtsTileMatrixSet(identifier, supportedCrs, tileMatrixes); @@ -231,7 +231,7 @@ namespace MapControl if (string.IsNullOrEmpty(valueString) || !double.TryParse(valueString, NumberStyles.Float, CultureInfo.InvariantCulture, out double scaleDenominator)) { - throw new ArgumentException("No ScaleDenominator element found in TileMatrix \"" + identifier + "\"."); + throw new ArgumentException($"No ScaleDenominator element found in TileMatrix \"{identifier}\"."); } valueString = tileMatrixElement.Element(ns + "TopLeftCorner")?.Value; @@ -242,35 +242,35 @@ namespace MapControl !double.TryParse(topLeftCornerStrings[0], NumberStyles.Float, CultureInfo.InvariantCulture, out double left) || !double.TryParse(topLeftCornerStrings[1], NumberStyles.Float, CultureInfo.InvariantCulture, out double top)) { - throw new ArgumentException("No TopLeftCorner element found in TileMatrix \"" + identifier + "\"."); + throw new ArgumentException($"No TopLeftCorner element found in TileMatrix \"{identifier}\"."); } valueString = tileMatrixElement.Element(ns + "TileWidth")?.Value; if (string.IsNullOrEmpty(valueString) || !int.TryParse(valueString, out int tileWidth)) { - throw new ArgumentException("No TileWidth element found in TileMatrix \"" + identifier + "\"."); + throw new ArgumentException($"No TileWidth element found in TileMatrix \"{identifier}\"."); } valueString = tileMatrixElement.Element(ns + "TileHeight")?.Value; if (string.IsNullOrEmpty(valueString) || !int.TryParse(valueString, out int tileHeight)) { - throw new ArgumentException("No TileHeight element found in TileMatrix \"" + identifier + "\"."); + throw new ArgumentException($"No TileHeight element found in TileMatrix \"{identifier}\"."); } valueString = tileMatrixElement.Element(ns + "MatrixWidth")?.Value; if (string.IsNullOrEmpty(valueString) || !int.TryParse(valueString, out int matrixWidth)) { - throw new ArgumentException("No MatrixWidth element found in TileMatrix \"" + identifier + "\"."); + throw new ArgumentException($"No MatrixWidth element found in TileMatrix \"{identifier}\"."); } valueString = tileMatrixElement.Element(ns + "MatrixHeight")?.Value; if (string.IsNullOrEmpty(valueString) || !int.TryParse(valueString, out int matrixHeight)) { - throw new ArgumentException("No MatrixHeight element found in TileMatrix \"" + identifier + "\"."); + throw new ArgumentException($"No MatrixHeight element found in TileMatrix \"{identifier}\"."); } var topLeft = supportedCrs == "EPSG:4326" diff --git a/MapControl/WPF/GeoImage.WPF.cs b/MapControl/WPF/GeoImage.WPF.cs index e956a60c..62ab31f5 100644 --- a/MapControl/WPF/GeoImage.WPF.cs +++ b/MapControl/WPF/GeoImage.WPF.cs @@ -38,7 +38,7 @@ namespace MapControl } else { - throw new ArgumentException("No coordinate transformation found in \"" + sourcePath + "\"."); + throw new ArgumentException($"No coordinate transformation found in {sourcePath}."); } if (metadata.GetQuery(NoDataQuery) is string noData && int.TryParse(noData, out int noDataValue)) diff --git a/MapControl/WinUI/GeoImage.WinUI.cs b/MapControl/WinUI/GeoImage.WinUI.cs index d55fc631..ab08564e 100644 --- a/MapControl/WinUI/GeoImage.WinUI.cs +++ b/MapControl/WinUI/GeoImage.WinUI.cs @@ -56,7 +56,7 @@ namespace MapControl } else { - throw new ArgumentException("No coordinate transformation found in \"" + sourcePath + "\"."); + throw new ArgumentException($"No coordinate transformation found in {sourcePath}."); } return new Tuple(bitmap, transform);