From 71289cb9cf5a42d716c73cea6d2bcd8e63b4561b Mon Sep 17 00:00:00 2001 From: pressr-inl <80481912+pressr-inl@users.noreply.github.com> Date: Tue, 11 Oct 2022 18:35:16 -0600 Subject: [PATCH] Doc var change fix (#212) * Fixed bug with not getting correct data from modified file on a document variable. * Fixed output file variable --- SimulationDAL/Actions.cs | 1 + SimulationDAL/Variables.cs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SimulationDAL/Actions.cs b/SimulationDAL/Actions.cs index da130ea8..c928639f 100644 --- a/SimulationDAL/Actions.cs +++ b/SimulationDAL/Actions.cs @@ -1259,6 +1259,7 @@ public bool CompileProcessOutputFileCode(EmraldModel lists) processOutputFileCompEval.AddVariable("CurTime", typeof(Double)); processOutputFileCompEval.AddVariable("RunIdx", typeof(int)); processOutputFileCompEval.AddVariable("ExeExitCode", typeof(int)); + processOutputFileCompEval.AddVariable("OutputFile", typeof(string)); //add all the variables needed if (codeVariables != null) diff --git a/SimulationDAL/Variables.cs b/SimulationDAL/Variables.cs index 5a81120c..95aae82d 100644 --- a/SimulationDAL/Variables.cs +++ b/SimulationDAL/Variables.cs @@ -828,13 +828,13 @@ public override object GetValue() } //if not changed return the previous value - DateTime curTimestamp = File.GetCreationTime(_docFullPath); + DateTime curTimestamp = File.GetLastWriteTime(_docFullPath); string curLinkStr = linkStr(); if ((curTimestamp == _timestamp) && (_oldLinkStr == curLinkStr) && (_value != null)) return this._value; //value new so save timestamp and lookup new value - _timestamp = File.GetCreationTime(_docFullPath); + _timestamp = File.GetLastWriteTime(_docFullPath); _oldLinkStr = curLinkStr; XmlDocument xDoc = new XmlDocument(); xDoc.Load(_docFullPath); @@ -944,14 +944,14 @@ public override object GetValue() } //if not changed return the previous value - DateTime curTimestamp = File.GetCreationTime(_docFullPath); + DateTime curTimestamp = File.GetLastWriteTime(_docFullPath); string curLinkStr = linkStr(); if ((curTimestamp == _timestamp) && (_oldLinkStr == curLinkStr) && (_value != null)) return this._value; //value new so save timestamp and lookup new value - _timestamp = File.GetCreationTime(_docFullPath); + _timestamp = File.GetLastWriteTime(_docFullPath); _oldLinkStr = curLinkStr; string fileStr = File.ReadAllText(_docFullPath); JObject fullObj = JObject.Parse(fileStr); @@ -1120,14 +1120,14 @@ public override object GetValue() } //if not changed return the previous value - DateTime curTimestamp = File.GetCreationTime(_docFullPath); + DateTime curTimestamp = File.GetLastWriteTime(_docFullPath); string curLinkStr = linkStr(); if ((curTimestamp == _timestamp) && (_oldLinkStr == curLinkStr) && (_value != null)) return this._value; //value new so save timestamp and lookup new value - _timestamp = File.GetCreationTime(_docFullPath); + _timestamp = File.GetLastWriteTime(_docFullPath); _oldLinkStr = curLinkStr; string docTxt = File.ReadAllText(_docFullPath); // Find matches.