Exemple #1
0
        /// <summary>
        /// Rename CohortLive. to Live.
        /// </summary>
        /// <param name="node">The node to modifiy</param>
        /// <param name="fileName">The name of the .apsimx file</param>
        private static void UpgradeToVersion18(XmlNode node, string fileName)
        {
            foreach (XmlNode manager in XmlUtilities.FindAllRecursivelyByType(node, "manager"))
            {
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.dlayer", ".Thickness");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.Thickness", ".Thickness");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.LL15", ".LL15");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.LL15mm", ".LL15mm");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.DUL", ".DUL");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.DULmm", ".DULmm");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.SAT", ".SAT");
                APSIMFileConverterUtilities.SearchReplaceManagerCode(manager, ".SoilWater.SATmm", ".SATmm");
            }

            foreach (XmlNode report in XmlUtilities.FindAllRecursivelyByType(node, "report"))
            {
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.dlayer", ".Thickness");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.Thickness", ".Thickness");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.LL15", ".LL15");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.LL15mm", ".LL15mm");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.DUL", ".DUL");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.DULmm", ".DULmm");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.SAT", ".SAT");
                APSIMFileConverterUtilities.SearchReplaceReportCode(report, ".SoilWater.SATmm", ".SATmm");
            }
        }
Exemple #2
0
 /// <summary>
 /// Upgrades to version 7. Find all occurrences of ESW
 /// XProperty values.
 /// </summary>
 /// <param name="node">The node to upgrade.</param>
 /// <param name="fileName">The name of the .apsimx file</param>
 private static void UpgradeToVersion7(XmlNode node, string fileName)
 {
     foreach (XmlNode manager in XmlUtilities.FindAllRecursivelyByType(node, "manager"))
     {
         APSIMFileConverterUtilities.SearchReplaceManagerCodeUsingRegEx(manager, @"([\[\]\.\w]+\.ESW)", "MathUtilities.Sum($1)", "using APSIM.Shared.Utilities;");
     }
     foreach (XmlNode report in XmlUtilities.FindAllRecursivelyByType(node, "report"))
     {
         APSIMFileConverterUtilities.SearchReplaceReportCode(report, @"([\[\]\.\w]+\.ESW)", "sum($1)");
     }
 }