Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs =================================================================== diff -u -r2529 -r2864 --- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 2529) +++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamProject.cs (.../DamProject.cs) (revision 2864) @@ -29,6 +29,7 @@ using Deltares.Standard.IO.DtoAssembler; using Deltares.Standard.Reflection; using System.IO; +using System.Xml; using Deltares.Dam.Data.IO; using Deltares.Geotechnics.Soils; using Deltares.Standard; @@ -58,7 +59,7 @@ public DamProject() { - this.damProjectData = new DamProjectData(); + this.damProjectData = new DamProjectData(); } public static string GetNewTempDirectory() @@ -272,6 +273,10 @@ object project = xmlSerializer.XmlDeserialize(fileName, typeof(DamProjectData), new DefaultClassFactory()); this.damProjectData = (DamProjectData)project; + if (damProjectData != null) + { + damProjectData.VersionInfo.InitVersionInfoAfterRead(); + } if (damProjectData.DamProjectType == DamProjectType.AssessOld) { ClearProject(); @@ -297,6 +302,7 @@ } // Project still needs a reference to soilmaterials database; to be resolved later. // This will become obsolete as soon as Delphi DGeoStability version is no longer used. + ResolveBackwardCompatibility(); UpdateSoilDatabaseReferences(damProjectFolder); UpdateSoilPropertiesToSoilDatabase(); }); @@ -310,6 +316,15 @@ return damProjectData; } + private void ResolveBackwardCompatibility() + { + if (DamProjectData.VersionInfo.FileVersionAsRead == 0) + { + XmlDocument xmlDocument = new XmlDocument(); + xmlDocument.LoadXml(this.ProjectFileName); + } + } + /// /// Updates older projects for missing data or changed data model. /// @@ -666,6 +681,8 @@ savedProjectMap = ProjectMap; } + damProjectData.VersionInfo.InitVersionInfo(); + DataEventPublisher.InvokeWithoutPublishingEvents(() => { EnsureSoilmaterialsFileWithProject(fileName);