-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSB-Code.cs
40 lines (31 loc) · 891 Bytes
/
SB-Code.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.IO;
using Newtonsoft.Json;
public class CPHInline
{
public bool Execute()
{
string json = args.ContainsKey("json") ? args["json"].ToString().Trim() : "" ;
string prefix = args.ContainsKey("parsePrefix") ? args["parsePrefix"].ToString() : "parse" ;
if (json == "")
{
CPH.LogInfo("JSON is EMPTY") ;
return false ;
}
CPH.LogDebug(json) ;
JsonTextReader reader = new JsonTextReader(new StringReader(json));
while (reader.Read())
{
string Path = reader.Path.Replace("[", "").Replace("]", "") ;
string ArgumentName = prefix + "." + Path ;
if (reader.Value != null)
{
if (reader.TokenType.ToString() != "PropertyName")
{
CPH.LogDebug(prefix + "." + Path + " = " + reader.Value) ;
CPH.SetArgument(ArgumentName, reader.Value) ;
}
}
}
return true;
}
}