Updated JsonToSimpMaster.cs and EventArgs and Constants.cs to implement passing resolved file path and filename to SIMPL. All edits are flagged with TODO: pdc-20 for easier review.

This commit is contained in:
Jason DeVito
2019-09-29 08:28:18 -05:00
parent 41b79cc639
commit 0ade04d0c7
2 changed files with 320 additions and 299 deletions

View File

@@ -19,6 +19,10 @@ namespace PepperDash.Core.JsonToSimpl
public const ushort StringValueChange = 201; public const ushort StringValueChange = 201;
public const ushort FullPathToArrayChange = 202; public const ushort FullPathToArrayChange = 202;
public const ushort ActualFilePathChange = 203; public const ushort ActualFilePathChange = 203;
// TODO: pdc-20: Added below constants for passing file path and filename back to S+
public const ushort FilenameResolvedChange = 204;
public const ushort FilePathResolvedChange = 205;
} }
//**************************************************************************************************// //**************************************************************************************************//

View File

@@ -19,6 +19,10 @@ namespace PepperDash.Core.JsonToSimpl
public string ActualFilePath { get; private set; } public string ActualFilePath { get; private set; }
// TODO: pdc-20: added to return filename back to SIMPL
public string Filename { get; private set; }
public string FilePathName { get; private set; }
/*****************************************************************************************/ /*****************************************************************************************/
/** Privates **/ /** Privates **/
@@ -66,11 +70,23 @@ namespace PepperDash.Core.JsonToSimpl
ErrorLog.Error(msg); ErrorLog.Error(msg);
return; return;
} }
//var actualFileName = actualFile.FullName;
// \xSE\xR\PDT000-Template_Main_Config-Combined_DSP_v00.02.json
// \USER\PDT000-Template_Main_Config-Combined_DSP_v00.02.json
ActualFilePath = actualFile.FullName; ActualFilePath = actualFile.FullName;
OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange); OnStringChange(ActualFilePath, 0, JsonToSimplConstants.ActualFilePathChange);
Debug.Console(1, "Actual JSON file is {0}", ActualFilePath); Debug.Console(1, "Actual JSON file is {0}", ActualFilePath);
// TODO: pdc-20: added to retrun filename to SIMPL
Filename = actualFile.Name;
OnStringChange(Filename, 0, JsonToSimplConstants.FilenameResolvedChange);
Debug.Console(1, "JSON Filename is {0}", Filename);
// TODO: pdc-20: added to return the file path to SIMPL
FilePathName = string.Format(@"{0}\", actualFile.DirectoryName);
OnStringChange(FilePathName, 0, JsonToSimplConstants.FilePathResolvedChange);
Debug.Console(1, "JSON File Path is {0}", FilePathName);
string json = File.ReadToEnd(ActualFilePath, System.Text.Encoding.ASCII); string json = File.ReadToEnd(ActualFilePath, System.Text.Encoding.ASCII);
try try
@@ -88,7 +104,8 @@ namespace PepperDash.Core.JsonToSimpl
return; return;
} }
} }
public void setDebugLevel(int level) { public void setDebugLevel(int level)
{
Debug.SetDebugLevel(level); Debug.SetDebugLevel(level);
} }
public override void Save() public override void Save()