Skip to content

Commit

Permalink
Doc var change fix (#212)
Browse files Browse the repository at this point in the history
* Fixed bug with not getting correct data from modified file on a document variable.

* Fixed output file variable
  • Loading branch information
pressr-inl authored Oct 12, 2022
1 parent e5bff3a commit 71289cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions SimulationDAL/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions SimulationDAL/Variables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 71289cb

Please sign in to comment.