Adds method SetPathPrefix to JSON SiMPL Child Onject

Reinstated the  default from proces%type%Path mehods. If no path no change propegates.
This commit is contained in:
JTA
2017-07-30 14:34:51 -04:00
parent 5e7c7771a3
commit 632b2ea3b4
6 changed files with 15 additions and 12 deletions

Binary file not shown.

View File

@@ -62,6 +62,9 @@ namespace PepperDash.Core.JsonToSimpl
Debug.Console(1, "JSON Child [{0}] cannot link to master {1}", key, masterUniqueId);
}
public void SetPathPrefix(string pathPrefix) {
PathPrefix = pathPrefix;
}
/// <summary>
/// Set the JPath to evaluate for a given bool out index.
/// </summary>
@@ -121,23 +124,21 @@ namespace PepperDash.Core.JsonToSimpl
if (Process(BoolPaths[index], out response))
OnBoolChange(response.Equals("true", StringComparison.OrdinalIgnoreCase),
index, JsonToSimplConstants.BoolValueChange);
else
OnBoolChange(false, index, JsonToSimplConstants.BoolValueChange);
else { }
// OnBoolChange(false, index, JsonToSimplConstants.BoolValueChange);
}
// Processes the path to a ushort, converting to ushort if able, firing off UshrtChange event
void ProcessUshortPath(ushort index)
{
string response;
if (Process(UshortPaths[index], out response))
{
if (Process(UshortPaths[index], out response)) {
ushort val;
try { val = Convert.ToUInt16(response); }
catch { val = 0; }
try { val = Convert.ToUInt16(response); } catch { val = 0; }
OnUShortChange(val, index, JsonToSimplConstants.UshortValueChange);
}
else
OnUShortChange(0, index, JsonToSimplConstants.UshortValueChange);
}
else { }
// OnUShortChange(0, index, JsonToSimplConstants.UshortValueChange);
}
// Processes the path to a string property and fires of a StringChange event.
@@ -146,8 +147,8 @@ namespace PepperDash.Core.JsonToSimpl
string response;
if (Process(StringPaths[index], out response))
OnStringChange(response, index, JsonToSimplConstants.StringValueChange);
else
OnStringChange("", index, JsonToSimplConstants.StringValueChange);
else { }
// OnStringChange("", index, JsonToSimplConstants.StringValueChange);
}
/// <summary>

View File

@@ -106,7 +106,9 @@ namespace PepperDash.Core.JsonToSimpl
/// <param name="child"></param>
public void AddChild(JsonToSimplChildObjectBase child)
{
if (Children.Contains(child)) return;
if (Children.Contains(child)) {
Children.Remove(child);
}
Children.Add(child);
}