Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/BackwardCompatibility.cs =================================================================== diff -u -r2909 -r2937 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/BackwardCompatibility.cs (.../BackwardCompatibility.cs) (revision 2909) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/IO/BackwardCompatibility.cs (.../BackwardCompatibility.cs) (revision 2937) @@ -63,21 +63,17 @@ // Older DamLive projects do not have scenarios defined, so add them if needed AddScenarioIfNoScenariosDefined(location); - double? value; if (fileVersion <= 1) { - value = AttributeValueFromNode(node, "PolderLevel"); - UpdatePolderLevel(location, value); - value = AttributeValueFromNode(node, "HeadPL2"); - UpdateHeadPl2(location, value); + UpdatePolderLevel(location, AttributeDoubleValueFromNode(node, "PolderLevel")); + UpdateHeadPl2(location, AttributeDoubleValueFromNode(node, "HeadPL2")); + UpdateZoneType(location, AttributeStringValueFromNode(node, "StabilityZoneType")); } if (fileVersion == 0) { - value = AttributeValueFromNode(node, "HeadPl3"); - UpdateHeadPl3(location, value); - value = AttributeValueFromNode(node, "HeadPl4"); - UpdateHeadPl4(location, value); + UpdateHeadPl3(location, AttributeDoubleValueFromNode(node, "HeadPl3")); + UpdateHeadPl4(location, AttributeDoubleValueFromNode(node, "HeadPl4")); } } } @@ -87,15 +83,15 @@ { if (location.Scenarios.Count == 0) { - location.Scenarios.Add(new Scenario() + location.Scenarios.Add(new Scenario { RiverLevel = 0.0, RiverLevelLow = 0.0 }); } } - private static double? AttributeValueFromNode(XmlNode node, string attributeName) + private static double? AttributeDoubleValueFromNode(XmlNode node, string attributeName) { double? value = null; var attribute = node.Attributes?[attributeName]; @@ -106,6 +102,12 @@ return value; } + private static string AttributeStringValueFromNode(XmlNode node, string attributeName) + { + XmlAttribute attribute = node.Attributes?[attributeName]; + return attribute?.Value; + } + private static void UpdatePolderLevel(Location location, double? value) { if (value != null) @@ -141,5 +143,19 @@ } } + private static void UpdateZoneType(Location location, string value) + { + if (!string.IsNullOrWhiteSpace(value)) + { + if (value.Equals("ZoneAreas")) + { + location.StabilityZoneType = MStabZonesType.NoZones; + } + else + { + location.StabilityZoneType = (MStabZonesType) Enum.Parse(typeof(MStabZonesType), value); + } + } + } } } \ No newline at end of file Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u -r2909 -r2937 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 2909) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 2937) @@ -318,9 +318,12 @@ } /// Updates the current file version for non-versioned files (projects created with DAM 19.1 or earlier) - /// Set FileVersion to 0 (for DAM versions 18.1.3 and earlier). - /// Set FileVersion to 1 (for DAM version 19.1.1) - /// FileVersion 2 is the first versioned file (for DAM version 20.1.1) + /// + /// Set FileVersion to 0 (for DAM versions 18.1.3 and earlier). + /// Set FileVersion to 1 (for DAM version 19.1.1) + /// FileVersion 2 is the first versioned file (for DAM version 20.1.1) + /// + /// private void UpdateVersionInfoForNonVersionedFiles(string fileVersion) { if (this.DamProjectData.VersionInfo.FileVersionAsRead == 0)