1.0.5 fix for array lookups that fail stepping on index 0. Reduced debugging output

This commit is contained in:
Heath Volmer
2018-05-11 15:05:22 -06:00
parent cb63734fba
commit 494b8b09e1
4 changed files with 23 additions and 6 deletions

View File

@@ -67,23 +67,25 @@ namespace PepperDash.Core.JsonToSimpl
});
if (item == null)
{
Debug.Console(0, "Child[{0}] Array '{1}' '{2}={3}' not found: ", Key,
Debug.Console(1, "Child[{0}] Array '{1}' '{2}={3}' not found: ", Key,
PathPrefix, SearchPropertyName, SearchPropertyValue);
this.LinkedToObject = false;
return false;
}
this.LinkedToObject = true;
ArrayIndex = array.IndexOf(item);
Debug.Console(1, "Child[{0}] Found array match at index {1}", Key, ArrayIndex);
return true;
}
catch (Exception e)
{
Debug.Console(0, "Child[{0}] Array '{1}' lookup error: '{2}={3}'\r{4}", Key,
Debug.Console(1, "Child[{0}] Array '{1}' lookup error: '{2}={3}'\r{4}", Key,
PathPrefix, SearchPropertyName, SearchPropertyValue, e);
}
}
else
Debug.Console(0, "Child[{0}] Path '{1}' is not an array", Key, PathPrefix);
Debug.Console(1, "Child[{0}] Path '{1}' is not an array", Key, PathPrefix);
return false;
}

View File

@@ -35,6 +35,8 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public string PathSuffix { get; protected set; }
public bool LinkedToObject { get; protected set; }
protected JsonToSimplMaster Master;
// The sent-in JPaths for the various types
@@ -101,6 +103,12 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public virtual void ProcessAll()
{
if (!LinkedToObject)
{
Debug.Console(1, this, "Not linked to object in file. Skipping");
return;
}
if (SetAllPathsDelegate == null)
{
Debug.Console(1, this, "No SetAllPathsDelegate set. Ignoring ProcessAll");
@@ -166,7 +174,7 @@ namespace PepperDash.Core.JsonToSimpl
response = "";
if (Master == null)
{
Debug.Console(0, "JSONChild[{0}] cannot process without Master attached", Key);
Debug.Console(1, "JSONChild[{0}] cannot process without Master attached", Key);
return false;
}
@@ -213,6 +221,12 @@ namespace PepperDash.Core.JsonToSimpl
/// </summary>
public void UpdateInputsForMaster()
{
if (!LinkedToObject)
{
Debug.Console(1, this, "Not linked to object in file. Skipping");
return;
}
if (SetAllPathsDelegate == null)
{
Debug.Console(1, this, "No SetAllPathsDelegate set. Ignoring UpdateInputsForMaster");
@@ -260,7 +274,7 @@ namespace PepperDash.Core.JsonToSimpl
}
catch (Exception e)
{
Debug.Console(0, "Child[{0}] Failed setting value for path '{1}'\r{2}", Key, path, e);
Debug.Console(1, "Child[{0}] Failed setting value for path '{1}'\r{2}", Key, path, e);
}
}

View File

@@ -15,6 +15,7 @@ namespace PepperDash.Core.JsonToSimpl
{
public JsonToSimplFixedPathObject()
{
this.LinkedToObject = true;
}
}
}

View File

@@ -4,4 +4,4 @@
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pepperdash_Core")]
[assembly: AssemblyCopyright("Copyright © PepperDash 2016")]
[assembly: AssemblyVersion("1.0.4.*")]
[assembly: AssemblyVersion("1.0.5.*")]